diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index e462d651cb5e..27c89017f9f4 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -545,9 +545,10 @@ void SbTreeListBox::ReloadAllEntries() } } -std::unique_ptr SbTreeListBox::ImpFindEntry(std::u16string_view rText) +std::unique_ptr SbTreeListBox::ImpFindEntry(const weld::TreeIter& rParentIter, + std::u16string_view rText) { - std::unique_ptr pIter = m_xControl->make_iterator(); + std::unique_ptr pIter = m_xControl->make_iterator(&rParentIter); bool bValidIter = m_xControl->iter_children(*pIter); while (bValidIter) { @@ -827,7 +828,8 @@ void SbTreeListBox::SetCurrentEntry (EntryDescriptor const & rDesc) if( !aLibSubName.isEmpty() ) { m_xControl->expand_row(*xLibIter); - if (std::unique_ptr xSubLibIter = ImpFindEntry(aLibSubName)) + if (std::unique_ptr xSubLibIter + = ImpFindEntry(*xLibIter, aLibSubName)) m_xControl->copy_iterator(*xSubLibIter, *xCurIter); } const OUString& aName( aDesc.GetName() ); diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx index b65fd897a6b2..c70b74f6a415 100644 --- a/basctl/source/dlged/dlgedobj.cxx +++ b/basctl/source/dlged/dlgedobj.cxx @@ -901,7 +901,7 @@ SdrObjKind DlgEdObj::GetObjIdentifier() const } } -rtl::Reference DlgEdObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference DlgEdObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new DlgEdObj(rTargetModel, *this); } diff --git a/basctl/source/inc/bastype2.hxx b/basctl/source/inc/bastype2.hxx index 221629bc2fce..522733e03b7c 100644 --- a/basctl/source/inc/bastype2.hxx +++ b/basctl/source/inc/bastype2.hxx @@ -192,7 +192,8 @@ protected: void ImpCreateLibSubEntries(const weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName); void ImpCreateLibSubEntriesInVBAMode(const weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName ); void ImpCreateLibSubSubEntriesInVBAMode(const weld::TreeIter& rLibRootEntry, const ScriptDocument& rDocument, const OUString& rLibName); - std::unique_ptr ImpFindEntry(std::u16string_view rText); + std::unique_ptr ImpFindEntry(const weld::TreeIter& rParentIter, + std::u16string_view rText); // DocumentEventListener virtual void onDocumentCreated( const ScriptDocument& _rDocument ) override; diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx index 469628ae75fe..488fc9b737f9 100644 --- a/basctl/source/inc/dlgedobj.hxx +++ b/basctl/source/inc/dlgedobj.hxx @@ -47,15 +47,15 @@ class DlgEdObj: public SdrUnoObj friend class DlgEdPropListenerImpl; friend class DlgEdForm; -private: bool bIsListening; rtl::Reference pDlgEdForm; rtl::Reference m_xPropertyChangeListener; rtl::Reference m_xContainerListener; -private: DlgEditor& GetDialogEditor (); + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; // not working yet + protected: DlgEdObj(SdrModel& rSdrModel); // copy constructor @@ -98,8 +98,6 @@ public: virtual SdrInventor GetObjInventor() const override; virtual SdrObjKind GetObjIdentifier() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; // not working yet - // FullDrag support virtual rtl::Reference getFullDragClone() const override; diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 16f5b63626ce..f5668732b23d 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -79,6 +79,7 @@ namespace basic static ImplRepository& Instance(); BasicManager* getDocumentBasicManager( const Reference< XModel >& _rxDocumentModel ); + BasicManager* getExistingDocumentBasicManager( const Reference< XModel >& _rxDocumentModel ) const; BasicManager* getOrCreateApplicationBasicManager(); static BasicManager* getApplicationBasicManager(); static void setApplicationBasicManager( std::unique_ptr _pBasicManager ); @@ -236,6 +237,15 @@ namespace basic return nullptr; } + BasicManager* ImplRepository::getExistingDocumentBasicManager( const Reference< XModel >& _rxDocumentModel ) const + { + SolarMutexGuard g; + + Reference< XInterface > xNormalized( _rxDocumentModel, UNO_QUERY ); + auto const loc = m_aStore.find( xNormalized ); + return loc != m_aStore.end() ? loc->second.get() : nullptr; + } + BasicManager* ImplRepository::getOrCreateApplicationBasicManager() { SolarMutexGuard g; @@ -600,6 +610,11 @@ namespace basic return ImplRepository::Instance().getDocumentBasicManager( _rxDocumentModel ); } + BasicManager* BasicManagerRepository::getExistingDocumentBasicManager( const Reference< XModel >& _rxDocumentModel ) + { + return ImplRepository::Instance().getExistingDocumentBasicManager( _rxDocumentModel ); + } + BasicManager* BasicManagerRepository::getApplicationBasicManager() { return ImplRepository::Instance().getOrCreateApplicationBasicManager(); diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index a98e22979417..509ef1e8e210 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -1047,7 +1047,7 @@ StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const OUString& rLibName, pLibInfo = nullptr; } - return pLibInfo ? &*pLibInfo->GetLib() : nullptr; + return pLibInfo ? pLibInfo->GetLib().get() : nullptr; } diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index ec67430dff39..cc9f023ede43 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -222,9 +222,21 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion ) mvStringOffsets[ i ] = static_cast(nOff); } r.ReadUInt32( nLen ); + if (r.good() + && (nLen > r.remainingSize() + || std::any_of(mvStringOffsets.begin(), mvStringOffsets.end(), + [nLen](sal_uInt32 nOff) { return nOff >= nLen; }))) + { + SAL_WARN("basic", "Parsing error: string pool of " << nLen + << " does not fit the record or its string offsets"); + MakeStrings(0); + bError = true; + break; + } if (r.good()) { - pStrings.reset(new sal_Unicode[ nLen ]); + // The element past the pool ends the last string. + pStrings.reset(new sal_Unicode[ nLen + 1 ]()); nStringSize = static_cast(nLen); if (GetToUnicodePoolData(r, nLen, nNext)) @@ -234,13 +246,16 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion ) } else { - std::unique_ptr pByteStrings(new char[nLen]); + std::unique_ptr pByteStrings(new char[nLen]()); r.ReadBytes(pByteStrings.get(), nLen); for (size_t j = 0; j < mvStringOffsets.size(); j++) { sal_uInt16 nOff2 = static_cast(mvStringOffsets[j]); - OUString aStr(pByteStrings.get() + nOff2, strlen(pByteStrings.get() + nOff2), eCharSet); - std::copy_n(aStr.getStr(), aStr.getLength() + 1, + const sal_uInt32 nAvail = nLen - nOff2; + const char* pByteString = pByteStrings.get() + nOff2; + OUString aStr(pByteString, strnlen(pByteString, nAvail), eCharSet); + std::copy_n(aStr.getStr(), + std::min(aStr.getLength() + 1, nAvail), pStrings.get() + nOff2); } } @@ -305,7 +320,7 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion ) // nested user defined types // declared before use, so it is ok to reference it by name on load OUString aNestedTypeName = r.ReadUniOrByteString(eCharSet); - SbxObject* pNestedTypeObj = static_cast< SbxObject* >( rTypes->Find( aNestedTypeName, SbxClassType::Object ) ); + SbxObject* pNestedTypeObj = dynamic_cast< SbxObject* >( rTypes->Find( aNestedTypeName, SbxClassType::Object ) ); if (pNestedTypeObj) { SbxObjectRef pCloneObj = cloneTypeObjectImpl( *pNestedTypeObj ); diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index 5be00ebf010d..b1a7d0402b72 100644 --- a/basic/source/sbx/sbxarray.cxx +++ b/basic/source/sbx/sbxarray.cxx @@ -342,7 +342,7 @@ bool SbxArray::LoadData( SvStream& rStrm, sal_uInt16 /*nVer*/ ) { sal_uInt16 nIdx; rStrm.ReadUInt16( nIdx ); - SbxVariableRef pVar = static_cast(Load( rStrm ).get()); + SbxVariableRef pVar = dynamic_cast(Load( rStrm ).get()); if( pVar ) { SbxVariableRef& rRef = GetRef( nIdx ); diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index 2dcdcee263f4..9f37ca2a69f8 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -534,7 +534,7 @@ void SbxObject::Remove( SbxVariable* pVar ) static bool LoadArray( SvStream& rStrm, SbxObject* pThis, SbxArray* pArray ) { - SbxArrayRef p = static_cast( SbxBase::Load( rStrm ).get() ); + SbxArrayRef p = dynamic_cast( SbxBase::Load( rStrm ).get() ); if( !p.is() ) { return false; diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 43cb0b73a03d..2366d23813b3 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -441,6 +441,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer ) SbxValues aTmp; OUString aTmpString; OUString aVal; + SbxValue::Clear(); aTmp.eType = aData.eType = static_cast(nType); aTmp.pOUString = &aVal; switch( nType ) diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index e116b65dcb35..2e6b9f686124 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -952,10 +952,12 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, // Preload? { + // A password-protected library of a document is loaded with the document's Basic project. + const bool bDocumentContainer = Reference< XModel >( mxOwnerDocument ).is(); for (auto& aName : maNameContainer.getElementNames()) { SfxLibrary* pImplLib = getImplLib( aName ); - if( pImplLib->mbPreload ) + if( pImplLib->mbPreload && !( bDocumentContainer && pImplLib->mbPasswordProtected ) ) { loadLibrary_Impl(aName, guard); } diff --git a/chart2/CppunitTest_chart2_correlation_coefficient.mk b/chart2/CppunitTest_chart2_correlation_coefficient.mk index 71476366d55e..c5bc94afa046 100644 --- a/chart2/CppunitTest_chart2_correlation_coefficient.mk +++ b/chart2/CppunitTest_chart2_correlation_coefficient.mk @@ -1,8 +1,6 @@ # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*- # -# Copyright the LibreOffice contributors. -# -# SPDX-License-Identifier: MPL-2.0 +# This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/chart2/qa/extras/chart2export3.cxx b/chart2/qa/extras/chart2export3.cxx index a379d2928405..49cb605d59e9 100644 --- a/chart2/qa/extras/chart2export3.cxx +++ b/chart2/qa/extras/chart2export3.cxx @@ -1017,6 +1017,24 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, test1904NullDate) } } +CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testTdf116148HatchWithoutName) +{ + // The bar series is filled with a hatch but names no hatch, so the drawing + // layer paints it with the item pool's default one. + loadFromFile(u"odp/tdf116148.odp"); + + save(TestFilter::PPTX); + xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/charts/chart1.xml"_ustr); + CPPUNIT_ASSERT(pXmlDoc); + + // Without the fix the series carried no fill at all, and PowerPoint filled + // the bars with its own default instead, which is solid. + static constexpr OString sFill( + "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:spPr/a:pattFill"_ostr); + assertXPath(pXmlDoc, sFill, "prst", u"ltHorz"); + assertXPath(pXmlDoc, sFill + "/a:fgClr/a:srgbClr", "val", u"3465A4"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/qa/extras/data/odp/tdf116148.odp b/chart2/qa/extras/data/odp/tdf116148.odp new file mode 100644 index 000000000000..7c0c837e0338 Binary files /dev/null and b/chart2/qa/extras/data/odp/tdf116148.odp differ diff --git a/chart2/qa/unit/correlation_coefficient_test.cxx b/chart2/qa/unit/correlation_coefficient_test.cxx index 6d0b703b2181..e60f6a489edf 100644 --- a/chart2/qa/unit/correlation_coefficient_test.cxx +++ b/chart2/qa/unit/correlation_coefficient_test.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index 22f063a3dc97..d628edfb0add 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -34,8 +34,6 @@ #include -#include -#include #include #include @@ -344,10 +342,12 @@ void ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParame } } -void ChartTypeDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ ) +std::vector +ChartTypeDialogController::getSubTypes(const ChartTypeParameter& /*rParameter*/) { - rSubTypeList.Clear(); + return {}; } + bool ChartTypeDialogController::shouldShow_3DLookControl() const { return false; @@ -432,51 +432,55 @@ const tTemplateServiceChartTypeParameterMap& ColumnChartDialogController::getTem {"com.sun.star.chart2.template.ThreeDColumnDeep" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z)}}; return s_aTemplateMap; } -void ColumnChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter ) +std::vector +ColumnChartDialogController::getSubTypes(const ChartTypeParameter& rParameter) { - rSubTypeList.Clear(); + std::vector aEntries; if( rParameter.b3DLook ) { switch(rParameter.nGeometry3D) { case DataPointGeometry3D::CYLINDER: - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_SAEULE_3D_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_SAEULE_3D_2)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_SAEULE_3D_3)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_SAEULE_3D_4)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_SAEULE_3D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_SAEULE_3D_2)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_SAEULE_3D_3)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_SAEULE_3D_4)); break; case DataPointGeometry3D::CONE: - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_KEGEL_3D_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_KEGEL_3D_2)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_KEGEL_3D_3)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_KEGEL_3D_4)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_KEGEL_3D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_KEGEL_3D_2)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_KEGEL_3D_3)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_KEGEL_3D_4)); break; case DataPointGeometry3D::PYRAMID: - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_PYRAMID_3D_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_PYRAMID_3D_2)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_PYRAMID_3D_3)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_PYRAMID_3D_4)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_PYRAMID_3D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_PYRAMID_3D_2)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_PYRAMID_3D_3)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_PYRAMID_3D_4)); break; default: //DataPointGeometry3D::CUBOID: - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_COLUMNS_3D_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_COLUMNS_3D_2)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_COLUMNS_3D_3)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_COLUMNS_3D)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_COLUMNS_3D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_COLUMNS_3D_2)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_COLUMNS_3D_3)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_COLUMNS_3D)); break; } } else { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_COLUMNS_2D_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_COLUMNS_2D_2)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_COLUMNS_2D_3)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_COLUMNS_2D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_COLUMNS_2D_2)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_COLUMNS_2D_3)); } - rSubTypeList.SetItemText( 1, SchResId( STR_NORMAL ) ); - rSubTypeList.SetItemText( 2, SchResId( STR_STACKED ) ); - rSubTypeList.SetItemText( 3, SchResId( STR_PERCENT ) ); - rSubTypeList.SetItemText( 4, SchResId( STR_DEEP ) ); + aEntries.at(0).sName = SchResId(STR_NORMAL); + aEntries.at(1).sName = SchResId(STR_STACKED); + aEntries.at(2).sName = SchResId(STR_PERCENT); + if (aEntries.size() > 3) + aEntries.at(3).sName = SchResId(STR_DEEP); + + return aEntries; } BarChartDialogController::BarChartDialogController() @@ -509,50 +513,54 @@ const tTemplateServiceChartTypeParameterMap& BarChartDialogController::getTempla {"com.sun.star.chart2.template.ThreeDBarDeep" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z)}}; return s_aTemplateMap; } -void BarChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter ) +std::vector +BarChartDialogController::getSubTypes(const ChartTypeParameter& rParameter) { - rSubTypeList.Clear(); + std::vector aEntries; if( rParameter.b3DLook ) { switch(rParameter.nGeometry3D) { case DataPointGeometry3D::CYLINDER: - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_ROEHRE_3D_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_ROEHRE_3D_2)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_ROEHRE_3D_3)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_ROEHRE_3D_4)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_ROEHRE_3D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_ROEHRE_3D_2)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_ROEHRE_3D_3)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_ROEHRE_3D_4)); break; case DataPointGeometry3D::CONE: - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_KEGELQ_3D_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_KEGELQ_3D_2)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_KEGELQ_3D_3)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_KEGELQ_3D_4)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_KEGELQ_3D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_KEGELQ_3D_2)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_KEGELQ_3D_3)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_KEGELQ_3D_4)); break; case DataPointGeometry3D::PYRAMID: - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_PYRAMIDQ_3D_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_PYRAMIDQ_3D_2)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_PYRAMIDQ_3D_3)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_PYRAMIDQ_3D_4)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_PYRAMIDQ_3D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_PYRAMIDQ_3D_2)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_PYRAMIDQ_3D_3)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_PYRAMIDQ_3D_4)); break; default: //DataPointGeometry3D::CUBOID: - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_BARS_3D_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_BARS_3D_2)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_BARS_3D_3)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_BARS_3D)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_BARS_3D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_BARS_3D_2)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_BARS_3D_3)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_BARS_3D)); break; } } else { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_BARS_2D_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_BARS_2D_2)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_BARS_2D_3)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_BARS_2D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_BARS_2D_2)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_BARS_2D_3)); } - rSubTypeList.SetItemText( 1, SchResId( STR_NORMAL ) ); - rSubTypeList.SetItemText( 2, SchResId( STR_STACKED ) ); - rSubTypeList.SetItemText( 3, SchResId( STR_PERCENT ) ); - rSubTypeList.SetItemText( 4, SchResId( STR_DEEP ) ); + aEntries.at(0).sName = SchResId(STR_NORMAL); + aEntries.at(1).sName = SchResId(STR_STACKED); + aEntries.at(2).sName = SchResId(STR_PERCENT); + if (aEntries.size() > 3) + aEntries.at(3).sName = SchResId(STR_DEEP); + + return aEntries; } //========= @@ -586,12 +594,10 @@ const tTemplateServiceChartTypeParameterMap& HistogramChartDialogController::get return s_aTemplateMap; } -void HistogramChartDialogController::fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& /*rParameter*/) +std::vector +HistogramChartDialogController::getSubTypes(const ChartTypeParameter& /*rParameter*/) { - rSubTypeList.Clear(); - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_HISTOGRAM)); - rSubTypeList.SetItemText(1, SchResId(STR_HISTOGRAM)); + return { { Image(StockImage::Yes, BMP_HISTOGRAM), SchResId(STR_HISTOGRAM) } }; } @@ -637,28 +643,31 @@ const tTemplateServiceChartTypeParameterMap& PieChartDialogController::getTempla {"com.sun.star.chart2.template.ThreeDDonutAllExploded" , ChartTypeParameter(4,false,true)}}; return s_aTemplateMap; } -void PieChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter ) +std::vector +PieChartDialogController::getSubTypes(const ChartTypeParameter& rParameter) { - rSubTypeList.Clear(); + std::vector aEntries; if( rParameter.b3DLook ) { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_CIRCLES_3D)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_CIRCLES_3D_EXPLODED)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_DONUT_3D)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_DONUT_3D_EXPLODED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_CIRCLES_3D)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_CIRCLES_3D_EXPLODED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_DONUT_3D)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_DONUT_3D_EXPLODED)); } else { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_CIRCLES_2D)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_CIRCLES_2D_EXPLODED)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_DONUT_2D)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_DONUT_2D_EXPLODED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_CIRCLES_2D)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_CIRCLES_2D_EXPLODED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_DONUT_2D)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_DONUT_2D_EXPLODED)); } - rSubTypeList.SetItemText( 1, SchResId( STR_NORMAL ) ); - rSubTypeList.SetItemText( 2, SchResId( STR_PIE_EXPLODED ) ); - rSubTypeList.SetItemText( 3, SchResId( STR_DONUT ) ); - rSubTypeList.SetItemText( 4, SchResId( STR_DONUT_EXPLODED ) ); + aEntries.at(0).sName = SchResId(STR_NORMAL); + aEntries.at(1).sName = SchResId(STR_PIE_EXPLODED); + aEntries.at(2).sName = SchResId(STR_DONUT); + aEntries.at(3).sName = SchResId(STR_DONUT_EXPLODED); + + return aEntries; } bool PieChartDialogController::shouldShow_3DLookControl() const @@ -701,14 +710,12 @@ const tTemplateServiceChartTypeParameterMap& OfPieChartDialogController::getTemp {"com.sun.star.chart2.template.PieOfPie" , ChartTypeParameter(2,false,false)}}; return s_aTemplateMap; } -void OfPieChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ ) -{ - rSubTypeList.Clear(); - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_BAR_OF_PIE)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_PIE_OF_PIE)); - rSubTypeList.SetItemText( 1, SchResId( STR_BAR_OF_PIE ) ); - rSubTypeList.SetItemText( 2, SchResId( STR_PIE_OF_PIE ) ); +std::vector +OfPieChartDialogController::getSubTypes(const ChartTypeParameter& /*rParameter*/) +{ + return { { Image(StockImage::Yes, BMP_BAR_OF_PIE), SchResId(STR_BAR_OF_PIE) }, + { Image(StockImage::Yes, BMP_PIE_OF_PIE), SchResId(STR_PIE_OF_PIE) } }; } bool OfPieChartDialogController::shouldShow_3DLookControl() const @@ -861,9 +868,11 @@ const tTemplateServiceChartTypeParameterMap& LineChartDialogController::getTempl {"com.sun.star.chart2.template.ThreeDLineDeep" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z,false,true)}}; return s_aTemplateMap; } -void LineChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter ) + +std::vector +LineChartDialogController::getSubTypes(const ChartTypeParameter& rParameter) { - rSubTypeList.Clear(); + std::vector aEntries; switch( rParameter.eCurveStyle ) { @@ -871,17 +880,17 @@ void LineChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const C case CurveStyle_B_SPLINES: if( rParameter.eStackMode == GlobalStackMode_NONE || rParameter.eStackMode == GlobalStackMode_STACK_Z ) { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_POINTS_XCATEGORY)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_LINE_P_XCATEGORY_SMOOTH)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_LINE_O_XCATEGORY_SMOOTH)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_LINE3D_XCATEGORY_SMOOTH)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_POINTS_XCATEGORY)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_P_XCATEGORY_SMOOTH)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_O_XCATEGORY_SMOOTH)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE3D_XCATEGORY_SMOOTH)); } else { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_POINTS_STACKED)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_LINE_P_STACKED_SMOOTH)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_LINE_O_STACKED_SMOOTH)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_LINE3D_STACKED_SMOOTH)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_POINTS_STACKED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_P_STACKED_SMOOTH)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_O_STACKED_SMOOTH)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE3D_STACKED_SMOOTH)); } break; case CurveStyle_STEP_START: @@ -890,42 +899,45 @@ void LineChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const C case CurveStyle_STEP_CENTER_Y: if( rParameter.eStackMode == GlobalStackMode_NONE || rParameter.eStackMode == GlobalStackMode_STACK_Z ) { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_POINTS_XCATEGORY)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_LINE_P_XCATEGORY_STEPPED)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_LINE_O_XCATEGORY_STEPPED)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_LINE3D_XCATEGORY_STEPPED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_POINTS_XCATEGORY)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_P_XCATEGORY_STEPPED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_O_XCATEGORY_STEPPED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE3D_XCATEGORY_STEPPED)); } else { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_POINTS_STACKED)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_LINE_P_STACKED_STEPPED)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_LINE_O_STACKED_STEPPED)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_LINE3D_STACKED_STEPPED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_POINTS_STACKED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_P_STACKED_STEPPED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_O_STACKED_STEPPED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE3D_STACKED_STEPPED)); } break; default: // includes CurveStyle_LINES //direct lines if( rParameter.eStackMode == GlobalStackMode_NONE || rParameter.eStackMode == GlobalStackMode_STACK_Z ) { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_POINTS_XCATEGORY)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_LINE_P_XCATEGORY)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_LINE_O_XCATEGORY)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_LINE3D_XCATEGORY)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_POINTS_XCATEGORY)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_P_XCATEGORY)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_O_XCATEGORY)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE3D_XCATEGORY)); } else { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_POINTS_STACKED)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_LINE_P_STACKED)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_LINE_O_STACKED)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_LINE3D_STACKED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_POINTS_STACKED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_P_STACKED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_O_STACKED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE3D_STACKED)); } } - rSubTypeList.SetItemText( 1, SchResId( STR_POINTS_ONLY ) ); - rSubTypeList.SetItemText( 2, SchResId( STR_POINTS_AND_LINES ) ); - rSubTypeList.SetItemText( 3, SchResId( STR_LINES_ONLY ) ); - rSubTypeList.SetItemText( 4, SchResId( STR_LINES_3D ) ); + aEntries.at(0).sName = SchResId(STR_POINTS_ONLY); + aEntries.at(1).sName = SchResId(STR_POINTS_AND_LINES); + aEntries.at(2).sName = SchResId(STR_LINES_ONLY); + aEntries.at(3).sName = SchResId(STR_LINES_3D); + + return aEntries; } + bool LineChartDialogController::shouldShow_StackingControl() const { return true; @@ -1001,19 +1013,20 @@ const tTemplateServiceChartTypeParameterMap& XYChartDialogController::getTemplat return s_aTemplateMap; } -void XYChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter ) +std::vector +XYChartDialogController::getSubTypes(const ChartTypeParameter& rParameter) { - rSubTypeList.Clear(); + std::vector aEntries; switch (rParameter.eCurveStyle) { case CurveStyle_CUBIC_SPLINES: case CurveStyle_B_SPLINES: { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_POINTS_XVALUES)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_LINE_P_XVALUES_SMOOTH)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_LINE_O_XVALUES_SMOOTH)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_LINE3D_XVALUES_SMOOTH)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_POINTS_XVALUES)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_P_XVALUES_SMOOTH)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_O_XVALUES_SMOOTH)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE3D_XVALUES_SMOOTH)); break; } case CurveStyle_STEP_START: @@ -1021,24 +1034,27 @@ void XYChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const Cha case CurveStyle_STEP_CENTER_X: case CurveStyle_STEP_CENTER_Y: { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_POINTS_XVALUES)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_LINE_P_XVALUES_STEPPED)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_LINE_O_XVALUES_STEPPED)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_LINE3D_XVALUES_STEPPED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_POINTS_XVALUES)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_P_XVALUES_STEPPED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_O_XVALUES_STEPPED)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE3D_XVALUES_STEPPED)); break; } default: // includes CurveStyle_LINES - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_POINTS_XVALUES)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_LINE_P_XVALUES)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_LINE_O_XVALUES)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_LINE3D_XVALUES)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_POINTS_XVALUES)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_P_XVALUES)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE_O_XVALUES)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_LINE3D_XVALUES)); } - rSubTypeList.SetItemText( 1, SchResId( STR_POINTS_ONLY ) ); - rSubTypeList.SetItemText( 2, SchResId( STR_POINTS_AND_LINES ) ); - rSubTypeList.SetItemText( 3, SchResId( STR_LINES_ONLY ) ); - rSubTypeList.SetItemText( 4, SchResId( STR_LINES_3D ) ); + aEntries.at(0).sName = SchResId(STR_POINTS_ONLY); + aEntries.at(1).sName = SchResId(STR_POINTS_AND_LINES); + aEntries.at(2).sName = SchResId(STR_LINES_ONLY); + aEntries.at(3).sName = SchResId(STR_LINES_3D); + + return aEntries; } + bool XYChartDialogController::shouldShow_SplineControl() const { return true; @@ -1111,27 +1127,31 @@ const tTemplateServiceChartTypeParameterMap& AreaChartDialogController::getTempl return s_aTemplateMap; } -void AreaChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter ) +std::vector +AreaChartDialogController::getSubTypes(const ChartTypeParameter& rParameter) { - rSubTypeList.Clear(); + std::vector aEntries; if( rParameter.b3DLook ) { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_AREAS_3D)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_AREAS_3D_1)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_AREAS_3D_2)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_AREAS_3D)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_AREAS_3D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_AREAS_3D_2)); } else { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_AREAS_2D_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_AREAS_2D)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_AREAS_2D_3)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_AREAS_2D_1)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_AREAS_2D)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_AREAS_2D_3)); } - rSubTypeList.SetItemText( 1, SchResId( rParameter.b3DLook ? STR_DEEP : STR_NORMAL ) ); - rSubTypeList.SetItemText( 2, SchResId( STR_STACKED ) ); - rSubTypeList.SetItemText( 3, SchResId( STR_PERCENT ) ); + aEntries.at(0).sName = SchResId(rParameter.b3DLook ? STR_DEEP : STR_NORMAL); + aEntries.at(1).sName = SchResId(STR_STACKED); + aEntries.at(2).sName = SchResId(STR_PERCENT); + + return aEntries; } + void AreaChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter ) { rParameter.eCurveStyle = CurveStyle_LINES; @@ -1207,30 +1227,35 @@ const tTemplateServiceChartTypeParameterMap& NetChartDialogController::getTempla {"com.sun.star.chart2.template.PercentStackedFilledNet" ,ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y_PERCENT,false,false)}}; return s_aTemplateMap; } -void NetChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter ) + +std::vector +NetChartDialogController::getSubTypes(const ChartTypeParameter& rParameter) { - rSubTypeList.Clear(); + std::vector aEntries; if( rParameter.eStackMode == GlobalStackMode_NONE ) { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_NET_SYMB)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_NET_LINESYMB)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_NET)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_NET_FILL)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_NET_SYMB)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_NET_LINESYMB)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_NET)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_NET_FILL)); } else { - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_NET_SYMB_STACK)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_NET_LINESYMB_STACK)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_NET_STACK)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_NET_FILL_STACK)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_NET_SYMB_STACK)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_NET_LINESYMB_STACK)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_NET_STACK)); + aEntries.emplace_back(Image(StockImage::Yes, BMP_NET_FILL_STACK)); } - rSubTypeList.SetItemText( 1, SchResId( STR_POINTS_ONLY ) ); - rSubTypeList.SetItemText( 2, SchResId( STR_POINTS_AND_LINES ) ); - rSubTypeList.SetItemText( 3, SchResId( STR_LINES_ONLY ) ); - rSubTypeList.SetItemText( 4, SchResId( STR_FILLED ) ); + aEntries.at(0).sName = SchResId(STR_POINTS_ONLY); + aEntries.at(1).sName = SchResId(STR_POINTS_AND_LINES); + aEntries.at(2).sName = SchResId(STR_LINES_ONLY); + aEntries.at(3).sName = SchResId(STR_FILLED); + + return aEntries; } + void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter ) { rParameter.b3DLook = false; @@ -1286,18 +1311,13 @@ const tTemplateServiceChartTypeParameterMap& StockChartDialogController::getTemp return s_aTemplateMap; } -void StockChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ ) +std::vector +StockChartDialogController::getSubTypes(const ChartTypeParameter& /*rParameter*/) { - rSubTypeList.Clear(); - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_STOCK_1)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_STOCK_2)); - rSubTypeList.InsertItem(3, Image(StockImage::Yes, BMP_STOCK_3)); - rSubTypeList.InsertItem(4, Image(StockImage::Yes, BMP_STOCK_4)); - - rSubTypeList.SetItemText( 1, SchResId(STR_STOCK_1) ); - rSubTypeList.SetItemText( 2, SchResId(STR_STOCK_2) ); - rSubTypeList.SetItemText( 3, SchResId(STR_STOCK_3) ); - rSubTypeList.SetItemText( 4, SchResId(STR_STOCK_4) ); + return { { Image(StockImage::Yes, BMP_STOCK_1), SchResId(STR_STOCK_1) }, + { Image(StockImage::Yes, BMP_STOCK_2), SchResId(STR_STOCK_2) }, + { Image(StockImage::Yes, BMP_STOCK_3), SchResId(STR_STOCK_3) }, + { Image(StockImage::Yes, BMP_STOCK_4), SchResId(STR_STOCK_4) } }; } void StockChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter ) @@ -1329,14 +1349,12 @@ const tTemplateServiceChartTypeParameterMap& CombiColumnLineChartDialogControlle return s_aTemplateMap; } -void CombiColumnLineChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ ) +std::vector +CombiColumnLineChartDialogController::getSubTypes(const ChartTypeParameter& /*rParameter*/) { - rSubTypeList.Clear(); - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_COLUMN_LINE)); - rSubTypeList.InsertItem(2, Image(StockImage::Yes, BMP_COLUMN_LINE_STACKED)); - - rSubTypeList.SetItemText(1, SchResId(STR_LINE_COLUMN)); - rSubTypeList.SetItemText(2, SchResId(STR_LINE_STACKEDCOLUMN)); + return { { Image(StockImage::Yes, BMP_COLUMN_LINE), SchResId(STR_LINE_COLUMN) }, + { Image(StockImage::Yes, BMP_COLUMN_LINE_STACKED), + SchResId(STR_LINE_STACKEDCOLUMN) } }; } void CombiColumnLineChartDialogController::showExtraControls(weld::Builder* pBuilder) @@ -1462,12 +1480,10 @@ const tTemplateServiceChartTypeParameterMap& return s_aTemplateMap; } -void CorrelationCircleChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ ) +std::vector +CorrelationCircleChartDialogController::getSubTypes(const ChartTypeParameter& /*rParameter*/) { - rSubTypeList.Clear(); - - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_CORRELATION_CIRCLE)); - rSubTypeList.SetItemText(1, SchResId(STR_CORRELATION_CIRCLE)); + return { { Image(StockImage::Yes, BMP_CORRELATION_CIRCLE), SchResId(STR_CORRELATION_CIRCLE) } }; } void CorrelationCircleChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter ) @@ -1505,12 +1521,10 @@ const tTemplateServiceChartTypeParameterMap& BubbleChartDialogController::getTem {"com.sun.star.chart2.template.Bubble" , ChartTypeParameter(1,true)}}; return s_aTemplateMap; } -void BubbleChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ ) +std::vector +BubbleChartDialogController::getSubTypes(const ChartTypeParameter& /*rParameter*/) { - rSubTypeList.Clear(); - rSubTypeList.InsertItem(1, Image(StockImage::Yes, BMP_BUBBLE_1)); - - rSubTypeList.SetItemText( 1, SchResId(STR_BUBBLE_1) ); + return { { Image(StockImage::Yes, BMP_BUBBLE_1), SchResId(STR_BUBBLE_1) } }; } void BubbleChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter ) { diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx index 17229e5b0f36..6f045bb15eb1 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.cxx +++ b/chart2/source/controller/dialogs/tp_ChartType.cxx @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -56,12 +57,8 @@ ChartTypeTabPage::ChartTypeTabPage(weld::Container* pPage, weld::DialogControlle , m_aTimerTriggeredControllerLock( m_xChartModel ) , m_xFT_ChooseType(m_xBuilder->weld_label(u"FT_CAPTION_FOR_WIZARD"_ustr)) , m_xMainTypeList(m_xBuilder->weld_tree_view(u"charttype"_ustr)) - , m_xSubTypeList(new ValueSet(m_xBuilder->weld_scrolled_window(u"subtypewin"_ustr, true))) - , m_xSubTypeListWin(new weld::CustomWeld(*m_xBuilder, u"subtype"_ustr, *m_xSubTypeList)) + , m_xSubTypeList(m_xBuilder->weld_icon_view(u"subtype"_ustr)) { - Size aSize(m_xSubTypeList->GetDrawingArea()->get_ref_device().LogicToPixel(Size(150, 50), MapMode(MapUnit::MapAppFont))); - m_xSubTypeListWin->set_size_request(aSize.Width(), aSize.Height()); - if (bShowDescription) { m_xFT_ChooseType->show(); @@ -74,16 +71,7 @@ ChartTypeTabPage::ChartTypeTabPage(weld::Container* pPage, weld::DialogControlle SetPageTitle(SchResId(STR_PAGE_CHARTTYPE)); m_xMainTypeList->connect_selection_changed(LINK(this, ChartTypeTabPage, SelectMainTypeHdl)); - m_xSubTypeList->SetSelectHdl( LINK( this, ChartTypeTabPage, SelectSubTypeHdl ) ); - - m_xSubTypeList->SetStyle(m_xSubTypeList->GetStyle() | - WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD | WB_FLATVALUESET | WB_3DLOOK ); - // Set number of columns in chart type selector. - // TODO: Ideally this would not be hard-coded, but determined - // programmatically based on the maximum number of chart types across all - // controllers. - m_xSubTypeList->SetColCount(4); - m_xSubTypeList->SetLineCount(1); + m_xSubTypeList->connect_item_activated(LINK(this, ChartTypeTabPage, ActivateSubTypeHdl)); bool bEnableComplexChartTypes = true; uno::Reference< beans::XPropertySet > xProps( static_cast(m_xChartModel.get()), uno::UNO_QUERY ); @@ -149,14 +137,12 @@ ChartTypeTabPage::~ChartTypeTabPage() m_pSplineResourceGroup.reset(); m_pGeometryResourceGroup.reset(); m_pSortByXValuesResourceGroup.reset(); - m_xSubTypeListWin.reset(); - m_xSubTypeList.reset(); } -ChartTypeParameter ChartTypeTabPage::getCurrentParamter() const +ChartTypeParameter ChartTypeTabPage::getCurrentParameter() const { ChartTypeParameter aParameter; - aParameter.nSubTypeIndex = static_cast(m_xSubTypeList->GetSelectedItemId()); + aParameter.nSubTypeIndex = static_cast(m_xSubTypeList->get_selected_index() + 1); m_pDim3DLookResourceGroup->fillParameter( aParameter ); m_pStackingResourceGroup->fillParameter( aParameter ); m_pSplineResourceGroup->fillParameter( aParameter ); @@ -181,7 +167,7 @@ void ChartTypeTabPage::stateChanged() return; m_nChangingCalls++; - ChartTypeParameter aParameter( getCurrentParamter() ); + ChartTypeParameter aParameter(getCurrentParameter()); if( m_pCurrentMainType ) { m_pCurrentMainType->adjustParameterToSubType( aParameter ); @@ -224,22 +210,24 @@ ChartTypeDialogController* ChartTypeTabPage::getSelectedMainType() return pTypeController; } -IMPL_LINK_NOARG(ChartTypeTabPage, SelectSubTypeHdl, ValueSet*, void) +IMPL_LINK_NOARG(ChartTypeTabPage, ActivateSubTypeHdl, const weld::TreeIter&, bool) { if( m_pCurrentMainType ) { - ChartTypeParameter aParameter( getCurrentParamter() ); + ChartTypeParameter aParameter(getCurrentParameter()); m_pCurrentMainType->adjustParameterToSubType( aParameter ); fillAllControls( aParameter, false ); commitToModel( aParameter ); } + + return true; } IMPL_LINK_NOARG(ChartTypeTabPage, SelectMainTypeHdl, weld::ItemView&, void) { selectMainType(); } void ChartTypeTabPage::selectMainType() { - ChartTypeParameter aParameter( getCurrentParamter() ); + ChartTypeParameter aParameter(getCurrentParameter()); if( m_pCurrentMainType ) { @@ -282,7 +270,7 @@ void ChartTypeTabPage::selectMainType() void ChartTypeTabPage::showAllControls( ChartTypeDialogController& rTypeController ) { m_xMainTypeList->show(); - m_xSubTypeList->Show(); + m_xSubTypeList->show(); bool bShow = rTypeController.shouldShow_3DLookControl(); m_pDim3DLookResourceGroup->showControls( bShow ); @@ -302,9 +290,19 @@ void ChartTypeTabPage::fillAllControls( const ChartTypeParameter& rParameter, bo m_nChangingCalls++; if( m_pCurrentMainType && bAlsoResetSubTypeList ) { - m_pCurrentMainType->fillSubTypeList(*m_xSubTypeList, rParameter); + m_xSubTypeList->clear(); + const std::vector aEntries = m_pCurrentMainType->getSubTypes(rParameter); + int nIndex = 0; + for (const ChartTypeEntry& rEntry : aEntries) + { + const Bitmap aBitmap = rEntry.aImage.GetBitmap(); + m_xSubTypeList->insert(nIndex, nullptr, nullptr, &aBitmap, nullptr); + m_xSubTypeList->set_item_tooltip_text(nIndex, rEntry.sName); + m_xSubTypeList->set_item_accessible_name(nIndex, rEntry.sName); + nIndex++; + } } - m_xSubTypeList->SelectItem( static_cast( rParameter.nSubTypeIndex) ); + m_xSubTypeList->select(rParameter.nSubTypeIndex - 1); m_pDim3DLookResourceGroup->fillControls( rParameter ); m_pStackingResourceGroup->fillControls( rParameter ); m_pSplineResourceGroup->fillControls( rParameter ); @@ -365,7 +363,7 @@ void ChartTypeTabPage::initializePage() if( !bFound ) { m_xMainTypeList->show(); - m_xSubTypeList->Show(); + m_xSubTypeList->show(); m_pDim3DLookResourceGroup->showControls( false ); m_pStackingResourceGroup->showControls( false ); m_pSplineResourceGroup->showControls( false ); @@ -383,7 +381,7 @@ rtl::Reference< ChartTypeTemplate > ChartTypeTabPage::getCurrentTemplate() const { if( m_pCurrentMainType && m_xChartModel.is() ) { - ChartTypeParameter aParameter( getCurrentParamter() ); + ChartTypeParameter aParameter(getCurrentParameter()); m_pCurrentMainType->adjustParameterToSubType( aParameter ); rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = m_xChartModel->getTypeManager(); return m_pCurrentMainType->getCurrentTemplate( aParameter, xChartTypeManager ); diff --git a/chart2/source/controller/dialogs/tp_ChartType.hxx b/chart2/source/controller/dialogs/tp_ChartType.hxx index 37d38bfd592c..8a6e95b6b203 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.hxx +++ b/chart2/source/controller/dialogs/tp_ChartType.hxx @@ -30,11 +30,11 @@ namespace weld { class CustomWeld; +class IconView; class ItemView; +class TreeIter; } -class ValueSet; - namespace chart { @@ -61,7 +61,7 @@ private: ChartTypeDialogController* getSelectedMainType(); void showAllControls( ChartTypeDialogController& rTypeController ); void fillAllControls( const ChartTypeParameter& rParameter, bool bAlsoResetSubTypeList=true ); - ChartTypeParameter getCurrentParamter() const; + ChartTypeParameter getCurrentParameter() const; virtual void stateChanged() override; @@ -69,7 +69,7 @@ private: void selectMainType(); DECL_LINK(SelectMainTypeHdl, weld::ItemView&, void); - DECL_LINK(SelectSubTypeHdl, ValueSet*, void ); + DECL_LINK(ActivateSubTypeHdl, const weld::TreeIter&, bool); std::unique_ptr m_pDim3DLookResourceGroup; std::unique_ptr m_pStackingResourceGroup; @@ -88,8 +88,7 @@ private: std::unique_ptr m_xFT_ChooseType; std::unique_ptr m_xMainTypeList; - std::unique_ptr m_xSubTypeList; - std::unique_ptr m_xSubTypeListWin; + std::unique_ptr m_xSubTypeList; }; } //namespace chart diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx index 0eb7d16421ff..eb3f1cc9ddc0 100644 --- a/chart2/source/controller/sidebar/ChartTypePanel.cxx +++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include @@ -54,20 +54,10 @@ ChartTypePanel::ChartTypePanel(weld::Widget* pParent, ::chart::ChartController* , m_nChangingCalls(0) , m_aTimerTriggeredControllerLock(m_xChartModel) , m_xMainTypeList(m_xBuilder->weld_combo_box(u"cmb_chartType"_ustr)) - , m_xSubTypeList(new ValueSet(m_xBuilder->weld_scrolled_window(u"subtypewin"_ustr, true))) - , m_xSubTypeListWin(new weld::CustomWeld(*m_xBuilder, u"subtype"_ustr, *m_xSubTypeList)) + , m_xSubTypeList(m_xBuilder->weld_icon_view(u"subtype"_ustr)) { - Size aSize(m_xSubTypeList->GetDrawingArea()->get_ref_device().LogicToPixel( - Size(120, 40), MapMode(MapUnit::MapAppFont))); - m_xSubTypeListWin->set_size_request(aSize.Width(), aSize.Height()); - m_xMainTypeList->connect_changed(LINK(this, ChartTypePanel, SelectMainTypeHdl)); - m_xSubTypeList->SetSelectHdl(LINK(this, ChartTypePanel, SelectSubTypeHdl)); - - m_xSubTypeList->SetStyle(m_xSubTypeList->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER - | WB_NAMEFIELD | WB_FLATVALUESET | WB_3DLOOK); - m_xSubTypeList->SetColCount(4); - m_xSubTypeList->SetLineCount(1); + m_xSubTypeList->connect_item_activated(LINK(this, ChartTypePanel, ActivateSubTypeHdl)); bool bEnableComplexChartTypes = true; uno::Reference xProps(static_cast(m_xChartModel.get()), @@ -131,17 +121,12 @@ ChartTypePanel::~ChartTypePanel() m_pSplineResourceGroup.reset(); m_pGeometryResourceGroup.reset(); m_pSortByXValuesResourceGroup.reset(); - m_xSubTypeListWin.reset(); - m_xSubTypeList.reset(); - - m_xSubTypeListWin.reset(); - m_xSubTypeList.reset(); m_xMainTypeList.reset(); } IMPL_LINK_NOARG(ChartTypePanel, SelectMainTypeHdl, weld::ComboBox&, void) { selectMainType(); } -IMPL_LINK_NOARG(ChartTypePanel, SelectSubTypeHdl, ValueSet*, void) +IMPL_LINK_NOARG(ChartTypePanel, ActivateSubTypeHdl, const weld::TreeIter&, bool) { if (m_pCurrentMainType) { @@ -150,6 +135,8 @@ IMPL_LINK_NOARG(ChartTypePanel, SelectSubTypeHdl, ValueSet*, void) fillAllControls(aParameter, false); commitToModel(aParameter); } + + return true; } void ChartTypePanel::Initialize() @@ -207,7 +194,7 @@ void ChartTypePanel::Initialize() if (!bFound) { - m_xSubTypeList->Hide(); + m_xSubTypeList->hide(); m_pDim3DLookResourceGroup->showControls(false); m_pStackingResourceGroup->showControls(false); m_pSplineResourceGroup->showControls(false); @@ -310,7 +297,7 @@ ChartTypeDialogController* ChartTypePanel::getSelectedMainType() void ChartTypePanel::showAllControls(ChartTypeDialogController& rTypeController) { m_xMainTypeList->show(); - m_xSubTypeList->Show(); + m_xSubTypeList->show(); bool bShow = rTypeController.shouldShow_3DLookControl(); m_pDim3DLookResourceGroup->showControls(bShow); @@ -331,9 +318,19 @@ void ChartTypePanel::fillAllControls(const ChartTypeParameter& rParameter, m_nChangingCalls++; if (m_pCurrentMainType && bAlsoResetSubTypeList) { - m_pCurrentMainType->fillSubTypeList(*m_xSubTypeList, rParameter); + m_xSubTypeList->clear(); + const std::vector aEntries = m_pCurrentMainType->getSubTypes(rParameter); + int nIndex = 0; + for (const ChartTypeEntry& rEntry : aEntries) + { + const Bitmap aBitmap = rEntry.aImage.GetBitmap(); + m_xSubTypeList->insert(nIndex, nullptr, nullptr, &aBitmap, nullptr); + m_xSubTypeList->set_item_tooltip_text(nIndex, rEntry.sName); + m_xSubTypeList->set_item_accessible_name(nIndex, rEntry.sName); + nIndex++; + } } - m_xSubTypeList->SelectItem(static_cast(rParameter.nSubTypeIndex)); + m_xSubTypeList->select(rParameter.nSubTypeIndex - 1); m_pDim3DLookResourceGroup->fillControls(rParameter); m_pStackingResourceGroup->fillControls(rParameter); m_pSplineResourceGroup->fillControls(rParameter); @@ -345,7 +342,7 @@ void ChartTypePanel::fillAllControls(const ChartTypeParameter& rParameter, ChartTypeParameter ChartTypePanel::getCurrentParameter() const { ChartTypeParameter aParameter; - aParameter.nSubTypeIndex = static_cast(m_xSubTypeList->GetSelectedItemId()); + aParameter.nSubTypeIndex = static_cast(m_xSubTypeList->get_selected_index() + 1); m_pDim3DLookResourceGroup->fillParameter(aParameter); m_pStackingResourceGroup->fillParameter(aParameter); m_pSplineResourceGroup->fillParameter(aParameter); diff --git a/chart2/source/controller/sidebar/ChartTypePanel.hxx b/chart2/source/controller/sidebar/ChartTypePanel.hxx index 8df0020431db..49e4893345c5 100644 --- a/chart2/source/controller/sidebar/ChartTypePanel.hxx +++ b/chart2/source/controller/sidebar/ChartTypePanel.hxx @@ -35,6 +35,8 @@ class XModifyListener; namespace weld { class CustomWeld; +class IconView; +class TreeIter; } namespace chart @@ -85,7 +87,7 @@ private: void selectMainType(); DECL_LINK(SelectMainTypeHdl, weld::ComboBox&, void); - DECL_LINK(SelectSubTypeHdl, ValueSet*, void); + DECL_LINK(ActivateSubTypeHdl, const weld::TreeIter&, bool); vcl::EnumContext maContext; @@ -112,8 +114,7 @@ private: TimerTriggeredControllerLock m_aTimerTriggeredControllerLock; std::unique_ptr m_xMainTypeList; - std::unique_ptr m_xSubTypeList; - std::unique_ptr m_xSubTypeListWin; + std::unique_ptr m_xSubTypeList; }; } } // end of namespace ::chart::sidebar diff --git a/chart2/source/inc/ChartTypeDialogController.hxx b/chart2/source/inc/ChartTypeDialogController.hxx index 8343ac9b81b6..5ec85d59ebbd 100644 --- a/chart2/source/inc/ChartTypeDialogController.hxx +++ b/chart2/source/inc/ChartTypeDialogController.hxx @@ -27,6 +27,7 @@ #include "ThreeDHelper.hxx" #include +#include #include #include #include @@ -36,8 +37,6 @@ namespace com::sun::star::beans class XPropertySet; } -class ValueSet; - namespace chart { class ChartModel; @@ -88,6 +87,18 @@ public: typedef std::map tTemplateServiceChartTypeParameterMap; +struct ChartTypeEntry +{ + Image aImage; + OUString sName; + + ChartTypeEntry(const Image& rImage, const OUString& rName = u""_ustr) + : aImage(rImage) + , sName(rName) + { + } +}; + class ChartTypeDialogController : public ChangingResource { public: @@ -97,7 +108,7 @@ public: virtual OUString getName() = 0; virtual OUString getImage() = 0; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const = 0; - virtual void fillSubTypeList(ValueSet& rSubTypeList, const ChartTypeParameter& rParameter); + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter); virtual bool shouldShow_3DLookControl() const; virtual bool shouldShow_StackingControl() const; @@ -158,8 +169,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; }; class BarChartDialogController final : public ColumnOrBarChartDialogController_Base @@ -171,8 +181,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; }; class HistogramChartDialogController final : public ChartTypeDialogController @@ -184,8 +193,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; }; @@ -198,8 +206,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; virtual bool shouldShow_3DLookControl() const override; @@ -214,8 +221,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; virtual bool shouldShow_3DLookControl() const override; @@ -246,8 +252,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; virtual void adjustParameterToMainType(ChartTypeParameter& rParameter) override; @@ -264,8 +269,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; virtual bool shouldShow_SplineControl() const override; @@ -281,8 +285,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; virtual void adjustParameterToMainType(ChartTypeParameter& rParameter) override; @@ -298,8 +301,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; virtual bool shouldShow_StackingControl() const override; @@ -314,8 +316,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; }; @@ -327,8 +328,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; virtual void showExtraControls(weld::Builder* pBuilder) override; @@ -357,8 +357,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; }; @@ -371,8 +370,7 @@ public: virtual OUString getName() override; virtual OUString getImage() override; virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; - virtual void fillSubTypeList(ValueSet& rSubTypeList, - const ChartTypeParameter& rParameter) override; + virtual std::vector getSubTypes(const ChartTypeParameter& rParameter) override; virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; }; diff --git a/chart2/source/inc/CorrelationCoefficient.hxx b/chart2/source/inc/CorrelationCoefficient.hxx index dd50d1a25bf9..e1ad7bb2e654 100644 --- a/chart2/source/inc/CorrelationCoefficient.hxx +++ b/chart2/source/inc/CorrelationCoefficient.hxx @@ -1,13 +1,12 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + #pragma once #include diff --git a/chart2/source/model/template/CorrelationCircleChartType.cxx b/chart2/source/model/template/CorrelationCircleChartType.cxx index ab6bbff5ea1c..6868148c0a74 100644 --- a/chart2/source/model/template/CorrelationCircleChartType.cxx +++ b/chart2/source/model/template/CorrelationCircleChartType.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/chart2/source/model/template/CorrelationCircleChartType.hxx b/chart2/source/model/template/CorrelationCircleChartType.hxx index 74b0e87906e0..bf434268fc6b 100644 --- a/chart2/source/model/template/CorrelationCircleChartType.hxx +++ b/chart2/source/model/template/CorrelationCircleChartType.hxx @@ -1,13 +1,12 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + #pragma once #include diff --git a/chart2/source/model/template/CorrelationCircleChartTypeTemplate.cxx b/chart2/source/model/template/CorrelationCircleChartTypeTemplate.cxx index 7f0bb60ce9a3..f63ab5f82a29 100644 --- a/chart2/source/model/template/CorrelationCircleChartTypeTemplate.cxx +++ b/chart2/source/model/template/CorrelationCircleChartTypeTemplate.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/chart2/source/model/template/CorrelationCircleChartTypeTemplate.hxx b/chart2/source/model/template/CorrelationCircleChartTypeTemplate.hxx index 2d4d02412073..7906d52fc9c4 100644 --- a/chart2/source/model/template/CorrelationCircleChartTypeTemplate.hxx +++ b/chart2/source/model/template/CorrelationCircleChartTypeTemplate.hxx @@ -1,13 +1,12 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + #pragma once #include diff --git a/chart2/source/model/template/CorrelationCircleDataInterpreter.cxx b/chart2/source/model/template/CorrelationCircleDataInterpreter.cxx index 18c0192c7ae8..58496604efce 100644 --- a/chart2/source/model/template/CorrelationCircleDataInterpreter.cxx +++ b/chart2/source/model/template/CorrelationCircleDataInterpreter.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/chart2/source/model/template/CorrelationCircleDataInterpreter.hxx b/chart2/source/model/template/CorrelationCircleDataInterpreter.hxx index 778beb08e8d3..e7f2c45efc68 100644 --- a/chart2/source/model/template/CorrelationCircleDataInterpreter.hxx +++ b/chart2/source/model/template/CorrelationCircleDataInterpreter.hxx @@ -1,13 +1,12 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + #pragma once #include diff --git a/chart2/source/view/charttypes/CorrelationCircleChart.cxx b/chart2/source/view/charttypes/CorrelationCircleChart.cxx index 621a2ef24056..06918877be82 100644 --- a/chart2/source/view/charttypes/CorrelationCircleChart.cxx +++ b/chart2/source/view/charttypes/CorrelationCircleChart.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/chart2/source/view/charttypes/CorrelationCircleChart.hxx b/chart2/source/view/charttypes/CorrelationCircleChart.hxx index 6852fc0fbd9f..7c5c57a7080c 100644 --- a/chart2/source/view/charttypes/CorrelationCircleChart.hxx +++ b/chart2/source/view/charttypes/CorrelationCircleChart.hxx @@ -1,13 +1,12 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + #pragma once #include diff --git a/chart2/uiconfig/ui/sidebaraxis.ui b/chart2/uiconfig/ui/sidebaraxis.ui index ec67b5534ad2..3b7f5faa0923 100644 --- a/chart2/uiconfig/ui/sidebaraxis.ui +++ b/chart2/uiconfig/ui/sidebaraxis.ui @@ -159,7 +159,6 @@ 6 6 12 - _Automatic @@ -167,13 +166,13 @@ True True True + True 0 0 - Bin _width @@ -188,7 +187,6 @@ 1 - True @@ -196,6 +194,7 @@ 10 adjustmentHISTOGRAM_BIN_WIDTH 2 + True Bin width @@ -208,7 +207,6 @@ 1 - _Number of bins @@ -223,7 +221,6 @@ 2 - True @@ -231,6 +228,7 @@ 10 adjustmentHISTOGRAM_BIN_COUNT True + True Number of bins @@ -243,7 +241,6 @@ 2 - _Overflow bin @@ -257,7 +254,6 @@ 3 - True @@ -265,6 +261,7 @@ 10 adjustmentHISTOGRAM_OVERFLOW 2 + True Overflow bin value @@ -277,7 +274,6 @@ 3 - _Underflow bin @@ -291,7 +287,6 @@ 4 - True @@ -299,6 +294,7 @@ 10 adjustmentHISTOGRAM_UNDERFLOW 2 + True Underflow bin value @@ -313,7 +309,6 @@ - True diff --git a/chart2/uiconfig/ui/sidebartype.ui b/chart2/uiconfig/ui/sidebartype.ui index 1576b88922c9..f443eb957346 100644 --- a/chart2/uiconfig/ui/sidebartype.ui +++ b/chart2/uiconfig/ui/sidebartype.ui @@ -1,5 +1,5 @@ - + @@ -32,6 +32,16 @@ + + + + + + + + + + True @@ -45,36 +55,6 @@ 6 3 6 - - - True - True - 6 - True - never - never - in - - - True - False - - - True - False - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - True - - - - - - - 0 - 1 - 2 - - _3D Look @@ -370,6 +350,23 @@ 4 + + + True + True + 6 + subtype_model + 4 + 0 + 2 + True + + + 0 + 1 + 2 + + diff --git a/chart2/uiconfig/ui/tp_ChartType.ui b/chart2/uiconfig/ui/tp_ChartType.ui index dc1036d90702..022c62a86d05 100644 --- a/chart2/uiconfig/ui/tp_ChartType.ui +++ b/chart2/uiconfig/ui/tp_ChartType.ui @@ -34,6 +34,16 @@ + + + + + + + + + + True False @@ -72,6 +82,58 @@ True True 12 + + + False + True + never + in + + + True + True + True + liststore2 + False + False + 0 + False + + + + + + + + + 0 + + + + + + + + + + 1 + + + + + + + Select a basic chart type. + + + + + + + 0 + 0 + + @@ -81,30 +143,16 @@ True 6 - + + subtype + True True - True - never - never - in - - - True - True - - - True - GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK - True - - - Select a sub type of the basic chart type. - - - - - - + 6 + subtype_model + 4 + 0 + 2 + True 0 @@ -507,58 +555,6 @@ 0 - - - False - True - never - in - - - True - True - True - liststore2 - False - False - 0 - False - - - - - - - - - 0 - - - - - - - - - - 1 - - - - - - - Select a basic chart type. - - - - - - - 0 - 0 - - False diff --git a/chart2/uiconfig/ui/tp_Scale.ui b/chart2/uiconfig/ui/tp_Scale.ui index 5c6e8366d86a..bdbfa8cd17d4 100644 --- a/chart2/uiconfig/ui/tp_Scale.ui +++ b/chart2/uiconfig/ui/tp_Scale.ui @@ -582,7 +582,6 @@ 6 6 12 - Auto_matic @@ -590,13 +589,13 @@ True True True + True 0 0 - Bin _width @@ -611,7 +610,6 @@ 1 - True @@ -619,6 +617,7 @@ 10 adjustmentHISTOGRAM_BIN_WIDTH 2 + True Bin width @@ -631,7 +630,6 @@ 1 - _Number of bins @@ -646,7 +644,6 @@ 2 - True @@ -654,6 +651,7 @@ 10 adjustmentHISTOGRAM_BIN_COUNT True + True Number of bins @@ -666,7 +664,6 @@ 2 - _Overflow bin @@ -680,7 +677,6 @@ 3 - True @@ -688,6 +684,7 @@ 10 adjustmentHISTOGRAM_OVERFLOW 2 + True Overflow bin value @@ -700,7 +697,6 @@ 3 - _Underflow bin @@ -714,7 +710,6 @@ 4 - True @@ -722,6 +717,7 @@ 10 adjustmentHISTOGRAM_UNDERFLOW 2 + True Underflow bin value @@ -736,7 +732,6 @@ - True diff --git a/codemaker/Module_codemaker.mk b/codemaker/Module_codemaker.mk index 33df554c3d48..17f60623c959 100644 --- a/codemaker/Module_codemaker.mk +++ b/codemaker/Module_codemaker.mk @@ -24,7 +24,7 @@ $(eval $(call gb_Module_add_targets,codemaker,\ endif $(eval $(call gb_Module_add_check_targets,codemaker,\ - PythonTest_codemaker_python \ + Test_codemaker \ )) # vim:set noet sw=4 ts=4: diff --git a/codemaker/Test_codemaker.mk b/codemaker/Test_codemaker.mk new file mode 100644 index 000000000000..bc4a7cf69fb7 --- /dev/null +++ b/codemaker/Test_codemaker.mk @@ -0,0 +1,20 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +# Golden-file tests for both cppumaker and pythonmaker (see README.md there) +$(eval $(call gb_PythonTest_PythonTest,codemaker)) +$(eval $(call gb_PythonTest_add_modules,codemaker,$(SRCDIR)/codemaker/tests,\ + codemakertests \ +)) + +$(call gb_PythonTest_get_target,codemaker): \ + $(call gb_Executable_get_target,cppumaker) \ + $(call gb_Executable_get_target,pythonmaker) + +# vim: set noet sw=4 ts=4: diff --git a/codemaker/tests/Readme.md b/codemaker/tests/Readme.md new file mode 100644 index 000000000000..e473616c87f6 --- /dev/null +++ b/codemaker/tests/Readme.md @@ -0,0 +1,94 @@ +# Codemaker Test Suite + +This directory contains the integration test suite for the UNO code generators `cppumaker` and `pythonmaker`. The suite ensures that: + +- `cppumaker` correctly generates C++ headers (`.hpp` and `.hdl`), and +- `pythonmaker` correctly generates Python stub files (`.pyi`) + +from the same UNO IDL definitions. It verifies the syntactic correctness of the output and protects against future regressions. + +The tests are automatically executed as part of the `make check` command for the `codemaker` module. They can also be run on their own with: + +```bash +make codemaker.check +``` + +## Testing Philosophy + +The test suite follows a "Golden File" testing methodology. This is a standard and robust approach for testing compilers and code generators. The process is as follows: + +1. **Source IDL:** A single comprehensive test IDL file (`tests.idl`) serves as the source of truth for all UNO constructs that the generators are expected to handle. Both tools are fed the same file. +2. **Generate Output:** During the test run, this IDL is compiled into a temporary `.rdb` file with `unoidl-write`, and each tool (`cppumaker`, `pythonmaker`) is executed to generate its output in its own temporary directory. +3. **Compare Against "Golden" Files:** The newly generated output is recursively compared against a set of manually verified, correct "golden" files: + - `expected_cppumaker_stubs/` for `cppumaker` + - `expected_pythonmaker_stubs/` for `pythonmaker` +4. **Pass/Fail:** A test passes only if the generated output is an exact match to the golden files. Any difference (missing files, extra files, or content mismatches) causes the test to fail. + +This approach ensures that any change to a generator that alters its output is immediately detected. + +## Directory Structure + +- `tests.idl`: The master IDL file containing all test cases. This includes enums, constants, typedefs, structs (plain, inherited, and polymorphic), exceptions, interfaces, services, and singletons. It also includes edge cases like the use of keywords as identifiers. All types live in the tool-neutral module `test::codemaker::codemakertests`, so the generated paths and namespaces (e.g. `test/codemaker/codemakertests/...`) are the same for both tools. +- `expected_cppumaker_stubs/`: The "golden" `.hpp` and `.hdl` file structure that `cppumaker` is expected to generate from `tests.idl`. This is the reference standard for correctness of `cppumaker`. +- `expected_pythonmaker_stubs/`: The "golden" `.pyi` file structure that `pythonmaker` is expected to generate from `tests.idl`. This is the reference standard for correctness of `pythonmaker`. +- `codemakertests.py`: The Python script that orchestrates the tests. It is executed by the build system and, for each tool, compiles the IDL, runs the tool, and compares the output directory with the matching golden directory. It contains one test class per tool (`TestCppuMaker`, `TestPythonMaker`) sharing a common implementation. +- `README.md`: This file. + +The gbuild makefile that integrates the script into `make check` is `codemaker/Test_codemaker.mk`, registered in `codemaker/Module_codemaker.mk`. It depends on both the `cppumaker` and `pythonmaker` executables. + +--- + +## How to Modify or Extend the Test Suite + +Future developers may need to modify these tests when fixing a bug or adding a new feature to either tool. Here is the standard workflow. + +### Regenerating the Golden Files + +Both golden directories are regenerated from `tests.idl` with the freshly built tools. Run the following from `instdir/program` (the tools need the libraries located there): + +```bash +mkdir -p ../../workdir/golden_tmp + +# 1. Compile the shared IDL to an .rdb +../sdk/bin/unoidl-write.exe ../../workdir/UnoApiTarget/udkapi.rdb ../../codemaker/tests/tests.idl ../../workdir/golden_tmp/tests.rdb + +# 2. Clear the old golden files +rm -rf ../../codemaker/tests/expected_cppumaker_stubs ../../codemaker/tests/expected_pythonmaker_stubs +mkdir -p ../../codemaker/tests/expected_cppumaker_stubs ../../codemaker/tests/expected_pythonmaker_stubs + +# 3. Generate the stubs straight into the golden directories +../sdk/bin/cppumaker.exe -O ../../codemaker/tests/expected_cppumaker_stubs ../../workdir/golden_tmp/tests.rdb -X ../../workdir/UnoApiTarget/udkapi.rdb +../sdk/bin/pythonmaker.exe -O ../../codemaker/tests/expected_pythonmaker_stubs ../../workdir/golden_tmp/tests.rdb -X ../../workdir/UnoApiTarget/udkapi.rdb + +# 4. Remove leftovers (the test ignores *.tmp files of pythonmaker) +find ../../codemaker/tests/expected_pythonmaker_stubs -name '*.tmp' -delete +rm -rf ../../workdir/golden_tmp +``` + +(On Linux/macOS, drop the `.exe` suffix; the SDK tools are in `instdir/sdk/bin`, or in the `LibreOffice*_SDK/bin` directory of the installation.) Only one of the two tools has to be regenerated if only one is affected; the other directory is left untouched. Always review the result with `git diff` before committing. + +### Scenario 1: Fixing a Bug in a Generator + +If you have fixed a bug that was causing a tool to generate incorrect output, the corresponding test should now fail because the new, correct output will not match the old, incorrect golden files. + +1. **Verify the Fix:** After fixing the C++ code of the tool, run `make codemaker.check` to confirm that the test fails as expected. The error output lists the differing files and shows the first difference. +2. **Regenerate the Golden Files:** Follow the steps in "Regenerating the Golden Files" above. +3. **Review the Changes:** Use `git diff` to confirm that only the intended differences appear in the golden files. +4. **Validate:** + - For `cppumaker`: ensure the new generated headers are syntactically correct and type-safe (often verified simply by checking that a full LibreOffice build succeeds with your new `cppumaker`). + - For `pythonmaker`: run `mypy --strict codemaker/tests/expected_pythonmaker_stubs/` to ensure the new golden files are syntactically correct and type-safe. +5. **Commit:** Commit the changes to the tool's C++ source code **along with** the updated golden files in your patch. The commit message should explain that the golden files were updated to reflect the bug fix. + +### Scenario 2: Adding a New Feature to a Generator + +If you add support for a new IDL feature (e.g., a new type or an annotation), you should add a test case for it. + +1. **Add a Test Case to the IDL:** + - Open `codemaker/tests/tests.idl`. + - Add a new, simple example of the feature you've implemented. For example, add a new `interface` with a specific attribute you are now supporting. +2. **Generate and Verify the New Golden Files:** + - Since you've added a new type, new output files will be generated. Regenerate the golden files as described above. Note that the IDL is shared, so a change to `tests.idl` may also change the output of the _other_ tool; review the golden files of both tools. + - Locate the newly generated files for your new test case. + - **Manually inspect these new files** to ensure they are 100% correct (valid C++ for `cppumaker`; run `mypy --strict` on them for `pythonmaker`). +3. **Run the Full Test Suite:** Run `make codemaker.check`. The tests should now pass, as the newly generated output will match your newly added golden files. +4. **Commit:** Commit the changes to the tool's source code, the updated `tests.idl`, and the new golden files together in your patch. diff --git a/codemaker/tests/codemakertests.py b/codemaker/tests/codemakertests.py new file mode 100644 index 000000000000..d93ba3a8b119 --- /dev/null +++ b/codemaker/tests/codemakertests.py @@ -0,0 +1,274 @@ +#! /usr/bin/env python +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +"""Golden-file tests for the codemaker tools (cppumaker and pythonmaker). + +Both tools are fed the same IDL (tests.idl). The IDL is compiled to a +temporary .rdb with unoidl-write, each tool is run on it, and the generated +output is compared byte-for-byte with the golden files stored next to this +script: + + expected_cppumaker_stubs/ <- golden output of cppumaker + expected_pythonmaker_stubs/ <- golden output of pythonmaker +""" +import filecmp +import difflib +import glob +import os +import shutil +import subprocess +import unittest + +from typing import TYPE_CHECKING, List, Optional, Set + +HERE: str = os.path.dirname(os.path.abspath(__file__)) + +if TYPE_CHECKING: + # For the type checker the mixin is a TestCase (so self.fail() etc. are + # known); at run time it stays a plain mixin, so unittest does not collect + # the shared base class as a test of its own. + _MixinBase = unittest.TestCase +else: + _MixinBase = object + + +class CodemakerGoldenTestMixin(_MixinBase): + """Shared logic for golden-file comparison of a codemaker tool. + + Subclasses must also derive from unittest.TestCase and set: + TOOL_NAME - executable name in the SDK (without suffix) + GOLDEN_DIRNAME - directory (next to this script) with the golden files + IS_OUTPUT_FILE - predicate deciding which generated files are compared + """ + + TOOL_NAME: str = "" + GOLDEN_DIRNAME: str = "" + + @staticmethod + def IS_OUTPUT_FILE(name: str) -> bool: # pragma: no cover - overridden + raise NotImplementedError + + def setUp(self) -> None: + # Build environment + self.srcdir: str = os.environ.get("SRCDIR", os.getcwd()) + self.builddir: str = os.environ.get("BUILDDIR", os.getcwd()) + self.instdir: str = os.environ.get( + "INSTDIR", os.path.join(self.builddir, "instdir") + ) + self.workdir: str = os.environ.get( + "WORKDIR", os.path.join(self.builddir, "workdir") + ) + + # SDK tools + self.unoidl_write: Optional[str] = None + self.tool: Optional[str] = None + + sdk_patterns: List[str] = [ + os.path.join(self.instdir, "sdk", "bin"), + os.path.join(self.instdir, "LibreOffice*_SDK", "bin"), + ] + exe_suffix: str = ".exe" if os.name == "nt" else "" + + for pattern in sdk_patterns: + for sdk_dir in glob.glob(pattern): + unoidl_path = os.path.join(sdk_dir, "unoidl-write" + exe_suffix) + tool_path = os.path.join(sdk_dir, self.TOOL_NAME + exe_suffix) + if os.path.exists(unoidl_path) and os.path.exists(tool_path): + self.unoidl_write = unoidl_path + self.tool = tool_path + break + if self.unoidl_write and self.tool: + break + + # Test paths + self.golden_dir: str = os.path.join(HERE, self.GOLDEN_DIRNAME) + self.idl_file: str = os.path.join(HERE, "tests.idl") + + self.test_workdir: str = os.path.join( + self.workdir, self.TOOL_NAME + "_test" + ) + os.makedirs(self.test_workdir, exist_ok=True) + + self.types_rdb: str = os.path.join( + self.workdir, "UnoApiTarget", "udkapi.rdb" + ) + self.temp_rdb: str = os.path.join(self.test_workdir, "temptest.rdb") + self.output_dir: str = os.path.join(self.test_workdir, "generated_stubs") + + def tearDown(self) -> None: + if os.path.exists(self.test_workdir): + shutil.rmtree(self.test_workdir, ignore_errors=True) + + # test + + def test_golden_comparison(self) -> None: + self.assertIsNotNone( + self.unoidl_write, "unoidl-write or %s not found in SDK" % self.TOOL_NAME + ) + self.assertIsNotNone(self.tool, "%s not found in SDK" % self.TOOL_NAME) + + assert self.unoidl_write is not None + assert self.tool is not None + + self.assertTrue( + os.path.exists(self.types_rdb), + "udkapi.rdb not found at: " + self.types_rdb, + ) + self.assertTrue( + os.path.exists(self.idl_file), + "IDL file not found at: " + self.idl_file, + ) + + self._convert_idl_to_rdb() + self._generate_stubs() + self._compare_with_expected_files() + + # helpers + + def _run(self, cmd: List[str], what: str) -> None: + try: + subprocess.run( + cmd, + cwd=self.test_workdir, + capture_output=True, + text=True, + check=True, + ) + except subprocess.CalledProcessError as e: + self.fail( + "Failed to %s:\n%s\nCommand: %s" + % (what, e.stderr or "", " ".join(cmd)) + ) + + def _convert_idl_to_rdb(self) -> None: + assert self.unoidl_write is not None + self._run( + [self.unoidl_write, self.types_rdb, self.idl_file, self.temp_rdb], + "convert IDL to RDB", + ) + self.assertTrue( + os.path.exists(self.temp_rdb), + "RDB file was not created by unoidl-write", + ) + + def _generate_stubs(self) -> None: + assert self.tool is not None + os.makedirs(self.output_dir, exist_ok=True) + self._run( + [self.tool, "-O", self.output_dir, self.temp_rdb, "-X", self.types_rdb], + "generate stubs with " + self.TOOL_NAME, + ) + self.assertGreater( + len(self._list_files(self.output_dir)), + 0, + self.TOOL_NAME + " produced no output files", + ) + + def _list_files(self, base: str) -> List[str]: + """Relative paths of all relevant files below base.""" + result: List[str] = [] + for root, _, files in os.walk(base): + for name in files: + if self.IS_OUTPUT_FILE(name): + result.append(os.path.relpath(os.path.join(root, name), base)) + return result + + def _compare_with_expected_files(self) -> None: + if not os.path.exists(self.golden_dir): + self.fail("Expected directory does not exist: " + self.golden_dir) + + expected_files: List[str] = self._list_files(self.golden_dir) + generated_files: List[str] = self._list_files(self.output_dir) + + expected_set: Set[str] = set(expected_files) + generated_set: Set[str] = set(generated_files) + + missing: Set[str] = expected_set - generated_set + extra: Set[str] = generated_set - expected_set + + if missing: + self.fail( + "Missing generated files (%d):\n %s" + % (len(missing), "\n ".join(sorted(missing))) + ) + if extra: + self.fail( + "Unexpected generated files (%d):\n %s" + % (len(extra), "\n ".join(sorted(extra))) + ) + + differences: List[str] = [ + rel + for rel in sorted(expected_files) + if not filecmp.cmp( + os.path.join(self.golden_dir, rel), + os.path.join(self.output_dir, rel), + shallow=False, + ) + ] + + if differences: + self.fail( + "File content differences found (%d):\n %s\n\n%s" + % ( + len(differences), + "\n ".join(differences), + self._diff_excerpt(differences[0]), + ) + ) + + def _diff_excerpt(self, rel_path: str, max_lines: int = 40) -> str: + """Short unified diff of the first differing file, to ease debugging.""" + + def read(path: str) -> List[str]: + with open(path, encoding="utf-8", errors="replace") as f: + return f.readlines() + + diff = list( + difflib.unified_diff( + read(os.path.join(self.golden_dir, rel_path)), + read(os.path.join(self.output_dir, rel_path)), + fromfile="expected/" + rel_path, + tofile="generated/" + rel_path, + ) + ) + text = "".join(diff[:max_lines]) + if len(diff) > max_lines: + text += "... (%d more diff lines)\n" % (len(diff) - max_lines) + return "First difference:\n" + text + + +class TestCppuMaker(CodemakerGoldenTestMixin, unittest.TestCase): + """cppumaker must generate exactly the golden .hpp/.hdl headers.""" + + TOOL_NAME = "cppumaker" + GOLDEN_DIRNAME = "expected_cppumaker_stubs" + + @staticmethod + def IS_OUTPUT_FILE(name: str) -> bool: + return name.lower().endswith((".hpp", ".hdl")) + + +class TestPythonMaker(CodemakerGoldenTestMixin, unittest.TestCase): + """pythonmaker must generate exactly the golden .pyi stubs.""" + + TOOL_NAME = "pythonmaker" + GOLDEN_DIRNAME = "expected_pythonmaker_stubs" + + @staticmethod + def IS_OUTPUT_FILE(name: str) -> bool: + # pythonmaker may leave temporary files behind; ignore them + return not name.lower().endswith(".tmp") + + +if __name__ == "__main__": + unittest.main() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Any.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Any.hdl new file mode 100644 index 000000000000..bd7f8886ab1e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Any.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "com/sun/star/uno/Any.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Any Any; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Any.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Any.hpp new file mode 100644 index 000000000000..eb1c28945d45 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Any.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Any.hdl" + +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Boolean.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Boolean.hdl new file mode 100644 index 000000000000..8ac7f43a4471 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Boolean.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::sal_Bool Boolean; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Boolean.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Boolean.hpp new file mode 100644 index 000000000000..daff2d14b62d --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Boolean.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Boolean.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Byte.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Byte.hdl new file mode 100644 index 000000000000..1ac733e9e22e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Byte.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::sal_Int8 Byte; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Byte.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Byte.hpp new file mode 100644 index 000000000000..3d491b72ce7f --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Byte.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Byte.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Char.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Char.hdl new file mode 100644 index 000000000000..0d65c7263d4e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Char.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::sal_Unicode Char; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Char.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Char.hpp new file mode 100644 index 000000000000..51ff5e88999c --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Char.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Char.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Double.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Double.hdl new file mode 100644 index 000000000000..80586ed2d964 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Double.hdl @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef double Double; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Double.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Double.hpp new file mode 100644 index 000000000000..2d9dd4625db2 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Double.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Double.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum.hdl new file mode 100644 index 000000000000..205bd9adeb3e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Enum2.hdl" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::test::codemaker::codemakertests::Enum2 Enum; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum.hpp new file mode 100644 index 000000000000..8e837cae4335 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Enum.hdl" + +#include "test/codemaker/codemakertests/Enum2.hpp" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum1.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum1.hdl new file mode 100644 index 000000000000..78bc2a19444d --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum1.hdl @@ -0,0 +1,47 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" + +namespace com { namespace sun { namespace star { namespace uno { class Type; } } } } + +namespace test { namespace codemaker { namespace codemakertests { + +#if defined LIBO_INTERNAL_ONLY + +#if defined __GNUC__ + +enum class Enum1 +{ + +#else + +enum class SAL_DLLPUBLIC_RTTI Enum1 +{ + +#endif + +#else + +enum SAL_DLLPUBLIC_RTTI Enum1 +{ + +#endif + Enum1_VALUE_NEG = -1, + Enum1_VALUE_ZERO = 0, + Enum1_VALUE_POS = 1, + Enum1_MAKE_FIXED_SIZE = SAL_MAX_ENUM +}; + +#if defined LIBO_INTERNAL_ONLY +constexpr auto Enum1_VALUE_NEG = Enum1::Enum1_VALUE_NEG; +constexpr auto Enum1_VALUE_ZERO = Enum1::Enum1_VALUE_ZERO; +constexpr auto Enum1_VALUE_POS = Enum1::Enum1_VALUE_POS; +#endif + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum1 const *); +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(const ::test::codemaker::codemakertests::Enum1 *); + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum1.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum1.hpp new file mode 100644 index 000000000000..e4bf4b2962f3 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum1.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Enum1.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum1 const *) { + static typelib_TypeDescriptionReference * the_type = 0; + if ( !the_type ) + { + typelib_static_enum_type_init( &the_type, + "test.codemaker.codemakertests.Enum1", + ::test::codemaker::codemakertests::Enum1_VALUE_NEG ); + } + return * reinterpret_cast< ::css::uno::Type * >( &the_type ); +} + +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum1 const *) { + return ::cppu::UnoType< ::test::codemaker::codemakertests::Enum1 >::get(); +} diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum2.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum2.hdl new file mode 100644 index 000000000000..0b313b299bef --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum2.hdl @@ -0,0 +1,51 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" + +namespace com { namespace sun { namespace star { namespace uno { class Type; } } } } + +namespace test { namespace codemaker { namespace codemakertests { + +#if defined LIBO_INTERNAL_ONLY + +#if defined __GNUC__ + +enum class Enum2 +{ + +#else + +enum class SAL_DLLPUBLIC_RTTI Enum2 +{ + +#endif + +#else + +enum SAL_DLLPUBLIC_RTTI Enum2 +{ + +#endif + Enum2_FLAG_NONE = 0, + Enum2_FLAG_READ = 1, + Enum2_FLAG_WRITE = 2, + Enum2_FLAG_EXEC = 4, + Enum2_FLAG_ALL = 7, + Enum2_MAKE_FIXED_SIZE = SAL_MAX_ENUM +}; + +#if defined LIBO_INTERNAL_ONLY +constexpr auto Enum2_FLAG_NONE = Enum2::Enum2_FLAG_NONE; +constexpr auto Enum2_FLAG_READ = Enum2::Enum2_FLAG_READ; +constexpr auto Enum2_FLAG_WRITE = Enum2::Enum2_FLAG_WRITE; +constexpr auto Enum2_FLAG_EXEC = Enum2::Enum2_FLAG_EXEC; +constexpr auto Enum2_FLAG_ALL = Enum2::Enum2_FLAG_ALL; +#endif + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum2 const *); +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(const ::test::codemaker::codemakertests::Enum2 *); + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum2.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum2.hpp new file mode 100644 index 000000000000..d12380e2d09e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum2.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Enum2.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum2 const *) { + static typelib_TypeDescriptionReference * the_type = 0; + if ( !the_type ) + { + typelib_static_enum_type_init( &the_type, + "test.codemaker.codemakertests.Enum2", + ::test::codemaker::codemakertests::Enum2_FLAG_NONE ); + } + return * reinterpret_cast< ::css::uno::Type * >( &the_type ); +} + +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum2 const *) { + return ::cppu::UnoType< ::test::codemaker::codemakertests::Enum2 >::get(); +} diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum3.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum3.hdl new file mode 100644 index 000000000000..43c8cef71d5d --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum3.hdl @@ -0,0 +1,49 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" + +namespace com { namespace sun { namespace star { namespace uno { class Type; } } } } + +namespace test { namespace codemaker { namespace codemakertests { + +#if defined LIBO_INTERNAL_ONLY + +#if defined __GNUC__ + +enum class Enum3 +{ + +#else + +enum class SAL_DLLPUBLIC_RTTI Enum3 +{ + +#endif + +#else + +enum SAL_DLLPUBLIC_RTTI Enum3 +{ + +#endif + Enum3_FIRST = 10, + Enum3_SECOND = 20, + Enum3_THIRD = 100, + Enum3_FOURTH = 255, + Enum3_MAKE_FIXED_SIZE = SAL_MAX_ENUM +}; + +#if defined LIBO_INTERNAL_ONLY +constexpr auto Enum3_FIRST = Enum3::Enum3_FIRST; +constexpr auto Enum3_SECOND = Enum3::Enum3_SECOND; +constexpr auto Enum3_THIRD = Enum3::Enum3_THIRD; +constexpr auto Enum3_FOURTH = Enum3::Enum3_FOURTH; +#endif + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum3 const *); +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(const ::test::codemaker::codemakertests::Enum3 *); + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum3.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum3.hpp new file mode 100644 index 000000000000..3c553373f7d3 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum3.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Enum3.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum3 const *) { + static typelib_TypeDescriptionReference * the_type = 0; + if ( !the_type ) + { + typelib_static_enum_type_init( &the_type, + "test.codemaker.codemakertests.Enum3", + ::test::codemaker::codemakertests::Enum3_FIRST ); + } + return * reinterpret_cast< ::css::uno::Type * >( &the_type ); +} + +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum3 const *) { + return ::cppu::UnoType< ::test::codemaker::codemakertests::Enum3 >::get(); +} diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum4.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum4.hdl new file mode 100644 index 000000000000..c04cccaa7f41 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum4.hdl @@ -0,0 +1,47 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" + +namespace com { namespace sun { namespace star { namespace uno { class Type; } } } } + +namespace test { namespace codemaker { namespace codemakertests { + +#if defined LIBO_INTERNAL_ONLY + +#if defined __GNUC__ + +enum class Enum4 +{ + +#else + +enum class SAL_DLLPUBLIC_RTTI Enum4 +{ + +#endif + +#else + +enum SAL_DLLPUBLIC_RTTI Enum4 +{ + +#endif + Enum4_AUTO_A = 0, + Enum4_AUTO_B = 1, + Enum4_AUTO_C = 2, + Enum4_MAKE_FIXED_SIZE = SAL_MAX_ENUM +}; + +#if defined LIBO_INTERNAL_ONLY +constexpr auto Enum4_AUTO_A = Enum4::Enum4_AUTO_A; +constexpr auto Enum4_AUTO_B = Enum4::Enum4_AUTO_B; +constexpr auto Enum4_AUTO_C = Enum4::Enum4_AUTO_C; +#endif + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum4 const *); +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(const ::test::codemaker::codemakertests::Enum4 *); + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum4.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum4.hpp new file mode 100644 index 000000000000..a37ec7e470ca --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Enum4.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Enum4.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum4 const *) { + static typelib_TypeDescriptionReference * the_type = 0; + if ( !the_type ) + { + typelib_static_enum_type_init( &the_type, + "test.codemaker.codemakertests.Enum4", + ::test::codemaker::codemakertests::Enum4_AUTO_A ); + } + return * reinterpret_cast< ::css::uno::Type * >( &the_type ); +} + +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Enum4 const *) { + return ::cppu::UnoType< ::test::codemaker::codemakertests::Enum4 >::get(); +} diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Float.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Float.hdl new file mode 100644 index 000000000000..e70505cc71a1 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Float.hdl @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef float Float; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Float.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Float.hpp new file mode 100644 index 000000000000..09b1c2af417e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Float.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Float.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Hyper.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Hyper.hdl new file mode 100644 index 000000000000..38639d2fcab2 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Hyper.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::sal_Int64 Hyper; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Hyper.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Hyper.hpp new file mode 100644 index 000000000000..a3bebb2c3118 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Hyper.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Hyper.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Long.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Long.hdl new file mode 100644 index 000000000000..4f8c3a8e8c4c --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Long.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::sal_Int32 Long; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Long.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Long.hpp new file mode 100644 index 000000000000..3d5a811bee4e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Long.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Long.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/PolyStruct.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/PolyStruct.hdl new file mode 100644 index 000000000000..cf366e755312 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/PolyStruct.hdl @@ -0,0 +1,32 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace com { namespace sun { namespace star { namespace uno { class Type; } } } } + +namespace test { namespace codemaker { namespace codemakertests { + +#ifdef _WIN32 +# pragma pack(push, 8) +#endif + +template< typename typeparam_if, typename typeparam_else > struct SAL_DLLPUBLIC_RTTI PolyStruct { + inline PolyStruct(); + + inline PolyStruct(typeparam_if const & member1_, const ::sal_Int32& member2_); + + typeparam_if member1; + ::sal_Int32 member2; +}; + +#ifdef _WIN32 +# pragma pack(pop) +#endif + +} } } + +template< typename typeparam_if, typename typeparam_else > SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(const ::test::codemaker::codemakertests::PolyStruct< typeparam_if, typeparam_else > *); + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/PolyStruct.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/PolyStruct.hpp new file mode 100644 index 000000000000..fba705a98807 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/PolyStruct.hpp @@ -0,0 +1,80 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/PolyStruct.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "rtl/strbuf.hxx" +#include "rtl/textenc.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "typelib/typeclass.h" +#include "typelib/typedescription.h" + +namespace test { namespace codemaker { namespace codemakertests { + +template< typename typeparam_if, typename typeparam_else > inline PolyStruct< typeparam_if, typeparam_else >::PolyStruct() + : member1() + , member2(0) +{ +} + +template< typename typeparam_if, typename typeparam_else > inline PolyStruct< typeparam_if, typeparam_else >::PolyStruct(typeparam_if const & member1_, const ::sal_Int32& member2_) + : member1(member1_) + , member2(member2_) +{ +} + +template< typename typeparam_if, typename typeparam_else > +inline PolyStruct< typeparam_if, typeparam_else > +make_PolyStruct(typeparam_if const & member1_, const ::sal_Int32& member2_) +{ + return PolyStruct< typeparam_if, typeparam_else >(member1_, member2_); +} + +template< typename typeparam_if, typename typeparam_else > inline bool operator==(const PolyStruct< typeparam_if, typeparam_else >& the_lhs, const PolyStruct< typeparam_if, typeparam_else >& the_rhs) +{ + return the_lhs.member1 == the_rhs.member1 + && the_lhs.member2 == the_rhs.member2; +} +template< typename typeparam_if, typename typeparam_else > inline bool operator!=(const PolyStruct< typeparam_if, typeparam_else >& the_lhs, const PolyStruct< typeparam_if, typeparam_else >& the_rhs) +{ +return !operator==(the_lhs, the_rhs); +} +} } } + +namespace cppu { + +template< typename typeparam_if, typename typeparam_else > class UnoType< ::test::codemaker::codemakertests::PolyStruct< typeparam_if, typeparam_else > > { +public: + static inline ::css::uno::Type const & get() { + //TODO: On certain platforms with weak memory models, the following code can result in some threads observing that the_type points to garbage + static ::typelib_TypeDescriptionReference * the_type = 0; + if (the_type == 0) { + ::rtl::OStringBuffer the_buffer("test.codemaker.codemakertests.PolyStruct<"); + the_buffer.append(::rtl::OUStringToOString(::cppu::getTypeFavourChar(static_cast< typeparam_if * >(0)).getTypeName(), RTL_TEXTENCODING_UTF8)); + the_buffer.append(','); + the_buffer.append(::rtl::OUStringToOString(::cppu::getTypeFavourChar(static_cast< typeparam_else * >(0)).getTypeName(), RTL_TEXTENCODING_UTF8)); + the_buffer.append('>'); + ::typelib_TypeDescriptionReference * the_members[] = { + ::cppu::getTypeFavourChar(static_cast< typeparam_if * >(0)).getTypeLibType(), + ::cppu::UnoType< ::sal_Int32 >::get().getTypeLibType() }; + static ::sal_Bool const the_parameterizedTypes[] = { true, false }; + ::typelib_static_struct_type_init(&the_type, the_buffer.getStr(), 0, 2, the_members, the_parameterizedTypes); + } + return *reinterpret_cast< ::css::uno::Type * >(&the_type); + } + +private: + UnoType(UnoType &); // not defined + ~UnoType(); // not defined + void operator =(UnoType); // not defined +}; + +} + +template< typename typeparam_if, typename typeparam_else > SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::PolyStruct< typeparam_if, typeparam_else > const *) { + return ::cppu::UnoType< ::test::codemaker::codemakertests::PolyStruct< typeparam_if, typeparam_else > >::get(); + } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/S1.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/S1.hpp new file mode 100644 index 000000000000..43d0de005c1e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/S1.hpp @@ -0,0 +1,301 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/lang/ClassNotFoundException.hpp" +#include "com/sun/star/lang/IllegalAccessException.hpp" +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "test/codemaker/codemakertests/Any.hpp" +#include "test/codemaker/codemakertests/Boolean.hpp" +#include "test/codemaker/codemakertests/Byte.hpp" +#include "test/codemaker/codemakertests/Char.hpp" +#include "test/codemaker/codemakertests/Double.hpp" +#include "test/codemaker/codemakertests/Enum.hpp" +#include "test/codemaker/codemakertests/Enum2.hpp" +#include "test/codemaker/codemakertests/Float.hpp" +#include "test/codemaker/codemakertests/Hyper.hpp" +#include "test/codemaker/codemakertests/Long.hpp" +#include "test/codemaker/codemakertests/SequenceAny.hpp" +#include "test/codemaker/codemakertests/SequenceBoolean.hpp" +#include "test/codemaker/codemakertests/SequenceByte.hpp" +#include "test/codemaker/codemakertests/SequenceChar.hpp" +#include "test/codemaker/codemakertests/SequenceDouble.hpp" +#include "test/codemaker/codemakertests/SequenceEnum.hpp" +#include "test/codemaker/codemakertests/SequenceFloat.hpp" +#include "test/codemaker/codemakertests/SequenceHyper.hpp" +#include "test/codemaker/codemakertests/SequenceLong.hpp" +#include "test/codemaker/codemakertests/SequenceShort.hpp" +#include "test/codemaker/codemakertests/SequenceString.hpp" +#include "test/codemaker/codemakertests/SequenceStruct.hpp" +#include "test/codemaker/codemakertests/SequenceType.hpp" +#include "test/codemaker/codemakertests/SequenceUnsignedHyper.hpp" +#include "test/codemaker/codemakertests/SequenceUnsignedLong.hpp" +#include "test/codemaker/codemakertests/SequenceUnsignedShort.hpp" +#include "test/codemaker/codemakertests/SequenceXInterface.hpp" +#include "test/codemaker/codemakertests/SequenceXNamingService.hpp" +#include "test/codemaker/codemakertests/Short.hpp" +#include "test/codemaker/codemakertests/String.hpp" +#include "test/codemaker/codemakertests/Struct.hpp" +#include "test/codemaker/codemakertests/Struct1.hpp" +#include "test/codemaker/codemakertests/Type.hpp" +#include "test/codemaker/codemakertests/UnsignedHyper.hpp" +#include "test/codemaker/codemakertests/UnsignedLong.hpp" +#include "test/codemaker/codemakertests/UnsignedShort.hpp" +#include "test/codemaker/codemakertests/XInterface.hpp" +#include "test/codemaker/codemakertests/XNamingService.hpp" +#include "test/codemaker/codemakertests/XTest.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1 && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1 +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class S1 { +public: + static ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > create1(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1 && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1 + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(::css::uno::Sequence< ::css::uno::Any >()); + } +#else + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.S1", ::css::uno::Sequence< ::css::uno::Any >(), the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.S1" + " of type " + "test.codemaker.codemakertests.XTest" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.S1" + " of type " + "test.codemaker.codemakertests.XTest", the_context); + } + return the_instance; + } + + static ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > create2(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, const ::css::uno::Sequence< ::css::uno::Any >& create2) { + assert(the_context.is()); + ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > the_instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1 && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1 + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1)(the_context.get(), create2)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.S1", create2, the_context), ::css::uno::UNO_QUERY); +#endif + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.S1" + " of type " + "test.codemaker.codemakertests.XTest", the_context); + } + return the_instance; + } + + static ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > create3(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, const ::css::uno::Sequence< ::css::uno::Any >& S1) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= S1; + ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1 && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1 + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.S1", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::lang::ClassNotFoundException &) { + throw; + } catch (const ::css::lang::IllegalAccessException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.S1" + " of type " + "test.codemaker.codemakertests.XTest" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.S1" + " of type " + "test.codemaker.codemakertests.XTest", the_context); + } + return the_instance; + } + + static ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > create4(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 javamaker, ::sal_Int32 S1, ::sal_Int32 create4) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(3); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= javamaker; + the_arguments_array[1] <<= S1; + the_arguments_array[2] <<= create4; + ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1 && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1 + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.S1", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.S1" + " of type " + "test.codemaker.codemakertests.XTest" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.S1" + " of type " + "test.codemaker.codemakertests.XTest", the_context); + } + return the_instance; + } + + static ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > create5(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Bool p1, ::sal_Int8 p2, ::sal_Int16 p3, ::sal_uInt16 p4, ::sal_Int32 p5, ::sal_uInt32 p6, ::sal_Int64 p7, ::sal_uInt64 p8, float p9, double p10, ::sal_Unicode p11, const ::rtl::OUString& p12, const ::css::uno::Type& p13, const ::css::uno::Any& p14, ::test::codemaker::codemakertests::Enum2 p15, const ::test::codemaker::codemakertests::Struct1& p16, const ::css::uno::Reference< ::css::uno::XInterface >& p17, const ::css::uno::Reference< ::css::uno::XNamingService >& p18, ::sal_Bool t1, ::sal_Int8 t2, ::sal_Int16 t3, ::sal_uInt16 t4, ::sal_Int32 t5, ::sal_uInt32 t6, ::sal_Int64 t7, ::sal_uInt64 t8, float t9, double t10, ::sal_Unicode t11, const ::rtl::OUString& t12, const ::css::uno::Type& t13, const ::css::uno::Any& t14, ::test::codemaker::codemakertests::Enum2 t15, const ::test::codemaker::codemakertests::Struct1& t16, const ::css::uno::Reference< ::css::uno::XInterface >& t17, const ::css::uno::Reference< ::css::uno::XNamingService >& t18, const ::css::uno::Sequence< ::sal_Bool >& a1, const ::css::uno::Sequence< ::sal_Int8 >& a2, const ::css::uno::Sequence< ::sal_Int16 >& a3, const ::css::uno::Sequence< ::sal_uInt16 >& a4, const ::css::uno::Sequence< ::sal_Int32 >& a5, const ::css::uno::Sequence< ::sal_uInt32 >& a6, const ::css::uno::Sequence< ::sal_Int64 >& a7, const ::css::uno::Sequence< ::sal_uInt64 >& a8, const ::css::uno::Sequence< float >& a9, const ::css::uno::Sequence< double >& a10, const ::css::uno::Sequence< ::sal_Unicode >& a11, const ::css::uno::Sequence< ::rtl::OUString >& a12, const ::css::uno::Sequence< ::css::uno::Type >& a13, const ::css::uno::Sequence< ::css::uno::Any >& a14, const ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 >& a15, const ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 >& a16, const ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > >& a17, const ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > >& a18, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Bool > >& aa1, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int8 > >& aa2, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int16 > >& aa3, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt16 > >& aa4, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int32 > >& aa5, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt32 > >& aa6, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int64 > >& aa7, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt64 > >& aa8, const ::css::uno::Sequence< ::css::uno::Sequence< float > >& aa9, const ::css::uno::Sequence< ::css::uno::Sequence< double > >& aa10, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Unicode > >& aa11, const ::css::uno::Sequence< ::css::uno::Sequence< ::rtl::OUString > >& aa12, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Type > >& aa13, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Any > >& aa14, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 > >& aa15, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 > >& aa16, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > >& aa17, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > > >& aa18, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Bool > >& at1, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int8 > >& at2, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int16 > >& at3, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt16 > >& at4, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int32 > >& at5, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt32 > >& at6, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int64 > >& at7, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt64 > >& at8, const ::css::uno::Sequence< ::css::uno::Sequence< float > >& at9, const ::css::uno::Sequence< ::css::uno::Sequence< double > >& at10, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Unicode > >& at11, const ::css::uno::Sequence< ::css::uno::Sequence< ::rtl::OUString > >& at12, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Type > >& at13, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Any > >& at14, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 > >& at15, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 > >& at16, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > >& at17, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > > >& at18) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(90); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= p1; + the_arguments_array[1] <<= p2; + the_arguments_array[2] <<= p3; + the_arguments_array[3] <<= p4; + the_arguments_array[4] <<= p5; + the_arguments_array[5] <<= p6; + the_arguments_array[6] <<= p7; + the_arguments_array[7] <<= p8; + the_arguments_array[8] <<= p9; + the_arguments_array[9] <<= p10; + the_arguments_array[10] = ::css::uno::Any(&p11, ::cppu::UnoType< ::cppu::UnoCharType >::get()); + the_arguments_array[11] <<= p12; + the_arguments_array[12] <<= p13; + the_arguments_array[13] = p14; + the_arguments_array[14] <<= p15; + the_arguments_array[15] <<= p16; + the_arguments_array[16] <<= p17; + the_arguments_array[17] <<= p18; + the_arguments_array[18] <<= t1; + the_arguments_array[19] <<= t2; + the_arguments_array[20] <<= t3; + the_arguments_array[21] <<= t4; + the_arguments_array[22] <<= t5; + the_arguments_array[23] <<= t6; + the_arguments_array[24] <<= t7; + the_arguments_array[25] <<= t8; + the_arguments_array[26] <<= t9; + the_arguments_array[27] <<= t10; + the_arguments_array[28] <<= t11; + the_arguments_array[29] <<= t12; + the_arguments_array[30] <<= t13; + the_arguments_array[31] = t14; + the_arguments_array[32] <<= t15; + the_arguments_array[33] <<= t16; + the_arguments_array[34] <<= t17; + the_arguments_array[35] <<= t18; + the_arguments_array[36] <<= a1; + the_arguments_array[37] <<= a2; + the_arguments_array[38] <<= a3; + the_arguments_array[39] <<= a4; + the_arguments_array[40] <<= a5; + the_arguments_array[41] <<= a6; + the_arguments_array[42] <<= a7; + the_arguments_array[43] <<= a8; + the_arguments_array[44] <<= a9; + the_arguments_array[45] <<= a10; + the_arguments_array[46] = ::css::uno::Any(&a11, ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoCharType > >::get()); + the_arguments_array[47] <<= a12; + the_arguments_array[48] <<= a13; + the_arguments_array[49] <<= a14; + the_arguments_array[50] <<= a15; + the_arguments_array[51] <<= a16; + the_arguments_array[52] <<= a17; + the_arguments_array[53] <<= a18; + the_arguments_array[54] <<= aa1; + the_arguments_array[55] <<= aa2; + the_arguments_array[56] <<= aa3; + the_arguments_array[57] <<= aa4; + the_arguments_array[58] <<= aa5; + the_arguments_array[59] <<= aa6; + the_arguments_array[60] <<= aa7; + the_arguments_array[61] <<= aa8; + the_arguments_array[62] <<= aa9; + the_arguments_array[63] <<= aa10; + the_arguments_array[64] = ::css::uno::Any(&aa11, ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::cppu::UnoCharType > > >::get()); + the_arguments_array[65] <<= aa12; + the_arguments_array[66] <<= aa13; + the_arguments_array[67] <<= aa14; + the_arguments_array[68] <<= aa15; + the_arguments_array[69] <<= aa16; + the_arguments_array[70] <<= aa17; + the_arguments_array[71] <<= aa18; + the_arguments_array[72] <<= at1; + the_arguments_array[73] <<= at2; + the_arguments_array[74] <<= at3; + the_arguments_array[75] <<= at4; + the_arguments_array[76] <<= at5; + the_arguments_array[77] <<= at6; + the_arguments_array[78] <<= at7; + the_arguments_array[79] <<= at8; + the_arguments_array[80] <<= at9; + the_arguments_array[81] <<= at10; + the_arguments_array[82] <<= at11; + the_arguments_array[83] <<= at12; + the_arguments_array[84] <<= at13; + the_arguments_array[85] <<= at14; + the_arguments_array[86] <<= at15; + the_arguments_array[87] <<= at16; + the_arguments_array[88] <<= at17; + the_arguments_array[89] <<= at18; + ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1 && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S1) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1 + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S1)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.S1", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.S1" + " of type " + "test.codemaker.codemakertests.XTest" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.S1" + " of type " + "test.codemaker.codemakertests.XTest", the_context); + } + return the_instance; + } + +private: + S1(); // not implemented + S1(S1 &); // not implemented + ~S1(); // not implemented + void operator =(S1); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/S2.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/S2.hpp new file mode 100644 index 000000000000..6073fa705dc4 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/S2.hpp @@ -0,0 +1,57 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "test/codemaker/codemakertests/XTest.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S2 && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S2) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S2 +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S2(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class S2 { +public: + static ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > create(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S2 && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S2) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S2 + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S2)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(the_context->getServiceManager()->createInstanceWithContext( "test.codemaker.codemakertests.S2", the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.S2" + " of type " + "test.codemaker.codemakertests.XTest" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.S2" + " of type " + "test.codemaker.codemakertests.XTest", the_context); + } + return the_instance; + } + +private: + S2(); // not implemented + S2(S2 &); // not implemented + ~S2(); // not implemented + void operator =(S2); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/S4.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/S4.hpp new file mode 100644 index 000000000000..6b75cde8a04a --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/S4.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "test/codemaker/codemakertests/XTest.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S4 && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S4) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S4 +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S4(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class S4 { +public: + static ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S4 && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_S4) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S4 + instance = ::css::uno::Reference< ::test::codemaker::codemakertests::XTest >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_S4)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.S4" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.S4 of type test.codemaker.codemakertests.XTest" ), the_context); + } + return instance; + } + +private: + S4(); // not implemented + S4(S4 &); // not implemented + ~S4(); // not implemented + void operator =(S4); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceAny.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceAny.hdl new file mode 100644 index 000000000000..98b332338162 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceAny.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Any.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::css::uno::Any > SequenceAny; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceAny.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceAny.hpp new file mode 100644 index 000000000000..60af83adb14e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceAny.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceAny.hdl" + +#include "test/codemaker/codemakertests/Any.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceBoolean.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceBoolean.hdl new file mode 100644 index 000000000000..e9c9ba90563f --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceBoolean.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Boolean.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::sal_Bool > SequenceBoolean; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceBoolean.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceBoolean.hpp new file mode 100644 index 000000000000..e5835183f7f0 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceBoolean.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceBoolean.hdl" + +#include "test/codemaker/codemakertests/Boolean.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceByte.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceByte.hdl new file mode 100644 index 000000000000..ef2087b3fe58 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceByte.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Byte.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::sal_Int8 > SequenceByte; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceByte.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceByte.hpp new file mode 100644 index 000000000000..d68226604f8c --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceByte.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceByte.hdl" + +#include "test/codemaker/codemakertests/Byte.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceChar.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceChar.hdl new file mode 100644 index 000000000000..6359e2a5c186 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceChar.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Char.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::sal_Unicode > SequenceChar; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceChar.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceChar.hpp new file mode 100644 index 000000000000..9ba4f38cc749 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceChar.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceChar.hdl" + +#include "test/codemaker/codemakertests/Char.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceDouble.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceDouble.hdl new file mode 100644 index 000000000000..a0e8a842c1b4 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceDouble.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Double.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< double > SequenceDouble; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceDouble.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceDouble.hpp new file mode 100644 index 000000000000..86b56f4d3704 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceDouble.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceDouble.hdl" + +#include "test/codemaker/codemakertests/Double.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceEnum.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceEnum.hdl new file mode 100644 index 000000000000..8103464b4709 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceEnum.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Enum.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 > SequenceEnum; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceEnum.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceEnum.hpp new file mode 100644 index 000000000000..d80d416cc4cf --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceEnum.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceEnum.hdl" + +#include "test/codemaker/codemakertests/Enum.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceFloat.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceFloat.hdl new file mode 100644 index 000000000000..c79d816747c6 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceFloat.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Float.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< float > SequenceFloat; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceFloat.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceFloat.hpp new file mode 100644 index 000000000000..df5c36b636e0 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceFloat.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceFloat.hdl" + +#include "test/codemaker/codemakertests/Float.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceHyper.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceHyper.hdl new file mode 100644 index 000000000000..f0053217cc40 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceHyper.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Hyper.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::sal_Int64 > SequenceHyper; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceHyper.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceHyper.hpp new file mode 100644 index 000000000000..fc9f06d9e3d9 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceHyper.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceHyper.hdl" + +#include "test/codemaker/codemakertests/Hyper.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceLong.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceLong.hdl new file mode 100644 index 000000000000..413f62ea2219 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceLong.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Long.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::sal_Int32 > SequenceLong; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceLong.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceLong.hpp new file mode 100644 index 000000000000..34b718c722ec --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceLong.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceLong.hdl" + +#include "test/codemaker/codemakertests/Long.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceShort.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceShort.hdl new file mode 100644 index 000000000000..3355c8906038 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceShort.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Short.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::sal_Int16 > SequenceShort; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceShort.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceShort.hpp new file mode 100644 index 000000000000..c3ad5e4b90cf --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceShort.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceShort.hdl" + +#include "test/codemaker/codemakertests/Short.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceString.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceString.hdl new file mode 100644 index 000000000000..d012e803cb4d --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceString.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/String.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::rtl::OUString > SequenceString; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceString.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceString.hpp new file mode 100644 index 000000000000..7d6f2c491da3 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceString.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceString.hdl" + +#include "test/codemaker/codemakertests/String.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceStruct.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceStruct.hdl new file mode 100644 index 000000000000..96317ff98711 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceStruct.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Struct.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 > SequenceStruct; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceStruct.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceStruct.hpp new file mode 100644 index 000000000000..da68e13ff91a --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceStruct.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceStruct.hdl" + +#include "test/codemaker/codemakertests/Struct.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceType.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceType.hdl new file mode 100644 index 000000000000..f6046ae760ac --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceType.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Type.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::css::uno::Type > SequenceType; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceType.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceType.hpp new file mode 100644 index 000000000000..8a456ea779bb --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceType.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceType.hdl" + +#include "test/codemaker/codemakertests/Type.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedHyper.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedHyper.hdl new file mode 100644 index 000000000000..bf8d4f67b311 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedHyper.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/UnsignedHyper.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::sal_uInt64 > SequenceUnsignedHyper; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedHyper.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedHyper.hpp new file mode 100644 index 000000000000..bef888295f3b --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedHyper.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceUnsignedHyper.hdl" + +#include "test/codemaker/codemakertests/UnsignedHyper.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedLong.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedLong.hdl new file mode 100644 index 000000000000..dc61c6943c7f --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedLong.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/UnsignedLong.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::sal_uInt32 > SequenceUnsignedLong; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedLong.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedLong.hpp new file mode 100644 index 000000000000..085605f36fc0 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedLong.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceUnsignedLong.hdl" + +#include "test/codemaker/codemakertests/UnsignedLong.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedShort.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedShort.hdl new file mode 100644 index 000000000000..3cebbd75f23b --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedShort.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/UnsignedShort.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::sal_uInt16 > SequenceUnsignedShort; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedShort.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedShort.hpp new file mode 100644 index 000000000000..9a92f6972737 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceUnsignedShort.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceUnsignedShort.hdl" + +#include "test/codemaker/codemakertests/UnsignedShort.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXInterface.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXInterface.hdl new file mode 100644 index 000000000000..c7869b9c7403 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXInterface.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/XInterface.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > SequenceXInterface; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXInterface.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXInterface.hpp new file mode 100644 index 000000000000..eed68e38bc89 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXInterface.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceXInterface.hdl" + +#include "test/codemaker/codemakertests/XInterface.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXNamingService.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXNamingService.hdl new file mode 100644 index 000000000000..8fab9b7abdce --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXNamingService.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/XNamingService.hdl" +#include "com/sun/star/uno/Sequence.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > > SequenceXNamingService; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXNamingService.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXNamingService.hpp new file mode 100644 index 000000000000..8aa9c7caec7a --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/SequenceXNamingService.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/SequenceXNamingService.hdl" + +#include "test/codemaker/codemakertests/XNamingService.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Service.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Service.hpp new file mode 100644 index 000000000000..389a9db20627 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Service.hpp @@ -0,0 +1,63 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_Service && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_Service) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_Service +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_Service(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class Service { +public: + static ::css::uno::Reference< ::css::uno::XInterface > create(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, const ::css::uno::Sequence< ::css::uno::Any >& args) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_Service && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_Service) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_Service + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_Service)(the_context.get(), args)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.Service", args, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.Service" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.Service" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + Service(); // not implemented + Service(Service &); // not implemented + ~Service(); // not implemented + void operator =(Service); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Short.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Short.hdl new file mode 100644 index 000000000000..626dadc4282b --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Short.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::sal_Int16 Short; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Short.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Short.hpp new file mode 100644 index 000000000000..b4f7a25b7d36 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Short.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Short.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/String.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/String.hdl new file mode 100644 index 000000000000..f9ec9e033516 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/String.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "rtl/ustring.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::rtl::OUString String; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/String.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/String.hpp new file mode 100644 index 000000000000..de94d4ac48c2 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/String.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/String.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct.hdl new file mode 100644 index 000000000000..19f145b49b6a --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Struct1.hdl" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::test::codemaker::codemakertests::Struct1 Struct; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct.hpp new file mode 100644 index 000000000000..615a0068f305 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Struct.hdl" + +#include "test/codemaker/codemakertests/Struct1.hpp" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct1.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct1.hdl new file mode 100644 index 000000000000..4cd6b1a40a77 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct1.hdl @@ -0,0 +1,33 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace com { namespace sun { namespace star { namespace uno { class Type; } } } } + +namespace test { namespace codemaker { namespace codemakertests { + +#ifdef _WIN32 +# pragma pack(push, 8) +#endif + +struct SAL_DLLPUBLIC_RTTI SAL_WARN_UNUSED Struct1 { + inline Struct1(); + + inline Struct1(const ::sal_Int32& member1_); + + ::sal_Int32 member1; +}; + +#ifdef _WIN32 +# pragma pack(pop) +#endif + + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Struct1 const *); +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(const ::test::codemaker::codemakertests::Struct1 *); + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct1.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct1.hpp new file mode 100644 index 000000000000..d40182ecd521 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct1.hpp @@ -0,0 +1,54 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Struct1.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" +#include "typelib/typeclass.h" +#include "typelib/typedescription.h" + +namespace test { namespace codemaker { namespace codemakertests { + +inline Struct1::Struct1() + : member1(0) +{ +} + +inline Struct1::Struct1(const ::sal_Int32& member1_) + : member1(member1_) +{ +} + + +inline bool operator==(const Struct1& the_lhs, const Struct1& the_rhs) +{ + return the_lhs.member1 == the_rhs.member1; +} + +inline bool operator!=(const Struct1& the_lhs, const Struct1& the_rhs) +{ +return !operator==(the_lhs, the_rhs); +} +} } } + +namespace test { namespace codemaker { namespace codemakertests { + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Struct1 const *) { + //TODO: On certain platforms with weak memory models, the following code can result in some threads observing that the_type points to garbage + static ::typelib_TypeDescriptionReference * the_type = 0; + if (the_type == 0) { + ::typelib_TypeDescriptionReference * the_members[] = { + ::cppu::UnoType< ::sal_Int32 >::get().getTypeLibType() }; + ::typelib_static_struct_type_init(&the_type, "test.codemaker.codemakertests.Struct1", 0, 1, the_members, 0); + } + return *reinterpret_cast< ::css::uno::Type * >(&the_type); +} + +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Struct1 const *) { + return ::cppu::UnoType< ::test::codemaker::codemakertests::Struct1 >::get(); +} diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct2.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct2.hdl new file mode 100644 index 000000000000..a633fc0c384f --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct2.hdl @@ -0,0 +1,167 @@ +#pragma once + +#include "sal/config.h" + +namespace com { namespace sun { namespace star { namespace uno { class XInterface; } } } } +namespace com { namespace sun { namespace star { namespace uno { class XNamingService; } } } } +#include "test/codemaker/codemakertests/Any.hdl" +#include "test/codemaker/codemakertests/Boolean.hdl" +#include "test/codemaker/codemakertests/Byte.hdl" +#include "test/codemaker/codemakertests/Char.hdl" +#include "test/codemaker/codemakertests/Double.hdl" +#include "test/codemaker/codemakertests/Enum.hdl" +#include "test/codemaker/codemakertests/Enum2.hdl" +#include "test/codemaker/codemakertests/Float.hdl" +#include "test/codemaker/codemakertests/Hyper.hdl" +#include "test/codemaker/codemakertests/Long.hdl" +#include "test/codemaker/codemakertests/SequenceAny.hdl" +#include "test/codemaker/codemakertests/SequenceBoolean.hdl" +#include "test/codemaker/codemakertests/SequenceByte.hdl" +#include "test/codemaker/codemakertests/SequenceChar.hdl" +#include "test/codemaker/codemakertests/SequenceDouble.hdl" +#include "test/codemaker/codemakertests/SequenceEnum.hdl" +#include "test/codemaker/codemakertests/SequenceFloat.hdl" +#include "test/codemaker/codemakertests/SequenceHyper.hdl" +#include "test/codemaker/codemakertests/SequenceLong.hdl" +#include "test/codemaker/codemakertests/SequenceShort.hdl" +#include "test/codemaker/codemakertests/SequenceString.hdl" +#include "test/codemaker/codemakertests/SequenceStruct.hdl" +#include "test/codemaker/codemakertests/SequenceType.hdl" +#include "test/codemaker/codemakertests/SequenceUnsignedHyper.hdl" +#include "test/codemaker/codemakertests/SequenceUnsignedLong.hdl" +#include "test/codemaker/codemakertests/SequenceUnsignedShort.hdl" +#include "test/codemaker/codemakertests/SequenceXInterface.hdl" +#include "test/codemaker/codemakertests/SequenceXNamingService.hdl" +#include "test/codemaker/codemakertests/Short.hdl" +#include "test/codemaker/codemakertests/String.hdl" +#include "test/codemaker/codemakertests/Struct.hdl" +#include "test/codemaker/codemakertests/Struct1.hdl" +#include "test/codemaker/codemakertests/Type.hdl" +#include "test/codemaker/codemakertests/UnsignedHyper.hdl" +#include "test/codemaker/codemakertests/UnsignedLong.hdl" +#include "test/codemaker/codemakertests/UnsignedShort.hdl" +#include "test/codemaker/codemakertests/XInterface.hdl" +#include "test/codemaker/codemakertests/XNamingService.hdl" +#include "com/sun/star/uno/Any.h" +#include "com/sun/star/uno/Reference.h" +#include "com/sun/star/uno/Sequence.h" +#include "com/sun/star/uno/Type.h" +#include "cppu/macros.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +namespace com { namespace sun { namespace star { namespace uno { class Type; } } } } + +namespace test { namespace codemaker { namespace codemakertests { + +#ifdef _WIN32 +# pragma pack(push, 8) +#endif + +struct SAL_DLLPUBLIC_RTTI Struct2 { + inline Struct2(); + + inline Struct2(const ::sal_Bool& p1_, const ::sal_Int8& p2_, const ::sal_Int16& p3_, const ::sal_uInt16& p4_, const ::sal_Int32& p5_, const ::sal_uInt32& p6_, const ::sal_Int64& p7_, const ::sal_uInt64& p8_, const float& p9_, const double& p10_, const ::sal_Unicode& p11_, const ::rtl::OUString& p12_, const ::css::uno::Type& p13_, const ::css::uno::Any& p14_, const ::test::codemaker::codemakertests::Enum2& p15_, const ::test::codemaker::codemakertests::Struct1& p16_, const ::css::uno::Reference< ::css::uno::XInterface >& p17_, const ::css::uno::Reference< ::css::uno::XNamingService >& p18_, const ::sal_Bool& t1_, const ::sal_Int8& t2_, const ::sal_Int16& t3_, const ::sal_uInt16& t4_, const ::sal_Int32& t5_, const ::sal_uInt32& t6_, const ::sal_Int64& t7_, const ::sal_uInt64& t8_, const float& t9_, const double& t10_, const ::sal_Unicode& t11_, const ::rtl::OUString& t12_, const ::css::uno::Type& t13_, const ::css::uno::Any& t14_, const ::test::codemaker::codemakertests::Enum2& t15_, const ::test::codemaker::codemakertests::Struct1& t16_, const ::css::uno::Reference< ::css::uno::XInterface >& t17_, const ::css::uno::Reference< ::css::uno::XNamingService >& t18_, const ::css::uno::Sequence< ::sal_Bool >& a1_, const ::css::uno::Sequence< ::sal_Int8 >& a2_, const ::css::uno::Sequence< ::sal_Int16 >& a3_, const ::css::uno::Sequence< ::sal_uInt16 >& a4_, const ::css::uno::Sequence< ::sal_Int32 >& a5_, const ::css::uno::Sequence< ::sal_uInt32 >& a6_, const ::css::uno::Sequence< ::sal_Int64 >& a7_, const ::css::uno::Sequence< ::sal_uInt64 >& a8_, const ::css::uno::Sequence< float >& a9_, const ::css::uno::Sequence< double >& a10_, const ::css::uno::Sequence< ::sal_Unicode >& a11_, const ::css::uno::Sequence< ::rtl::OUString >& a12_, const ::css::uno::Sequence< ::css::uno::Type >& a13_, const ::css::uno::Sequence< ::css::uno::Any >& a14_, const ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 >& a15_, const ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 >& a16_, const ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > >& a17_, const ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > >& a18_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Bool > >& aa1_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int8 > >& aa2_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int16 > >& aa3_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt16 > >& aa4_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int32 > >& aa5_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt32 > >& aa6_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int64 > >& aa7_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt64 > >& aa8_, const ::css::uno::Sequence< ::css::uno::Sequence< float > >& aa9_, const ::css::uno::Sequence< ::css::uno::Sequence< double > >& aa10_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Unicode > >& aa11_, const ::css::uno::Sequence< ::css::uno::Sequence< ::rtl::OUString > >& aa12_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Type > >& aa13_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Any > >& aa14_, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 > >& aa15_, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 > >& aa16_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > >& aa17_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > > >& aa18_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Bool > >& at1_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int8 > >& at2_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int16 > >& at3_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt16 > >& at4_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int32 > >& at5_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt32 > >& at6_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int64 > >& at7_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt64 > >& at8_, const ::css::uno::Sequence< ::css::uno::Sequence< float > >& at9_, const ::css::uno::Sequence< ::css::uno::Sequence< double > >& at10_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Unicode > >& at11_, const ::css::uno::Sequence< ::css::uno::Sequence< ::rtl::OUString > >& at12_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Type > >& at13_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Any > >& at14_, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 > >& at15_, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 > >& at16_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > >& at17_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > > >& at18_); + + ::sal_Bool p1; + ::sal_Int8 p2; + ::sal_Int16 p3; + ::sal_uInt16 p4; + ::sal_Int32 p5; + ::sal_uInt32 p6; + ::sal_Int64 p7; + ::sal_uInt64 p8; + float p9; + double p10; + ::sal_Unicode p11; + ::rtl::OUString p12; + ::css::uno::Type p13; + ::css::uno::Any p14; + ::test::codemaker::codemakertests::Enum2 p15; + ::test::codemaker::codemakertests::Struct1 p16; + ::css::uno::Reference< ::css::uno::XInterface > p17; + ::css::uno::Reference< ::css::uno::XNamingService > p18; + ::sal_Bool t1; + ::sal_Int8 t2; + ::sal_Int16 t3; + ::sal_uInt16 t4; + ::sal_Int32 t5; + ::sal_uInt32 t6; + ::sal_Int64 t7; + ::sal_uInt64 t8; + float t9; + double t10; + ::sal_Unicode t11; + ::rtl::OUString t12; + ::css::uno::Type t13; + ::css::uno::Any t14; + ::test::codemaker::codemakertests::Enum2 t15; + ::test::codemaker::codemakertests::Struct1 t16; + ::css::uno::Reference< ::css::uno::XInterface > t17; + ::css::uno::Reference< ::css::uno::XNamingService > t18; + ::css::uno::Sequence< ::sal_Bool > a1; + ::css::uno::Sequence< ::sal_Int8 > a2; + ::css::uno::Sequence< ::sal_Int16 > a3; + ::css::uno::Sequence< ::sal_uInt16 > a4; + ::css::uno::Sequence< ::sal_Int32 > a5; + ::css::uno::Sequence< ::sal_uInt32 > a6; + ::css::uno::Sequence< ::sal_Int64 > a7; + ::css::uno::Sequence< ::sal_uInt64 > a8; + ::css::uno::Sequence< float > a9; + ::css::uno::Sequence< double > a10; + ::css::uno::Sequence< ::sal_Unicode > a11; + ::css::uno::Sequence< ::rtl::OUString > a12; + ::css::uno::Sequence< ::css::uno::Type > a13; + ::css::uno::Sequence< ::css::uno::Any > a14; + ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 > a15; + ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 > a16; + ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > a17; + ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > > a18; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Bool > > aa1; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int8 > > aa2; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int16 > > aa3; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt16 > > aa4; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int32 > > aa5; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt32 > > aa6; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int64 > > aa7; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt64 > > aa8; + ::css::uno::Sequence< ::css::uno::Sequence< float > > aa9; + ::css::uno::Sequence< ::css::uno::Sequence< double > > aa10; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Unicode > > aa11; + ::css::uno::Sequence< ::css::uno::Sequence< ::rtl::OUString > > aa12; + ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Type > > aa13; + ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Any > > aa14; + ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 > > aa15; + ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 > > aa16; + ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > > aa17; + ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > > > aa18; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Bool > > at1; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int8 > > at2; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int16 > > at3; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt16 > > at4; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int32 > > at5; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt32 > > at6; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int64 > > at7; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt64 > > at8; + ::css::uno::Sequence< ::css::uno::Sequence< float > > at9; + ::css::uno::Sequence< ::css::uno::Sequence< double > > at10; + ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Unicode > > at11; + ::css::uno::Sequence< ::css::uno::Sequence< ::rtl::OUString > > at12; + ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Type > > at13; + ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Any > > at14; + ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 > > at15; + ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 > > at16; + ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > > at17; + ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > > > at18; +}; + +#ifdef _WIN32 +# pragma pack(pop) +#endif + + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Struct2 const *); +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(const ::test::codemaker::codemakertests::Struct2 *); + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct2.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct2.hpp new file mode 100644 index 000000000000..a2b79afd3ff3 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Struct2.hpp @@ -0,0 +1,454 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Struct2.hdl" + +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "test/codemaker/codemakertests/Any.hpp" +#include "test/codemaker/codemakertests/Boolean.hpp" +#include "test/codemaker/codemakertests/Byte.hpp" +#include "test/codemaker/codemakertests/Char.hpp" +#include "test/codemaker/codemakertests/Double.hpp" +#include "test/codemaker/codemakertests/Enum.hpp" +#include "test/codemaker/codemakertests/Enum2.hpp" +#include "test/codemaker/codemakertests/Float.hpp" +#include "test/codemaker/codemakertests/Hyper.hpp" +#include "test/codemaker/codemakertests/Long.hpp" +#include "test/codemaker/codemakertests/SequenceAny.hpp" +#include "test/codemaker/codemakertests/SequenceBoolean.hpp" +#include "test/codemaker/codemakertests/SequenceByte.hpp" +#include "test/codemaker/codemakertests/SequenceChar.hpp" +#include "test/codemaker/codemakertests/SequenceDouble.hpp" +#include "test/codemaker/codemakertests/SequenceEnum.hpp" +#include "test/codemaker/codemakertests/SequenceFloat.hpp" +#include "test/codemaker/codemakertests/SequenceHyper.hpp" +#include "test/codemaker/codemakertests/SequenceLong.hpp" +#include "test/codemaker/codemakertests/SequenceShort.hpp" +#include "test/codemaker/codemakertests/SequenceString.hpp" +#include "test/codemaker/codemakertests/SequenceStruct.hpp" +#include "test/codemaker/codemakertests/SequenceType.hpp" +#include "test/codemaker/codemakertests/SequenceUnsignedHyper.hpp" +#include "test/codemaker/codemakertests/SequenceUnsignedLong.hpp" +#include "test/codemaker/codemakertests/SequenceUnsignedShort.hpp" +#include "test/codemaker/codemakertests/SequenceXInterface.hpp" +#include "test/codemaker/codemakertests/SequenceXNamingService.hpp" +#include "test/codemaker/codemakertests/Short.hpp" +#include "test/codemaker/codemakertests/String.hpp" +#include "test/codemaker/codemakertests/Struct.hpp" +#include "test/codemaker/codemakertests/Struct1.hpp" +#include "test/codemaker/codemakertests/Type.hpp" +#include "test/codemaker/codemakertests/UnsignedHyper.hpp" +#include "test/codemaker/codemakertests/UnsignedLong.hpp" +#include "test/codemaker/codemakertests/UnsignedShort.hpp" +#include "test/codemaker/codemakertests/XInterface.hpp" +#include "test/codemaker/codemakertests/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "typelib/typeclass.h" +#include "typelib/typedescription.h" + +namespace test { namespace codemaker { namespace codemakertests { + +inline Struct2::Struct2() + : p1(false) + , p2(0) + , p3(0) + , p4(0) + , p5(0) + , p6(0) + , p7(0) + , p8(0) + , p9(0) + , p10(0) + , p11(0) + , p12() + , p13() + , p14() + , p15(::test::codemaker::codemakertests::Enum2_FLAG_NONE) + , p16() + , p17() + , p18() + , t1(false) + , t2(0) + , t3(0) + , t4(0) + , t5(0) + , t6(0) + , t7(0) + , t8(0) + , t9(0) + , t10(0) + , t11(0) + , t12() + , t13() + , t14() + , t15(::test::codemaker::codemakertests::Enum2_FLAG_NONE) + , t16() + , t17() + , t18() + , a1() + , a2() + , a3() + , a4() + , a5() + , a6() + , a7() + , a8() + , a9() + , a10() + , a11() + , a12() + , a13() + , a14() + , a15() + , a16() + , a17() + , a18() + , aa1() + , aa2() + , aa3() + , aa4() + , aa5() + , aa6() + , aa7() + , aa8() + , aa9() + , aa10() + , aa11() + , aa12() + , aa13() + , aa14() + , aa15() + , aa16() + , aa17() + , aa18() + , at1() + , at2() + , at3() + , at4() + , at5() + , at6() + , at7() + , at8() + , at9() + , at10() + , at11() + , at12() + , at13() + , at14() + , at15() + , at16() + , at17() + , at18() +{ +} + +inline Struct2::Struct2(const ::sal_Bool& p1_, const ::sal_Int8& p2_, const ::sal_Int16& p3_, const ::sal_uInt16& p4_, const ::sal_Int32& p5_, const ::sal_uInt32& p6_, const ::sal_Int64& p7_, const ::sal_uInt64& p8_, const float& p9_, const double& p10_, const ::sal_Unicode& p11_, const ::rtl::OUString& p12_, const ::css::uno::Type& p13_, const ::css::uno::Any& p14_, const ::test::codemaker::codemakertests::Enum2& p15_, const ::test::codemaker::codemakertests::Struct1& p16_, const ::css::uno::Reference< ::css::uno::XInterface >& p17_, const ::css::uno::Reference< ::css::uno::XNamingService >& p18_, const ::sal_Bool& t1_, const ::sal_Int8& t2_, const ::sal_Int16& t3_, const ::sal_uInt16& t4_, const ::sal_Int32& t5_, const ::sal_uInt32& t6_, const ::sal_Int64& t7_, const ::sal_uInt64& t8_, const float& t9_, const double& t10_, const ::sal_Unicode& t11_, const ::rtl::OUString& t12_, const ::css::uno::Type& t13_, const ::css::uno::Any& t14_, const ::test::codemaker::codemakertests::Enum2& t15_, const ::test::codemaker::codemakertests::Struct1& t16_, const ::css::uno::Reference< ::css::uno::XInterface >& t17_, const ::css::uno::Reference< ::css::uno::XNamingService >& t18_, const ::css::uno::Sequence< ::sal_Bool >& a1_, const ::css::uno::Sequence< ::sal_Int8 >& a2_, const ::css::uno::Sequence< ::sal_Int16 >& a3_, const ::css::uno::Sequence< ::sal_uInt16 >& a4_, const ::css::uno::Sequence< ::sal_Int32 >& a5_, const ::css::uno::Sequence< ::sal_uInt32 >& a6_, const ::css::uno::Sequence< ::sal_Int64 >& a7_, const ::css::uno::Sequence< ::sal_uInt64 >& a8_, const ::css::uno::Sequence< float >& a9_, const ::css::uno::Sequence< double >& a10_, const ::css::uno::Sequence< ::sal_Unicode >& a11_, const ::css::uno::Sequence< ::rtl::OUString >& a12_, const ::css::uno::Sequence< ::css::uno::Type >& a13_, const ::css::uno::Sequence< ::css::uno::Any >& a14_, const ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 >& a15_, const ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 >& a16_, const ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > >& a17_, const ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > >& a18_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Bool > >& aa1_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int8 > >& aa2_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int16 > >& aa3_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt16 > >& aa4_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int32 > >& aa5_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt32 > >& aa6_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int64 > >& aa7_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt64 > >& aa8_, const ::css::uno::Sequence< ::css::uno::Sequence< float > >& aa9_, const ::css::uno::Sequence< ::css::uno::Sequence< double > >& aa10_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Unicode > >& aa11_, const ::css::uno::Sequence< ::css::uno::Sequence< ::rtl::OUString > >& aa12_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Type > >& aa13_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Any > >& aa14_, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 > >& aa15_, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 > >& aa16_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > >& aa17_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > > >& aa18_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Bool > >& at1_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int8 > >& at2_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int16 > >& at3_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt16 > >& at4_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int32 > >& at5_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt32 > >& at6_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Int64 > >& at7_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_uInt64 > >& at8_, const ::css::uno::Sequence< ::css::uno::Sequence< float > >& at9_, const ::css::uno::Sequence< ::css::uno::Sequence< double > >& at10_, const ::css::uno::Sequence< ::css::uno::Sequence< ::sal_Unicode > >& at11_, const ::css::uno::Sequence< ::css::uno::Sequence< ::rtl::OUString > >& at12_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Type > >& at13_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Any > >& at14_, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Enum2 > >& at15_, const ::css::uno::Sequence< ::css::uno::Sequence< ::test::codemaker::codemakertests::Struct1 > >& at16_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > >& at17_, const ::css::uno::Sequence< ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XNamingService > > >& at18_) + : p1(p1_) + , p2(p2_) + , p3(p3_) + , p4(p4_) + , p5(p5_) + , p6(p6_) + , p7(p7_) + , p8(p8_) + , p9(p9_) + , p10(p10_) + , p11(p11_) + , p12(p12_) + , p13(p13_) + , p14(p14_) + , p15(p15_) + , p16(p16_) + , p17(p17_) + , p18(p18_) + , t1(t1_) + , t2(t2_) + , t3(t3_) + , t4(t4_) + , t5(t5_) + , t6(t6_) + , t7(t7_) + , t8(t8_) + , t9(t9_) + , t10(t10_) + , t11(t11_) + , t12(t12_) + , t13(t13_) + , t14(t14_) + , t15(t15_) + , t16(t16_) + , t17(t17_) + , t18(t18_) + , a1(a1_) + , a2(a2_) + , a3(a3_) + , a4(a4_) + , a5(a5_) + , a6(a6_) + , a7(a7_) + , a8(a8_) + , a9(a9_) + , a10(a10_) + , a11(a11_) + , a12(a12_) + , a13(a13_) + , a14(a14_) + , a15(a15_) + , a16(a16_) + , a17(a17_) + , a18(a18_) + , aa1(aa1_) + , aa2(aa2_) + , aa3(aa3_) + , aa4(aa4_) + , aa5(aa5_) + , aa6(aa6_) + , aa7(aa7_) + , aa8(aa8_) + , aa9(aa9_) + , aa10(aa10_) + , aa11(aa11_) + , aa12(aa12_) + , aa13(aa13_) + , aa14(aa14_) + , aa15(aa15_) + , aa16(aa16_) + , aa17(aa17_) + , aa18(aa18_) + , at1(at1_) + , at2(at2_) + , at3(at3_) + , at4(at4_) + , at5(at5_) + , at6(at6_) + , at7(at7_) + , at8(at8_) + , at9(at9_) + , at10(at10_) + , at11(at11_) + , at12(at12_) + , at13(at13_) + , at14(at14_) + , at15(at15_) + , at16(at16_) + , at17(at17_) + , at18(at18_) +{ +} + + +inline bool operator==(const Struct2& the_lhs, const Struct2& the_rhs) +{ + return the_lhs.p1 == the_rhs.p1 + && the_lhs.p2 == the_rhs.p2 + && the_lhs.p3 == the_rhs.p3 + && the_lhs.p4 == the_rhs.p4 + && the_lhs.p5 == the_rhs.p5 + && the_lhs.p6 == the_rhs.p6 + && the_lhs.p7 == the_rhs.p7 + && the_lhs.p8 == the_rhs.p8 + && the_lhs.p9 == the_rhs.p9 + && the_lhs.p10 == the_rhs.p10 + && the_lhs.p11 == the_rhs.p11 + && the_lhs.p12 == the_rhs.p12 + && the_lhs.p13 == the_rhs.p13 + && the_lhs.p14 == the_rhs.p14 + && the_lhs.p15 == the_rhs.p15 + && the_lhs.p16 == the_rhs.p16 + && the_lhs.p17 == the_rhs.p17 + && the_lhs.p18 == the_rhs.p18 + && the_lhs.t1 == the_rhs.t1 + && the_lhs.t2 == the_rhs.t2 + && the_lhs.t3 == the_rhs.t3 + && the_lhs.t4 == the_rhs.t4 + && the_lhs.t5 == the_rhs.t5 + && the_lhs.t6 == the_rhs.t6 + && the_lhs.t7 == the_rhs.t7 + && the_lhs.t8 == the_rhs.t8 + && the_lhs.t9 == the_rhs.t9 + && the_lhs.t10 == the_rhs.t10 + && the_lhs.t11 == the_rhs.t11 + && the_lhs.t12 == the_rhs.t12 + && the_lhs.t13 == the_rhs.t13 + && the_lhs.t14 == the_rhs.t14 + && the_lhs.t15 == the_rhs.t15 + && the_lhs.t16 == the_rhs.t16 + && the_lhs.t17 == the_rhs.t17 + && the_lhs.t18 == the_rhs.t18 + && the_lhs.a1 == the_rhs.a1 + && the_lhs.a2 == the_rhs.a2 + && the_lhs.a3 == the_rhs.a3 + && the_lhs.a4 == the_rhs.a4 + && the_lhs.a5 == the_rhs.a5 + && the_lhs.a6 == the_rhs.a6 + && the_lhs.a7 == the_rhs.a7 + && the_lhs.a8 == the_rhs.a8 + && the_lhs.a9 == the_rhs.a9 + && the_lhs.a10 == the_rhs.a10 + && the_lhs.a11 == the_rhs.a11 + && the_lhs.a12 == the_rhs.a12 + && the_lhs.a13 == the_rhs.a13 + && the_lhs.a14 == the_rhs.a14 + && the_lhs.a15 == the_rhs.a15 + && the_lhs.a16 == the_rhs.a16 + && the_lhs.a17 == the_rhs.a17 + && the_lhs.a18 == the_rhs.a18 + && the_lhs.aa1 == the_rhs.aa1 + && the_lhs.aa2 == the_rhs.aa2 + && the_lhs.aa3 == the_rhs.aa3 + && the_lhs.aa4 == the_rhs.aa4 + && the_lhs.aa5 == the_rhs.aa5 + && the_lhs.aa6 == the_rhs.aa6 + && the_lhs.aa7 == the_rhs.aa7 + && the_lhs.aa8 == the_rhs.aa8 + && the_lhs.aa9 == the_rhs.aa9 + && the_lhs.aa10 == the_rhs.aa10 + && the_lhs.aa11 == the_rhs.aa11 + && the_lhs.aa12 == the_rhs.aa12 + && the_lhs.aa13 == the_rhs.aa13 + && the_lhs.aa14 == the_rhs.aa14 + && the_lhs.aa15 == the_rhs.aa15 + && the_lhs.aa16 == the_rhs.aa16 + && the_lhs.aa17 == the_rhs.aa17 + && the_lhs.aa18 == the_rhs.aa18 + && the_lhs.at1 == the_rhs.at1 + && the_lhs.at2 == the_rhs.at2 + && the_lhs.at3 == the_rhs.at3 + && the_lhs.at4 == the_rhs.at4 + && the_lhs.at5 == the_rhs.at5 + && the_lhs.at6 == the_rhs.at6 + && the_lhs.at7 == the_rhs.at7 + && the_lhs.at8 == the_rhs.at8 + && the_lhs.at9 == the_rhs.at9 + && the_lhs.at10 == the_rhs.at10 + && the_lhs.at11 == the_rhs.at11 + && the_lhs.at12 == the_rhs.at12 + && the_lhs.at13 == the_rhs.at13 + && the_lhs.at14 == the_rhs.at14 + && the_lhs.at15 == the_rhs.at15 + && the_lhs.at16 == the_rhs.at16 + && the_lhs.at17 == the_rhs.at17 + && the_lhs.at18 == the_rhs.at18; +} + +inline bool operator!=(const Struct2& the_lhs, const Struct2& the_rhs) +{ +return !operator==(the_lhs, the_rhs); +} +} } } + +namespace test { namespace codemaker { namespace codemakertests { + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Struct2 const *) { + //TODO: On certain platforms with weak memory models, the following code can result in some threads observing that the_type points to garbage + static ::typelib_TypeDescriptionReference * the_type = 0; + if (the_type == 0) { + ::typelib_TypeDescriptionReference * the_members[] = { + ::cppu::UnoType< ::sal_Bool >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_Int8 >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_Int16 >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_Int32 >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_uInt32 >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_Int64 >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_uInt64 >::get().getTypeLibType(), + ::cppu::UnoType< float >::get().getTypeLibType(), + ::cppu::UnoType< double >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoCharType >::get().getTypeLibType(), + ::cppu::UnoType< ::rtl::OUString >::get().getTypeLibType(), + ::cppu::UnoType< ::css::uno::Type >::get().getTypeLibType(), + ::cppu::UnoType< ::css::uno::Any >::get().getTypeLibType(), + ::cppu::UnoType< ::test::codemaker::codemakertests::Enum2 >::get().getTypeLibType(), + ::cppu::UnoType< ::test::codemaker::codemakertests::Struct1 >::get().getTypeLibType(), + ::cppu::UnoType< ::css::uno::Reference< ::css::uno::XInterface > >::get().getTypeLibType(), + ::cppu::UnoType< ::css::uno::Reference< ::css::uno::XNamingService > >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_Bool >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_Int8 >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_Int16 >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_Int32 >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_uInt32 >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_Int64 >::get().getTypeLibType(), + ::cppu::UnoType< ::sal_uInt64 >::get().getTypeLibType(), + ::cppu::UnoType< float >::get().getTypeLibType(), + ::cppu::UnoType< double >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoCharType >::get().getTypeLibType(), + ::cppu::UnoType< ::rtl::OUString >::get().getTypeLibType(), + ::cppu::UnoType< ::css::uno::Type >::get().getTypeLibType(), + ::cppu::UnoType< ::css::uno::Any >::get().getTypeLibType(), + ::cppu::UnoType< ::test::codemaker::codemakertests::Enum2 >::get().getTypeLibType(), + ::cppu::UnoType< ::test::codemaker::codemakertests::Struct1 >::get().getTypeLibType(), + ::cppu::UnoType< ::css::uno::Reference< ::css::uno::XInterface > >::get().getTypeLibType(), + ::cppu::UnoType< ::css::uno::Reference< ::css::uno::XNamingService > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::sal_Bool > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::sal_Int8 > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::sal_Int16 > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::sal_Int32 > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::sal_uInt32 > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::sal_Int64 > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::sal_uInt64 > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< float > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< double > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoCharType > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::rtl::OUString > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::css::uno::Type > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::css::uno::Any > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::test::codemaker::codemakertests::Enum2 > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::test::codemaker::codemakertests::Struct1 > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::css::uno::Reference< ::css::uno::XInterface > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::css::uno::Reference< ::css::uno::XNamingService > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_Bool > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_Int8 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_Int16 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_Int32 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_uInt32 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_Int64 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_uInt64 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< float > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< double > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::cppu::UnoCharType > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::rtl::OUString > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::css::uno::Type > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::css::uno::Any > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::test::codemaker::codemakertests::Enum2 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::test::codemaker::codemakertests::Struct1 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::css::uno::Reference< ::css::uno::XInterface > > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::css::uno::Reference< ::css::uno::XNamingService > > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_Bool > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_Int8 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_Int16 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_Int32 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_uInt32 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_Int64 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::sal_uInt64 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< float > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< double > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::cppu::UnoCharType > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::rtl::OUString > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::css::uno::Type > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::css::uno::Any > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::test::codemaker::codemakertests::Enum2 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::test::codemaker::codemakertests::Struct1 > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::css::uno::Reference< ::css::uno::XInterface > > > >::get().getTypeLibType(), + ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType< ::css::uno::Reference< ::css::uno::XNamingService > > > >::get().getTypeLibType() }; + ::typelib_static_struct_type_init(&the_type, "test.codemaker.codemakertests.Struct2", 0, 90, the_members, 0); + } + return *reinterpret_cast< ::css::uno::Type * >(&the_type); +} + +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::Struct2 const *) { + return ::cppu::UnoType< ::test::codemaker::codemakertests::Struct2 >::get(); +} diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/TestConstantsBasic.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/TestConstantsBasic.hdl new file mode 100644 index 000000000000..332ab7603299 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/TestConstantsBasic.hdl @@ -0,0 +1,22 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace test { namespace codemaker { namespace codemakertests { namespace TestConstantsBasic { + +static const ::sal_Bool BOOL_FALSE = sal_False; +static const ::sal_Bool BOOL_TRUE = sal_True; +static const ::sal_Int64 HYPER_MAX = (sal_Int64) SAL_CONST_INT64(9223372036854775807); +static const ::sal_Int64 HYPER_MIN = SAL_MIN_INT64; +static const ::sal_Int32 LONG_HEX = (sal_Int32)2147483647; +static const ::sal_Int32 LONG_MAX = (sal_Int32)2147483647; +static const ::sal_Int32 LONG_MIN = SAL_MIN_INT32; +static const ::sal_Int16 SHORT_MAX = (sal_Int16)32767; +static const ::sal_Int16 SHORT_MIN = (sal_Int16)-32768; +static const ::sal_uInt32 ULONG_MAX = (sal_uInt32)4294967295U; +static const ::sal_uInt16 USHORT_MAX = (sal_uInt16)65535; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/TestConstantsBasic.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/TestConstantsBasic.hpp new file mode 100644 index 000000000000..63aae64a2f3c --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/TestConstantsBasic.hpp @@ -0,0 +1,3 @@ +#pragma once + +#include "test/codemaker/codemakertests/TestConstantsBasic.hdl" diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Type.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Type.hdl new file mode 100644 index 000000000000..d8516ce00693 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Type.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "com/sun/star/uno/Type.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Type Type; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Type.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Type.hpp new file mode 100644 index 000000000000..17ce82f69d30 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/Type.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/Type.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedHyper.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedHyper.hdl new file mode 100644 index 000000000000..27ff48af6441 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedHyper.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::sal_uInt64 UnsignedHyper; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedHyper.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedHyper.hpp new file mode 100644 index 000000000000..5dcc616ecb57 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedHyper.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/UnsignedHyper.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedLong.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedLong.hdl new file mode 100644 index 000000000000..bc9536672e02 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedLong.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::sal_uInt32 UnsignedLong; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedLong.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedLong.hpp new file mode 100644 index 000000000000..64081d134992 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedLong.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/UnsignedLong.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedShort.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedShort.hdl new file mode 100644 index 000000000000..f28935c98453 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedShort.hdl @@ -0,0 +1,12 @@ +#pragma once + +#include "sal/config.h" + +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::sal_uInt16 UnsignedShort; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedShort.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedShort.hpp new file mode 100644 index 000000000000..db6796a83954 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/UnsignedShort.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/UnsignedShort.hdl" + +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XIfc.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XIfc.hdl new file mode 100644 index 000000000000..d76f1e224e15 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XIfc.hdl @@ -0,0 +1,43 @@ +#pragma once + +#include "sal/config.h" + +#include "com/sun/star/uno/XInterface.hdl" +#include "test/codemaker/codemakertests/PolyStruct.hdl" +#include "com/sun/star/uno/Any.h" +#include "com/sun/star/uno/Reference.h" +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace com { namespace sun { namespace star { namespace uno { class Type; } } } } + +namespace test { namespace codemaker { namespace codemakertests { + +class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI XIfc : public ::css::uno::XInterface +{ +public: +#if defined LIBO_INTERNAL_ONLY + XIfc() = default; + XIfc(XIfc const &) = default; + XIfc(XIfc &&) = default; + XIfc & operator =(XIfc const &) = default; + XIfc & operator =(XIfc &&) = default; +#endif + + + // Methods + virtual void SAL_CALL f1( const ::test::codemaker::codemakertests::PolyStruct< ::sal_Int32, ::sal_Int32 >& arg ) = 0; + virtual void SAL_CALL f2( const ::test::codemaker::codemakertests::PolyStruct< ::css::uno::Any, ::css::uno::Reference< ::css::uno::XInterface > >& arg ) = 0; + + static inline ::css::uno::Type const & SAL_CALL static_type(void * = 0); + +protected: + ~XIfc() SAL_NOEXCEPT {} // avoid warnings about virtual members and non-virtual dtor +}; + + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::XIfc const *); +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(const ::css::uno::Reference< ::test::codemaker::codemakertests::XIfc > *); + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XIfc.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XIfc.hpp new file mode 100644 index 000000000000..e1ebcb8068a7 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XIfc.hpp @@ -0,0 +1,45 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/XIfc.hdl" + +#include "com/sun/star/uno/XInterface.hpp" +#include "test/codemaker/codemakertests/PolyStruct.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" + +#if defined LIBO_INTERNAL_ONLY +#include +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::XIfc const *) { + static typelib_TypeDescriptionReference * the_type = 0; + if ( !the_type ) + { + typelib_static_mi_interface_type_init( &the_type, "test.codemaker.codemakertests.XIfc", 0, 0 ); + } + return * reinterpret_cast< ::css::uno::Type * >( &the_type ); +} + +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::css::uno::Reference< ::test::codemaker::codemakertests::XIfc > const *) { + return ::cppu::UnoType< ::css::uno::Reference< ::test::codemaker::codemakertests::XIfc > >::get(); +} + +::css::uno::Type const & ::test::codemaker::codemakertests::XIfc::static_type(SAL_UNUSED_PARAMETER void *) { + return ::cppu::UnoType< ::test::codemaker::codemakertests::XIfc >::get(); +} + +#if defined LIBO_INTERNAL_ONLY +namespace cppu::detail { +template<> struct IsUnoInterfaceType<::test::codemaker::codemakertests::XIfc>: ::std::true_type {}; +} +#endif + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XInterface.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XInterface.hdl new file mode 100644 index 000000000000..70c736395bff --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XInterface.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +namespace com { namespace sun { namespace star { namespace uno { class XInterface; } } } } +#include "com/sun/star/uno/Reference.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Reference< ::css::uno::XInterface > XInterface; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XInterface.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XInterface.hpp new file mode 100644 index 000000000000..ded0aaf41655 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XInterface.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/XInterface.hdl" + +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XNamingService.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XNamingService.hdl new file mode 100644 index 000000000000..713af2fa44e6 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XNamingService.hdl @@ -0,0 +1,13 @@ +#pragma once + +#include "sal/config.h" + +namespace com { namespace sun { namespace star { namespace uno { class XNamingService; } } } } +#include "com/sun/star/uno/Reference.h" +#include "cppu/macros.hxx" + +namespace test { namespace codemaker { namespace codemakertests { + +typedef ::css::uno::Reference< ::css::uno::XNamingService > XNamingService; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XNamingService.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XNamingService.hpp new file mode 100644 index 000000000000..5c22fbf3bc3c --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XNamingService.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/XNamingService.hdl" + +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XTest.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XTest.hdl new file mode 100644 index 000000000000..e2ca4701052c --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XTest.hdl @@ -0,0 +1,48 @@ +#pragma once + +#include "sal/config.h" + +#include "com/sun/star/uno/XInterface.hdl" +#include "com/sun/star/uno/Reference.h" +#include "cppu/macros.hxx" +#include "sal/types.h" + +namespace com { namespace sun { namespace star { namespace uno { class Type; } } } } + +namespace test { namespace codemaker { namespace codemakertests { + +class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI XTest : public ::css::uno::XInterface +{ +public: +#if defined LIBO_INTERNAL_ONLY + XTest() = default; + XTest(XTest const &) = default; + XTest(XTest &&) = default; + XTest & operator =(XTest const &) = default; + XTest & operator =(XTest &&) = default; +#endif + + + // Attributes + virtual ::sal_Int32 SAL_CALL getA1() = 0; + virtual void SAL_CALL setA1( ::sal_Int32 _a1 ) = 0; + virtual ::sal_Int32 SAL_CALL getA2() = 0; + virtual ::sal_Int32 SAL_CALL getA3() = 0; + virtual void SAL_CALL setA3( ::sal_Int32 _a3 ) = 0; + virtual ::sal_Int32 SAL_CALL getA4() = 0; + + // Methods + virtual ::sal_Bool SAL_CALL test() = 0; + + static inline ::css::uno::Type const & SAL_CALL static_type(void * = 0); + +protected: + ~XTest() SAL_NOEXCEPT {} // avoid warnings about virtual members and non-virtual dtor +}; + + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::XTest const *); +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(const ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > *); + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XTest.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XTest.hpp new file mode 100644 index 000000000000..f7d2c66d416c --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/XTest.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/XTest.hdl" + +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "sal/types.h" + +#if defined LIBO_INTERNAL_ONLY +#include +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::XTest const *) { + static typelib_TypeDescriptionReference * the_type = 0; + if ( !the_type ) + { + typelib_static_mi_interface_type_init( &the_type, "test.codemaker.codemakertests.XTest", 0, 0 ); + } + return * reinterpret_cast< ::css::uno::Type * >( &the_type ); +} + +} } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > const *) { + return ::cppu::UnoType< ::css::uno::Reference< ::test::codemaker::codemakertests::XTest > >::get(); +} + +::css::uno::Type const & ::test::codemaker::codemakertests::XTest::static_type(SAL_UNUSED_PARAMETER void *) { + return ::cppu::UnoType< ::test::codemaker::codemakertests::XTest >::get(); +} + +#if defined LIBO_INTERNAL_ONLY +namespace cppu::detail { +template<> struct IsUnoInterfaceType<::test::codemaker::codemakertests::XTest>: ::std::true_type {}; +} +#endif + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/abstract.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/abstract.hpp new file mode 100644 index 000000000000..21893cf1feb4 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/abstract.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_abstract && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_abstract) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_abstract +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_abstract(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class abstract { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_abstract && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_abstract) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_abstract + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_abstract)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.abstract" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.abstract of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + abstract(); // not implemented + abstract(abstract &); // not implemented + ~abstract(); // not implemented + void operator =(abstract); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/assert.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/assert.hpp new file mode 100644 index 000000000000..c85e484e9558 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/assert.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_assert && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_assert) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_assert +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_assert(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_assert { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_assert && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_assert) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_assert + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_assert)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.assert" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.assert of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_assert(); // not implemented + singleton_assert(singleton_assert &); // not implemented + ~singleton_assert(); // not implemented + void operator =(singleton_assert); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/break.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/break.hpp new file mode 100644 index 000000000000..005d9a787f14 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/break.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_break && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_break) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_break +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_break(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_break { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_break && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_break) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_break + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_break)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.break" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.break of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_break(); // not implemented + singleton_break(singleton_break &); // not implemented + ~singleton_break(); // not implemented + void operator =(singleton_break); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/catch.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/catch.hpp new file mode 100644 index 000000000000..3caeb2139b30 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/catch.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_catch && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_catch) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_catch +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_catch(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_catch { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_catch && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_catch) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_catch + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_catch)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.catch" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.catch of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_catch(); // not implemented + singleton_catch(singleton_catch &); // not implemented + ~singleton_catch(); // not implemented + void operator =(singleton_catch); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/class.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/class.hpp new file mode 100644 index 000000000000..ce1e9473a17a --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/class.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_class && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_class) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_class +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_class(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_class { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_class && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_class) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_class + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_class)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.class" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.class of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_class(); // not implemented + singleton_class(singleton_class &); // not implemented + ~singleton_class(); // not implemented + void operator =(singleton_class); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/continue.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/continue.hpp new file mode 100644 index 000000000000..0df5128d1992 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/continue.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_continue && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_continue) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_continue +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_continue(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_continue { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_continue && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_continue) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_continue + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_continue)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.continue" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.continue of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_continue(); // not implemented + singleton_continue(singleton_continue &); // not implemented + ~singleton_continue(); // not implemented + void operator =(singleton_continue); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/do.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/do.hpp new file mode 100644 index 000000000000..d3161063c599 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/do.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_do && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_do) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_do +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_do(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_do { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_do && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_do) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_do + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_do)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.do" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.do of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_do(); // not implemented + singleton_do(singleton_do &); // not implemented + ~singleton_do(); // not implemented + void operator =(singleton_do); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/else.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/else.hpp new file mode 100644 index 000000000000..524848708cb3 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/else.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_else && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_else) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_else +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_else(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_else { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_else && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_else) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_else + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_else)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.else" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.else of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_else(); // not implemented + singleton_else(singleton_else &); // not implemented + ~singleton_else(); // not implemented + void operator =(singleton_else); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/MyBaseError.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/MyBaseError.hdl new file mode 100644 index 000000000000..183aeaf624e8 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/MyBaseError.hdl @@ -0,0 +1,46 @@ +#pragma once + +#include "sal/config.h" + +#include "com/sun/star/uno/Exception.hdl" +#include "cppu/macros.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +namespace com { namespace sun { namespace star { namespace uno { class Type; } } } } + +namespace test { namespace codemaker { namespace codemakertests { namespace exceptions { + +class CPPU_GCC_DLLPUBLIC_EXPORT SAL_WARN_UNUSED MyBaseError : public ::css::uno::Exception +{ +public: + inline CPPU_GCC_DLLPRIVATE MyBaseError( +#if defined LIBO_USE_SOURCE_LOCATION + o3tl::source_location location = o3tl::source_location::current() +#endif + ); + + inline CPPU_GCC_DLLPRIVATE MyBaseError(const ::rtl::OUString& Message_, const ::css::uno::Reference< ::css::uno::XInterface >& Context_, const ::sal_Int32& ErrorCode_, const ::rtl::OUString& Details_ +#if defined LIBO_USE_SOURCE_LOCATION + , o3tl::source_location location = o3tl::source_location::current() +#endif + ); + +#if !defined LIBO_INTERNAL_ONLY + inline CPPU_GCC_DLLPRIVATE MyBaseError(MyBaseError const &); + + inline CPPU_GCC_DLLPRIVATE ~MyBaseError(); + + inline CPPU_GCC_DLLPRIVATE MyBaseError & operator =(MyBaseError const &); +#endif + + ::sal_Int32 ErrorCode CPPU_GCC3_ALIGN( ::css::uno::Exception ); + ::rtl::OUString Details; +}; + + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::exceptions::MyBaseError const *); +} } } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(const ::test::codemaker::codemakertests::exceptions::MyBaseError *); + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/MyBaseError.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/MyBaseError.hpp new file mode 100644 index 000000000000..15806cc48220 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/MyBaseError.hpp @@ -0,0 +1,80 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/exceptions/MyBaseError.hdl" + +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +namespace test { namespace codemaker { namespace codemakertests { namespace exceptions { + +inline MyBaseError::MyBaseError( +#if defined LIBO_USE_SOURCE_LOCATION + o3tl::source_location location +#endif +) + : ::css::uno::Exception( +#if defined LIBO_USE_SOURCE_LOCATION + location +#endif +) + , ErrorCode(0) + , Details() +{ } + +inline MyBaseError::MyBaseError(const ::rtl::OUString& Message_, const ::css::uno::Reference< ::css::uno::XInterface >& Context_, const ::sal_Int32& ErrorCode_, const ::rtl::OUString& Details_ +#if defined LIBO_USE_SOURCE_LOCATION + , o3tl::source_location location +#endif +) + : ::css::uno::Exception(Message_, Context_ +#if defined LIBO_USE_SOURCE_LOCATION + , location +#endif +) + , ErrorCode(ErrorCode_) + , Details(Details_) +{ } + +#if !defined LIBO_INTERNAL_ONLY +MyBaseError::MyBaseError(MyBaseError const & the_other): ::css::uno::Exception(the_other), ErrorCode(the_other.ErrorCode), Details(the_other.Details) {} + +MyBaseError::~MyBaseError() {} + +MyBaseError & MyBaseError::operator =(MyBaseError const & the_other) { + //TODO: Just like its implicitly-defined counterpart, this function definition is not exception-safe + ::css::uno::Exception::operator =(the_other); + ErrorCode = the_other.ErrorCode; + Details = the_other.Details; + return *this; +} +#endif + +} } } } + +namespace test { namespace codemaker { namespace codemakertests { namespace exceptions { + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::exceptions::MyBaseError const *) { + static typelib_TypeDescriptionReference * the_type = 0; + if ( !the_type ) + { + typelib_TypeDescriptionReference * aMemberRefs[2]; + const ::css::uno::Type& rMemberType_long = ::cppu::UnoType< ::sal_Int32 >::get(); + aMemberRefs[0] = rMemberType_long.getTypeLibType(); + const ::css::uno::Type& rMemberType_string = ::cppu::UnoType< ::rtl::OUString >::get(); + aMemberRefs[1] = rMemberType_string.getTypeLibType(); + + typelib_static_compound_type_init( &the_type, typelib_TypeClass_EXCEPTION, "test.codemaker.codemakertests.exceptions.MyBaseError", * ::typelib_static_type_getByTypeClass( typelib_TypeClass_EXCEPTION ), 2, aMemberRefs ); + } + return * reinterpret_cast< const ::css::uno::Type * >( &the_type ); +} + +} } } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::exceptions::MyBaseError const *) { + return ::cppu::UnoType< ::test::codemaker::codemakertests::exceptions::MyBaseError >::get(); +} diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/SimpleError.hdl b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/SimpleError.hdl new file mode 100644 index 000000000000..827373c83b72 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/SimpleError.hdl @@ -0,0 +1,42 @@ +#pragma once + +#include "sal/config.h" + +#include "com/sun/star/uno/Exception.hdl" +#include "cppu/macros.hxx" + +namespace com { namespace sun { namespace star { namespace uno { class Type; } } } } + +namespace test { namespace codemaker { namespace codemakertests { namespace exceptions { + +class CPPU_GCC_DLLPUBLIC_EXPORT SAL_WARN_UNUSED SimpleError : public ::css::uno::Exception +{ +public: + inline CPPU_GCC_DLLPRIVATE SimpleError( +#if defined LIBO_USE_SOURCE_LOCATION + o3tl::source_location location = o3tl::source_location::current() +#endif + ); + + inline CPPU_GCC_DLLPRIVATE SimpleError(const ::rtl::OUString& Message_, const ::css::uno::Reference< ::css::uno::XInterface >& Context_ = ::css::uno::Reference< ::css::uno::XInterface >() +#if defined LIBO_USE_SOURCE_LOCATION + , o3tl::source_location location = o3tl::source_location::current() +#endif + ); + +#if !defined LIBO_INTERNAL_ONLY + inline CPPU_GCC_DLLPRIVATE SimpleError(SimpleError const &); + + inline CPPU_GCC_DLLPRIVATE ~SimpleError(); + + inline CPPU_GCC_DLLPRIVATE SimpleError & operator =(SimpleError const &); +#endif + +}; + + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::exceptions::SimpleError const *); +} } } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(const ::test::codemaker::codemakertests::exceptions::SimpleError *); + diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/SimpleError.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/SimpleError.hpp new file mode 100644 index 000000000000..2f0440752d8e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/exceptions/SimpleError.hpp @@ -0,0 +1,66 @@ +#pragma once + +#include "sal/config.h" + +#include "test/codemaker/codemakertests/exceptions/SimpleError.hdl" + +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Type.hxx" +#include "cppu/unotype.hxx" + +namespace test { namespace codemaker { namespace codemakertests { namespace exceptions { + +inline SimpleError::SimpleError( +#if defined LIBO_USE_SOURCE_LOCATION + o3tl::source_location location +#endif +) + : ::css::uno::Exception( +#if defined LIBO_USE_SOURCE_LOCATION + location +#endif +) +{ } + +inline SimpleError::SimpleError(const ::rtl::OUString& Message_, const ::css::uno::Reference< ::css::uno::XInterface >& Context_ +#if defined LIBO_USE_SOURCE_LOCATION + , o3tl::source_location location +#endif +) + : ::css::uno::Exception(Message_, Context_ +#if defined LIBO_USE_SOURCE_LOCATION + , location +#endif +) +{ } + +#if !defined LIBO_INTERNAL_ONLY +SimpleError::SimpleError(SimpleError const & the_other): ::css::uno::Exception(the_other) {} + +SimpleError::~SimpleError() {} + +SimpleError & SimpleError::operator =(SimpleError const & the_other) { + //TODO: Just like its implicitly-defined counterpart, this function definition is not exception-safe + ::css::uno::Exception::operator =(the_other); + return *this; +} +#endif + +} } } } + +namespace test { namespace codemaker { namespace codemakertests { namespace exceptions { + +inline ::css::uno::Type const & cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::exceptions::SimpleError const *) { + static typelib_TypeDescriptionReference * the_type = 0; + if ( !the_type ) + { + typelib_static_compound_type_init( &the_type, typelib_TypeClass_EXCEPTION, "test.codemaker.codemakertests.exceptions.SimpleError", * ::typelib_static_type_getByTypeClass( typelib_TypeClass_EXCEPTION ), 0, 0 ); + } + return * reinterpret_cast< const ::css::uno::Type * >( &the_type ); +} + +} } } } + +SAL_DEPRECATED("use cppu::UnoType") inline ::css::uno::Type const & SAL_CALL getCppuType(SAL_UNUSED_PARAMETER ::test::codemaker::codemakertests::exceptions::SimpleError const *) { + return ::cppu::UnoType< ::test::codemaker::codemakertests::exceptions::SimpleError >::get(); +} diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/extends.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/extends.hpp new file mode 100644 index 000000000000..075b8e6e8f1f --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/extends.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_extends && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_extends) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_extends +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_extends(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class extends { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_extends && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_extends) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_extends + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_extends)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.extends" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.extends of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + extends(); // not implemented + extends(extends &); // not implemented + ~extends(); // not implemented + void operator =(extends); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/final.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/final.hpp new file mode 100644 index 000000000000..4b45f4b57549 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/final.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_final && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_final) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_final +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_final(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class final { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_final && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_final) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_final + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_final)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.final" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.final of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + final(); // not implemented + final(final &); // not implemented + ~final(); // not implemented + void operator =(final); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/finally.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/finally.hpp new file mode 100644 index 000000000000..c9a19d9589c2 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/finally.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_finally && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_finally) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_finally +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_finally(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class finally { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_finally && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_finally) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_finally + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_finally)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.finally" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.finally of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + finally(); // not implemented + finally(finally &); // not implemented + ~finally(); // not implemented + void operator =(finally); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/for.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/for.hpp new file mode 100644 index 000000000000..090f325bc137 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/for.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_for && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_for) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_for +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_for(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_for { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_for && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_for) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_for + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_for)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.for" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.for of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_for(); // not implemented + singleton_for(singleton_for &); // not implemented + ~singleton_for(); // not implemented + void operator =(singleton_for); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/goto.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/goto.hpp new file mode 100644 index 000000000000..942f6e3f953f --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/goto.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_goto && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_goto) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_goto +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_goto(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_goto { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_goto && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_goto) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_goto + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_goto)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.goto" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.goto of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_goto(); // not implemented + singleton_goto(singleton_goto &); // not implemented + ~singleton_goto(); // not implemented + void operator =(singleton_goto); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/if.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/if.hpp new file mode 100644 index 000000000000..fb0b221b386c --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/if.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_if && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_if) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_if +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_if(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_if { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_if && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_if) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_if + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_if)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.if" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.if of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_if(); // not implemented + singleton_if(singleton_if &); // not implemented + ~singleton_if(); // not implemented + void operator =(singleton_if); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/implements.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/implements.hpp new file mode 100644 index 000000000000..4b1906be3e8a --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/implements.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_implements && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_implements) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_implements +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_implements(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class implements { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_implements && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_implements) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_implements + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_implements)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.implements" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.implements of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + implements(); // not implemented + implements(implements &); // not implemented + ~implements(); // not implemented + void operator =(implements); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/import.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/import.hpp new file mode 100644 index 000000000000..d834638b54db --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/import.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_import && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_import) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_import +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_import(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class import { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_import && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_import) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_import + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_import)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.import" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.import of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + import(); // not implemented + import(import &); // not implemented + ~import(); // not implemented + void operator =(import); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/instanceof.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/instanceof.hpp new file mode 100644 index 000000000000..f70d06f3a82f --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/instanceof.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_instanceof && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_instanceof) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_instanceof +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_instanceof(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class instanceof { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_instanceof && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_instanceof) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_instanceof + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_instanceof)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.instanceof" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.instanceof of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + instanceof(); // not implemented + instanceof(instanceof &); // not implemented + ~instanceof(); // not implemented + void operator =(instanceof); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/int.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/int.hpp new file mode 100644 index 000000000000..13c3d252b793 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/int.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_int && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_int) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_int +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_int(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_int { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_int && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_int) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_int + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_int)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.int" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.int of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_int(); // not implemented + singleton_int(singleton_int &); // not implemented + ~singleton_int(); // not implemented + void operator =(singleton_int); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/native.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/native.hpp new file mode 100644 index 000000000000..33e894ddfb0a --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/native.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_native && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_native) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_native +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_native(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class native { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_native && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_native) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_native + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_native)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.native" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.native of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + native(); // not implemented + native(native &); // not implemented + ~native(); // not implemented + void operator =(native); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/new.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/new.hpp new file mode 100644 index 000000000000..166cfcd2d305 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/new.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_new && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_new) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_new +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_new(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_new { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_new && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_new) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_new + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_new)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.new" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.new of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_new(); // not implemented + singleton_new(singleton_new &); // not implemented + ~singleton_new(); // not implemented + void operator =(singleton_new); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/package.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/package.hpp new file mode 100644 index 000000000000..513483c423bf --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/package.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_package && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_package) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_package +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_package(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class package { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_package && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_package) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_package + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_package)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.package" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.package of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + package(); // not implemented + package(package &); // not implemented + ~package(); // not implemented + void operator =(package); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/private.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/private.hpp new file mode 100644 index 000000000000..c7e3b574a2bb --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/private.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_private && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_private) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_private +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_private(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_private { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_private && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_private) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_private + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_private)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.private" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.private of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_private(); // not implemented + singleton_private(singleton_private &); // not implemented + ~singleton_private(); // not implemented + void operator =(singleton_private); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/protected.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/protected.hpp new file mode 100644 index 000000000000..f1a4d848cdf0 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/protected.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_protected && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_protected) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_protected +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_protected(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_protected { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_protected && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_protected) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_protected + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_protected)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.protected" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.protected of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_protected(); // not implemented + singleton_protected(singleton_protected &); // not implemented + ~singleton_protected(); // not implemented + void operator =(singleton_protected); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/public.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/public.hpp new file mode 100644 index 000000000000..f32c890048f7 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/public.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_public && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_public) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_public +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_public(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_public { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_public && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_public) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_public + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_public)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.public" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.public of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_public(); // not implemented + singleton_public(singleton_public &); // not implemented + ~singleton_public(); // not implemented + void operator =(singleton_public); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/return.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/return.hpp new file mode 100644 index 000000000000..a73e66377de3 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/return.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_return && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_return) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_return +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_return(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_return { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_return && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_return) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_return + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_return)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.return" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.return of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_return(); // not implemented + singleton_return(singleton_return &); // not implemented + ~singleton_return(); // not implemented + void operator =(singleton_return); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/abstract.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/abstract.hpp new file mode 100644 index 000000000000..52a45fac6f26 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/abstract.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_abstract && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_abstract) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_abstract +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_abstract(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class abstract { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_abstract(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 abstract) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= abstract; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_abstract && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_abstract) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_abstract + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_abstract)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.abstract", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.abstract" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.abstract" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + abstract(); // not implemented + abstract(abstract &); // not implemented + ~abstract(); // not implemented + void operator =(abstract); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/assert.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/assert.hpp new file mode 100644 index 000000000000..40c5ffc1126b --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/assert.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_assert && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_assert) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_assert +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_assert(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_assert { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_assert(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_assert) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_assert; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_assert && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_assert) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_assert + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_assert)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.assert", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.assert" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.assert" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_assert(); // not implemented + service_assert(service_assert &); // not implemented + ~service_assert(); // not implemented + void operator =(service_assert); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/break.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/break.hpp new file mode 100644 index 000000000000..4f2bd0327782 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/break.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_break && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_break) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_break +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_break(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_break { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_break(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_break) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_break; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_break && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_break) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_break + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_break)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.break", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.break" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.break" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_break(); // not implemented + service_break(service_break &); // not implemented + ~service_break(); // not implemented + void operator =(service_break); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/catch.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/catch.hpp new file mode 100644 index 000000000000..329312745d78 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/catch.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_catch && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_catch) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_catch +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_catch(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_catch { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_catch(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_catch) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_catch; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_catch && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_catch) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_catch + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_catch)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.catch", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.catch" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.catch" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_catch(); // not implemented + service_catch(service_catch &); // not implemented + ~service_catch(); // not implemented + void operator =(service_catch); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/class.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/class.hpp new file mode 100644 index 000000000000..9bf5df291223 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/class.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_class && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_class) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_class +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_class(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_class { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_class(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_class) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_class; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_class && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_class) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_class + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_class)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.class", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.class" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.class" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_class(); // not implemented + service_class(service_class &); // not implemented + ~service_class(); // not implemented + void operator =(service_class); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/continue.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/continue.hpp new file mode 100644 index 000000000000..4de444b4ae03 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/continue.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_continue && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_continue) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_continue +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_continue(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_continue { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_continue(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_continue) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_continue; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_continue && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_continue) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_continue + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_continue)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.continue", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.continue" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.continue" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_continue(); // not implemented + service_continue(service_continue &); // not implemented + ~service_continue(); // not implemented + void operator =(service_continue); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/do.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/do.hpp new file mode 100644 index 000000000000..b503d6b1aeb1 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/do.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_do && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_do) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_do +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_do(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_do { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_do(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_do) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_do; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_do && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_do) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_do + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_do)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.do", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.do" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.do" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_do(); // not implemented + service_do(service_do &); // not implemented + ~service_do(); // not implemented + void operator =(service_do); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/else.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/else.hpp new file mode 100644 index 000000000000..83c7c284877b --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/else.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_else && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_else) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_else +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_else(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_else { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_else(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_else) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_else; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_else && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_else) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_else)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.else", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.else" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.else" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_else(); // not implemented + service_else(service_else &); // not implemented + ~service_else(); // not implemented + void operator =(service_else); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/extends.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/extends.hpp new file mode 100644 index 000000000000..664d58a105cb --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/extends.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_extends && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_extends) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_extends +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_extends(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class extends { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_extends(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 extends) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= extends; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_extends && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_extends) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_extends + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_extends)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.extends", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.extends" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.extends" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + extends(); // not implemented + extends(extends &); // not implemented + ~extends(); // not implemented + void operator =(extends); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/final.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/final.hpp new file mode 100644 index 000000000000..c2b93f80cc7d --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/final.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_final && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_final) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_final +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_final(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class final { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_final(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 final) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= final; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_final && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_final) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_final + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_final)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.final", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.final" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.final" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + final(); // not implemented + final(final &); // not implemented + ~final(); // not implemented + void operator =(final); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/finally.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/finally.hpp new file mode 100644 index 000000000000..db87297cf7c4 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/finally.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_finally && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_finally) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_finally +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_finally(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class finally { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_finally(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 finally) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= finally; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_finally && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_finally) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_finally + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_finally)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.finally", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.finally" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.finally" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + finally(); // not implemented + finally(finally &); // not implemented + ~finally(); // not implemented + void operator =(finally); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/for.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/for.hpp new file mode 100644 index 000000000000..3be6616b7f05 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/for.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_for && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_for) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_for +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_for(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_for { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_for(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_for) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_for; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_for && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_for) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_for + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_for)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.for", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.for" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.for" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_for(); // not implemented + service_for(service_for &); // not implemented + ~service_for(); // not implemented + void operator =(service_for); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/goto.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/goto.hpp new file mode 100644 index 000000000000..fc95d9d1d5d1 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/goto.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_goto && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_goto) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_goto +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_goto(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_goto { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_goto(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_goto) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_goto; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_goto && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_goto) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_goto + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_goto)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.goto", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.goto" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.goto" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_goto(); // not implemented + service_goto(service_goto &); // not implemented + ~service_goto(); // not implemented + void operator =(service_goto); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/if.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/if.hpp new file mode 100644 index 000000000000..dcc2f942eda2 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/if.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_if && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_if) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_if +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_if(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_if { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_if(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_if) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_if; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_if && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_if) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_if + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_if)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.if", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.if" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.if" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_if(); // not implemented + service_if(service_if &); // not implemented + ~service_if(); // not implemented + void operator =(service_if); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/implements.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/implements.hpp new file mode 100644 index 000000000000..83c324c08abb --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/implements.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_implements && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_implements) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_implements +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_implements(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class implements { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_implements(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 implements) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= implements; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_implements && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_implements) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_implements + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_implements)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.implements", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.implements" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.implements" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + implements(); // not implemented + implements(implements &); // not implemented + ~implements(); // not implemented + void operator =(implements); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/import.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/import.hpp new file mode 100644 index 000000000000..cdb438ebcdc1 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/import.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_import && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_import) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_import +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_import(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class import { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_import(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 import) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= import; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_import && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_import) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_import + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_import)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.import", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.import" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.import" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + import(); // not implemented + import(import &); // not implemented + ~import(); // not implemented + void operator =(import); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/instanceof.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/instanceof.hpp new file mode 100644 index 000000000000..a46d76cf9277 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/instanceof.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_instanceof && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_instanceof) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_instanceof +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_instanceof(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class instanceof { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_instanceof(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 instanceof) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= instanceof; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_instanceof && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_instanceof) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_instanceof + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_instanceof)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.instanceof", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.instanceof" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.instanceof" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + instanceof(); // not implemented + instanceof(instanceof &); // not implemented + ~instanceof(); // not implemented + void operator =(instanceof); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/int.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/int.hpp new file mode 100644 index 000000000000..e8a7d4759741 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/int.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_int && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_int) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_int +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_int(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_int { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_int(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_int) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_int; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_int && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_int) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_int + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_int)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.int", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.int" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.int" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_int(); // not implemented + service_int(service_int &); // not implemented + ~service_int(); // not implemented + void operator =(service_int); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/native.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/native.hpp new file mode 100644 index 000000000000..41c0b5309ee7 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/native.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_native && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_native) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_native +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_native(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class native { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_native(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 native) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= native; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_native && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_native) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_native + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_native)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.native", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.native" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.native" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + native(); // not implemented + native(native &); // not implemented + ~native(); // not implemented + void operator =(native); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/new.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/new.hpp new file mode 100644 index 000000000000..5a1b88551720 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/new.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_new && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_new) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_new +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_new(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_new { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_new(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_new) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_new; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_new && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_new) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_new + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_new)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.new", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.new" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.new" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_new(); // not implemented + service_new(service_new &); // not implemented + ~service_new(); // not implemented + void operator =(service_new); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/package.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/package.hpp new file mode 100644 index 000000000000..2c4cc58a1bce --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/package.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_package && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_package) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_package +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_package(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class package { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_package(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 package) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= package; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_package && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_package) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_package + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_package)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.package", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.package" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.package" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + package(); // not implemented + package(package &); // not implemented + ~package(); // not implemented + void operator =(package); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/private.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/private.hpp new file mode 100644 index 000000000000..2e3a2d3c98d2 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/private.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_private && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_private) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_private +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_private(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_private { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_private(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_private) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_private; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_private && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_private) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_private + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_private)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.private", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.private" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.private" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_private(); // not implemented + service_private(service_private &); // not implemented + ~service_private(); // not implemented + void operator =(service_private); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/protected.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/protected.hpp new file mode 100644 index 000000000000..25215cb30920 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/protected.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_protected && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_protected) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_protected +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_protected(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_protected { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_protected(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_protected) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_protected; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_protected && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_protected) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_protected + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_protected)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.protected", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.protected" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.protected" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_protected(); // not implemented + service_protected(service_protected &); // not implemented + ~service_protected(); // not implemented + void operator =(service_protected); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/public.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/public.hpp new file mode 100644 index 000000000000..608a94e99ee4 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/public.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_public && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_public) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_public +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_public(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_public { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_public(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_public) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_public; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_public && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_public) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_public + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_public)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.public", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.public" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.public" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_public(); // not implemented + service_public(service_public &); // not implemented + ~service_public(); // not implemented + void operator =(service_public); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/return.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/return.hpp new file mode 100644 index 000000000000..9d5ffe600e98 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/return.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_return && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_return) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_return +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_return(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_return { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_return(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_return) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_return; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_return && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_return) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_return + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_return)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.return", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.return" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.return" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_return(); // not implemented + service_return(service_return &); // not implemented + ~service_return(); // not implemented + void operator =(service_return); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/static.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/static.hpp new file mode 100644 index 000000000000..8c81df978818 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/static.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_static && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_static) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_static +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_static(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_static { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_static(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_static) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_static; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_static && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_static) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_static + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_static)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.static", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.static" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.static" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_static(); // not implemented + service_static(service_static &); // not implemented + ~service_static(); // not implemented + void operator =(service_static); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/strictfp.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/strictfp.hpp new file mode 100644 index 000000000000..6d77ac9c423c --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/strictfp.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_strictfp && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_strictfp) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_strictfp +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_strictfp(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class strictfp { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_strictfp(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 strictfp) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= strictfp; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_strictfp && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_strictfp) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_strictfp + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_strictfp)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.strictfp", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.strictfp" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.strictfp" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + strictfp(); // not implemented + strictfp(strictfp &); // not implemented + ~strictfp(); // not implemented + void operator =(strictfp); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/super.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/super.hpp new file mode 100644 index 000000000000..4f4d0fbf0014 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/super.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_super && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_super) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_super +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_super(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class super { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_super(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 super) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= super; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_super && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_super) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_super + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_super)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.super", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.super" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.super" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + super(); // not implemented + super(super &); // not implemented + ~super(); // not implemented + void operator =(super); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/synchronized.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/synchronized.hpp new file mode 100644 index 000000000000..b6d7b468a9b8 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/synchronized.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_synchronized && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_synchronized) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_synchronized +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_synchronized(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class synchronized { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_synchronized(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 synchronized) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= synchronized; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_synchronized && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_synchronized) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_synchronized + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_synchronized)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.synchronized", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.synchronized" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.synchronized" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + synchronized(); // not implemented + synchronized(synchronized &); // not implemented + ~synchronized(); // not implemented + void operator =(synchronized); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/this.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/this.hpp new file mode 100644 index 000000000000..59634daff52b --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/this.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_this && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_this) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_this +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_this(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_this { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_this(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_this) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_this; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_this && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_this) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_this + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_this)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.this", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.this" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.this" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_this(); // not implemented + service_this(service_this &); // not implemented + ~service_this(); // not implemented + void operator =(service_this); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/throw.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/throw.hpp new file mode 100644 index 000000000000..36ba6182ca32 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/throw.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_throw && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_throw) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_throw +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_throw(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_throw { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_throw(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_throw) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_throw; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_throw && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_throw) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_throw + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_throw)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.throw", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.throw" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.throw" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_throw(); // not implemented + service_throw(service_throw &); // not implemented + ~service_throw(); // not implemented + void operator =(service_throw); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/throws.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/throws.hpp new file mode 100644 index 000000000000..00b13c7ff02d --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/throws.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_throws && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_throws) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_throws +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_throws(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class throws { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_throws(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 throws) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= throws; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_throws && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_throws) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_throws + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_throws)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.throws", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.throws" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.throws" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + throws(); // not implemented + throws(throws &); // not implemented + ~throws(); // not implemented + void operator =(throws); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/try.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/try.hpp new file mode 100644 index 000000000000..babe6976384b --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/try.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_try && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_try) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_try +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_try(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_try { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_try(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_try) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_try; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_try && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_try) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_try + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_try)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.try", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.try" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.try" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_try(); // not implemented + service_try(service_try &); // not implemented + ~service_try(); // not implemented + void operator =(service_try); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/volatile.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/volatile.hpp new file mode 100644 index 000000000000..a397bed603cc --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/volatile.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_volatile && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_volatile) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_volatile +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_volatile(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_volatile { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_volatile(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_volatile) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_volatile; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_volatile && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_volatile) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_volatile + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_volatile)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.volatile", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.volatile" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.volatile" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_volatile(); // not implemented + service_volatile(service_volatile &); // not implemented + ~service_volatile(); // not implemented + void operator =(service_volatile); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/while.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/while.hpp new file mode 100644 index 000000000000..85475b11038e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/services/while.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_while && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_while) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_while +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_while(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { namespace services { + +class service_while { +public: + static ::css::uno::Reference< ::css::uno::XInterface > method_while(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context, ::sal_Int32 param_while) { + assert(the_context.is()); + ::css::uno::Sequence< ::css::uno::Any > the_arguments(1); + ::css::uno::Any* the_arguments_array = the_arguments.getArray(); + the_arguments_array[0] <<= param_while; + ::css::uno::Reference< ::css::uno::XInterface > the_instance; + try { +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_while && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_services_dot_while) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_while + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_services_dot_while)(the_context.get(), the_arguments)), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); + ::css::uno::Reference< ::css::lang::XInitialization > init(the_instance, ::css::uno::UNO_QUERY); + if (init.is()) { + init->initialize(the_arguments); + } +#else + the_instance = ::css::uno::Reference< ::css::uno::XInterface >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext( "test.codemaker.codemakertests.services.while", the_arguments, the_context), ::css::uno::UNO_QUERY); +#endif + } catch (const ::css::uno::RuntimeException &) { + throw; + } catch (const ::css::uno::Exception & the_exception) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.while" + " of type " + "com.sun.star.uno.XInterface" + ": " + the_exception.Message, the_context); + } + if (!the_instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString("component context fails to supply service ") + "test.codemaker.codemakertests.services.while" + " of type " + "com.sun.star.uno.XInterface", the_context); + } + return the_instance; + } + +private: + service_while(); // not implemented + service_while(service_while &); // not implemented + ~service_while(); // not implemented + void operator =(service_while); // not implemented +}; + +} } } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/static.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/static.hpp new file mode 100644 index 000000000000..b6d303af98c5 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/static.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_static && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_static) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_static +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_static(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_static { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_static && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_static) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_static + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_static)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.static" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.static of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_static(); // not implemented + singleton_static(singleton_static &); // not implemented + ~singleton_static(); // not implemented + void operator =(singleton_static); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/strictfp.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/strictfp.hpp new file mode 100644 index 000000000000..292c962b931b --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/strictfp.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_strictfp && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_strictfp) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_strictfp +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_strictfp(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class strictfp { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_strictfp && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_strictfp) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_strictfp + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_strictfp)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.strictfp" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.strictfp of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + strictfp(); // not implemented + strictfp(strictfp &); // not implemented + ~strictfp(); // not implemented + void operator =(strictfp); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/super.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/super.hpp new file mode 100644 index 000000000000..2671761cf876 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/super.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_super && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_super) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_super +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_super(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class super { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_super && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_super) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_super + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_super)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.super" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.super of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + super(); // not implemented + super(super &); // not implemented + ~super(); // not implemented + void operator =(super); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/synchronized.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/synchronized.hpp new file mode 100644 index 000000000000..8249308a5159 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/synchronized.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_synchronized && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_synchronized) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_synchronized +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_synchronized(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class synchronized { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_synchronized && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_synchronized) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_synchronized + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_synchronized)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.synchronized" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.synchronized of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + synchronized(); // not implemented + synchronized(synchronized &); // not implemented + ~synchronized(); // not implemented + void operator =(synchronized); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/this.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/this.hpp new file mode 100644 index 000000000000..74dedcae29e3 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/this.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_this && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_this) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_this +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_this(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_this { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_this && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_this) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_this + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_this)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.this" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.this of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_this(); // not implemented + singleton_this(singleton_this &); // not implemented + ~singleton_this(); // not implemented + void operator =(singleton_this); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/throw.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/throw.hpp new file mode 100644 index 000000000000..e54e17bfe445 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/throw.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_throw && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_throw) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_throw +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_throw(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_throw { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_throw && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_throw) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_throw + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_throw)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.throw" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.throw of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_throw(); // not implemented + singleton_throw(singleton_throw &); // not implemented + ~singleton_throw(); // not implemented + void operator =(singleton_throw); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/throws.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/throws.hpp new file mode 100644 index 000000000000..011fe31f6c32 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/throws.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_throws && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_throws) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_throws +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_throws(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class throws { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_throws && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_throws) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_throws + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_throws)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.throws" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.throws of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + throws(); // not implemented + throws(throws &); // not implemented + ~throws(); // not implemented + void operator =(throws); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/try.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/try.hpp new file mode 100644 index 000000000000..e401ed2cf78e --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/try.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_try && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_try) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_try +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_try(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_try { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_try && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_try) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_try + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_try)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.try" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.try of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_try(); // not implemented + singleton_try(singleton_try &); // not implemented + ~singleton_try(); // not implemented + void operator =(singleton_try); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/volatile.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/volatile.hpp new file mode 100644 index 000000000000..63e32c2a1dc5 --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/volatile.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_volatile && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_volatile) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_volatile +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_volatile(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_volatile { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_volatile && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_volatile) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_volatile + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_volatile)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.volatile" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.volatile of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_volatile(); // not implemented + singleton_volatile(singleton_volatile &); // not implemented + ~singleton_volatile(); // not implemented + void operator =(singleton_volatile); // not implemented +}; + +} } } diff --git a/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/while.hpp b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/while.hpp new file mode 100644 index 000000000000..d7adda81b8db --- /dev/null +++ b/codemaker/tests/expected_cppumaker_stubs/test/codemaker/codemakertests/while.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppu/unotype.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" + +#if defined ANDROID || defined IOS //TODO +#include +#include +#endif + +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_while && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_while) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_while +extern "C" ::css::uno::XInterface * SAL_CALL LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_while(::css::uno::XComponentContext *, ::css::uno::Sequence< ::css::uno::Any > const &); +#endif + +namespace test { namespace codemaker { namespace codemakertests { + +class singleton_while { +public: + static ::css::uno::Reference< ::css::uno::XNamingService > get(::css::uno::Reference< ::css::uno::XComponentContext > const & the_context) { + assert(the_context.is()); + ::css::uno::Reference< ::css::uno::XNamingService > instance; +#if defined LO_URE_CURRENT_ENV && defined LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_while && (LO_URE_CURRENT_ENV) == (LO_URE_CTOR_ENV_test_dot_codemaker_dot_codemakertests_dot_while) && defined LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_while + instance = ::css::uno::Reference< ::css::uno::XNamingService >(::css::uno::Reference< ::css::uno::XInterface >(static_cast< ::css::uno::XInterface * >((*LO_URE_CTOR_FUN_test_dot_codemaker_dot_codemakertests_dot_while)(the_context.get(), ::css::uno::Sequence< ::css::uno::Any >())), ::SAL_NO_ACQUIRE), ::css::uno::UNO_QUERY); +#else + the_context->getValueByName(::rtl::OUString( "/singletons/test.codemaker.codemakertests.while" )) >>= instance; +#endif + if (!instance.is()) { + throw ::css::uno::DeploymentException(::rtl::OUString( "component context fails to supply singleton test.codemaker.codemakertests.while of type com.sun.star.uno.XNamingService" ), the_context); + } + return instance; + } + +private: + singleton_while(); // not implemented + singleton_while(singleton_while &); // not implemented + ~singleton_while(); // not implemented + void operator =(singleton_while); // not implemented +}; + +} } } diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/__init__.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/__init__.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/__init__.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/__init__.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/__init__.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/__init__.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/__init__.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/__init__.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Any.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Any.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Any.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Any.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Boolean.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Boolean.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Boolean.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Boolean.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Byte.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Byte.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Byte.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Byte.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Char.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Char.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Char.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Char.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Double.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Double.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Double.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Double.pyi diff --git a/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Enum.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Enum.pyi new file mode 100644 index 000000000000..050fef5751c9 --- /dev/null +++ b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Enum.pyi @@ -0,0 +1,6 @@ +# Auto-generated by pythonmaker - DO NOT EDIT. +from __future__ import annotations + +from test.codemaker.codemakertests.Enum2 import Enum2 as test_codemaker_codemakertests_Enum2_ + +Enum = test_codemaker_codemakertests_Enum2_ diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Enum1.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Enum1.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Enum1.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Enum1.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Enum2.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Enum2.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Enum2.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Enum2.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Enum3.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Enum3.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Enum3.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Enum3.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Enum4.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Enum4.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Enum4.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Enum4.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Float.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Float.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Float.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Float.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Hyper.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Hyper.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Hyper.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Hyper.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Long.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Long.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Long.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Long.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/PolyStruct.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/PolyStruct.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/PolyStruct.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/PolyStruct.pyi diff --git a/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/S1.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/S1.pyi new file mode 100644 index 000000000000..b2e4a2844e44 --- /dev/null +++ b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/S1.pyi @@ -0,0 +1,52 @@ +# Auto-generated by pythonmaker - DO NOT EDIT. +from __future__ import annotations + +from com.sun.star.lang.ClassNotFoundException import ClassNotFoundException as com_sun_star_lang_ClassNotFoundException_ +from com.sun.star.lang.IllegalAccessException import IllegalAccessException as com_sun_star_lang_IllegalAccessException_ +from com.sun.star.uno.DeploymentException import DeploymentException as com_sun_star_uno_DeploymentException_ +from com.sun.star.uno.Exception import Exception as com_sun_star_uno_Exception_ +from com.sun.star.uno.RuntimeException import RuntimeException as com_sun_star_uno_RuntimeException_ +from com.sun.star.uno.XComponentContext import XComponentContext as com_sun_star_uno_XComponentContext_ +from com.sun.star.uno.XInterface import XInterface as com_sun_star_uno_XInterface_ +from com.sun.star.uno.XNamingService import XNamingService as com_sun_star_uno_XNamingService_ +from test.codemaker.codemakertests.Enum2 import Enum2 as test_codemaker_codemakertests_Enum2_ +from test.codemaker.codemakertests.Struct1 import Struct1 as test_codemaker_codemakertests_Struct1_ +from test.codemaker.codemakertests.XTest import XTest as test_codemaker_codemakertests_XTest_ +from typing import Any +from typing import List +from typing import Type + +class S1: + @staticmethod + def create1(ctx: com_sun_star_uno_XComponentContext_) -> test_codemaker_codemakertests_XTest_: + ... + + @staticmethod + def create2(ctx: com_sun_star_uno_XComponentContext_, *args: Any) -> test_codemaker_codemakertests_XTest_: + """Raises: + com_sun_star_uno_RuntimeException_ + com_sun_star_lang_ClassNotFoundException_ + com_sun_star_uno_Exception_ + com_sun_star_lang_IllegalAccessException_ + com_sun_star_uno_DeploymentException_ + """ + ... + + @staticmethod + def create3(ctx: com_sun_star_uno_XComponentContext_, S1: List[Any]) -> test_codemaker_codemakertests_XTest_: + """Raises: + com_sun_star_uno_RuntimeException_ + com_sun_star_lang_ClassNotFoundException_ + com_sun_star_lang_IllegalAccessException_ + com_sun_star_uno_DeploymentException_ + """ + ... + + @staticmethod + def create4(ctx: com_sun_star_uno_XComponentContext_, javamaker: int, S1: int, create4: int) -> test_codemaker_codemakertests_XTest_: + ... + + @staticmethod + def create5(ctx: com_sun_star_uno_XComponentContext_, p1: bool, p2: int, p3: int, p4: int, p5: int, p6: int, p7: int, p8: int, p9: float, p10: float, p11: str, p12: str, p13: Type[Any], p14: Any, p15: test_codemaker_codemakertests_Enum2_, p16: test_codemaker_codemakertests_Struct1_, p17: com_sun_star_uno_XInterface_, p18: com_sun_star_uno_XNamingService_, t1: bool, t2: int, t3: int, t4: int, t5: int, t6: int, t7: int, t8: int, t9: float, t10: float, t11: str, t12: str, t13: Type[Any], t14: Any, t15: test_codemaker_codemakertests_Enum2_, t16: test_codemaker_codemakertests_Struct1_, t17: com_sun_star_uno_XInterface_, t18: com_sun_star_uno_XNamingService_, a1: List[bool], a2: List[int], a3: List[int], a4: List[int], a5: List[int], a6: List[int], a7: List[int], a8: List[int], a9: List[float], a10: List[float], a11: List[str], a12: List[str], a13: List[Type[Any]], a14: List[Any], a15: List[test_codemaker_codemakertests_Enum2_], a16: List[test_codemaker_codemakertests_Struct1_], a17: List[com_sun_star_uno_XInterface_], a18: List[com_sun_star_uno_XNamingService_], aa1: List[List[bool]], aa2: List[List[int]], aa3: List[List[int]], aa4: List[List[int]], aa5: List[List[int]], aa6: List[List[int]], aa7: List[List[int]], aa8: List[List[int]], aa9: List[List[float]], aa10: List[List[float]], aa11: List[List[str]], aa12: List[List[str]], aa13: List[List[Type[Any]]], aa14: List[List[Any]], aa15: List[List[test_codemaker_codemakertests_Enum2_]], aa16: List[List[test_codemaker_codemakertests_Struct1_]], aa17: List[List[com_sun_star_uno_XInterface_]], aa18: List[List[com_sun_star_uno_XNamingService_]], at1: List[List[bool]], at2: List[List[int]], at3: List[List[int]], at4: List[List[int]], at5: List[List[int]], at6: List[List[int]], at7: List[List[int]], at8: List[List[int]], at9: List[List[float]], at10: List[List[float]], at11: List[List[str]], at12: List[List[str]], at13: List[List[Type[Any]]], at14: List[List[Any]], at15: List[List[test_codemaker_codemakertests_Enum2_]], at16: List[List[test_codemaker_codemakertests_Struct1_]], at17: List[List[com_sun_star_uno_XInterface_]], at18: List[List[com_sun_star_uno_XNamingService_]]) -> test_codemaker_codemakertests_XTest_: + ... + diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/S2.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/S2.pyi similarity index 69% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/S2.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/S2.pyi index 32fcfaecd2a2..16b62f38bcf5 100644 --- a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/S2.pyi +++ b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/S2.pyi @@ -2,10 +2,10 @@ from __future__ import annotations from com.sun.star.uno.XComponentContext import XComponentContext as com_sun_star_uno_XComponentContext_ -from test.codemaker.pythonmaker.XTest import XTest as test_codemaker_pythonmaker_XTest_ +from test.codemaker.codemakertests.XTest import XTest as test_codemaker_codemakertests_XTest_ class S2: @staticmethod - def create(ctx: com_sun_star_uno_XComponentContext_) -> test_codemaker_pythonmaker_XTest_: + def create(ctx: com_sun_star_uno_XComponentContext_) -> test_codemaker_codemakertests_XTest_: ... diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/S4.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/S4.pyi similarity index 79% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/S4.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/S4.pyi index 1ee119510671..bbf1b90cdd76 100644 --- a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/S4.pyi +++ b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/S4.pyi @@ -3,11 +3,11 @@ from __future__ import annotations from com.sun.star.uno.DeploymentException import DeploymentException as com_sun_star_uno_DeploymentException_ from com.sun.star.uno.XComponentContext import XComponentContext as com_sun_star_uno_XComponentContext_ -from test.codemaker.pythonmaker.XTest import XTest as test_codemaker_pythonmaker_XTest_ +from test.codemaker.codemakertests.XTest import XTest as test_codemaker_codemakertests_XTest_ class S4: @staticmethod - def get(ctx: com_sun_star_uno_XComponentContext_) -> test_codemaker_pythonmaker_XTest_: + def get(ctx: com_sun_star_uno_XComponentContext_) -> test_codemaker_codemakertests_XTest_: """Raises: com_sun_star_uno_DeploymentException_ """ diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceAny.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceAny.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceAny.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceAny.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceBoolean.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceBoolean.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceBoolean.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceBoolean.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceByte.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceByte.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceByte.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceByte.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceChar.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceChar.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceChar.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceChar.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceDouble.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceDouble.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceDouble.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceDouble.pyi diff --git a/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceEnum.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceEnum.pyi new file mode 100644 index 000000000000..e11335ffb1be --- /dev/null +++ b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceEnum.pyi @@ -0,0 +1,7 @@ +# Auto-generated by pythonmaker - DO NOT EDIT. +from __future__ import annotations + +from test.codemaker.codemakertests.Enum2 import Enum2 as test_codemaker_codemakertests_Enum2_ +from typing import List + +SequenceEnum = List[test_codemaker_codemakertests_Enum2_] diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceFloat.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceFloat.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceFloat.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceFloat.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceHyper.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceHyper.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceHyper.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceHyper.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceLong.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceLong.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceLong.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceLong.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceShort.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceShort.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceShort.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceShort.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceString.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceString.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceString.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceString.pyi diff --git a/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceStruct.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceStruct.pyi new file mode 100644 index 000000000000..11befb7343a3 --- /dev/null +++ b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceStruct.pyi @@ -0,0 +1,7 @@ +# Auto-generated by pythonmaker - DO NOT EDIT. +from __future__ import annotations + +from test.codemaker.codemakertests.Struct1 import Struct1 as test_codemaker_codemakertests_Struct1_ +from typing import List + +SequenceStruct = List[test_codemaker_codemakertests_Struct1_] diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceType.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceType.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceType.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceType.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceUnsignedHyper.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceUnsignedHyper.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceUnsignedHyper.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceUnsignedHyper.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceUnsignedLong.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceUnsignedLong.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceUnsignedLong.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceUnsignedLong.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceUnsignedShort.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceUnsignedShort.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceUnsignedShort.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceUnsignedShort.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceXInterface.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceXInterface.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceXInterface.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceXInterface.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceXNamingService.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceXNamingService.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceXNamingService.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/SequenceXNamingService.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Service.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Service.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Service.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Service.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Short.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Short.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Short.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Short.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/String.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/String.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/String.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/String.pyi diff --git a/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Struct.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Struct.pyi new file mode 100644 index 000000000000..14be27f4049e --- /dev/null +++ b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Struct.pyi @@ -0,0 +1,6 @@ +# Auto-generated by pythonmaker - DO NOT EDIT. +from __future__ import annotations + +from test.codemaker.codemakertests.Struct1 import Struct1 as test_codemaker_codemakertests_Struct1_ + +Struct = test_codemaker_codemakertests_Struct1_ diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Struct1.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Struct1.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Struct1.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Struct1.pyi diff --git a/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Struct2.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Struct2.pyi new file mode 100644 index 000000000000..6b6ee650e878 --- /dev/null +++ b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Struct2.pyi @@ -0,0 +1,105 @@ +# Auto-generated by pythonmaker - DO NOT EDIT. +from __future__ import annotations + +from com.sun.star.uno.XInterface import XInterface as com_sun_star_uno_XInterface_ +from com.sun.star.uno.XNamingService import XNamingService as com_sun_star_uno_XNamingService_ +from test.codemaker.codemakertests.Enum2 import Enum2 as test_codemaker_codemakertests_Enum2_ +from test.codemaker.codemakertests.Struct1 import Struct1 as test_codemaker_codemakertests_Struct1_ +from typing import Any +from typing import List +from typing import Type + +class Struct2(object): + def __init__(self, p1: bool | None = ..., p2: int | None = ..., p3: int | None = ..., p4: int | None = ..., p5: int | None = ..., p6: int | None = ..., p7: int | None = ..., p8: int | None = ..., p9: float | None = ..., p10: float | None = ..., p11: str | None = ..., p12: str | None = ..., p13: Type[Any] | None = ..., p14: Any | None = ..., p15: test_codemaker_codemakertests_Enum2_ | None = ..., p16: test_codemaker_codemakertests_Struct1_ | None = ..., p17: com_sun_star_uno_XInterface_ | None = ..., p18: com_sun_star_uno_XNamingService_ | None = ..., t1: bool | None = ..., t2: int | None = ..., t3: int | None = ..., t4: int | None = ..., t5: int | None = ..., t6: int | None = ..., t7: int | None = ..., t8: int | None = ..., t9: float | None = ..., t10: float | None = ..., t11: str | None = ..., t12: str | None = ..., t13: Type[Any] | None = ..., t14: Any | None = ..., t15: test_codemaker_codemakertests_Enum2_ | None = ..., t16: test_codemaker_codemakertests_Struct1_ | None = ..., t17: com_sun_star_uno_XInterface_ | None = ..., t18: com_sun_star_uno_XNamingService_ | None = ..., a1: List[bool] | None = ..., a2: List[int] | None = ..., a3: List[int] | None = ..., a4: List[int] | None = ..., a5: List[int] | None = ..., a6: List[int] | None = ..., a7: List[int] | None = ..., a8: List[int] | None = ..., a9: List[float] | None = ..., a10: List[float] | None = ..., a11: List[str] | None = ..., a12: List[str] | None = ..., a13: List[Type[Any]] | None = ..., a14: List[Any] | None = ..., a15: List[test_codemaker_codemakertests_Enum2_] | None = ..., a16: List[test_codemaker_codemakertests_Struct1_] | None = ..., a17: List[com_sun_star_uno_XInterface_] | None = ..., a18: List[com_sun_star_uno_XNamingService_] | None = ..., aa1: List[List[bool]] | None = ..., aa2: List[List[int]] | None = ..., aa3: List[List[int]] | None = ..., aa4: List[List[int]] | None = ..., aa5: List[List[int]] | None = ..., aa6: List[List[int]] | None = ..., aa7: List[List[int]] | None = ..., aa8: List[List[int]] | None = ..., aa9: List[List[float]] | None = ..., aa10: List[List[float]] | None = ..., aa11: List[List[str]] | None = ..., aa12: List[List[str]] | None = ..., aa13: List[List[Type[Any]]] | None = ..., aa14: List[List[Any]] | None = ..., aa15: List[List[test_codemaker_codemakertests_Enum2_]] | None = ..., aa16: List[List[test_codemaker_codemakertests_Struct1_]] | None = ..., aa17: List[List[com_sun_star_uno_XInterface_]] | None = ..., aa18: List[List[com_sun_star_uno_XNamingService_]] | None = ..., at1: List[List[bool]] | None = ..., at2: List[List[int]] | None = ..., at3: List[List[int]] | None = ..., at4: List[List[int]] | None = ..., at5: List[List[int]] | None = ..., at6: List[List[int]] | None = ..., at7: List[List[int]] | None = ..., at8: List[List[int]] | None = ..., at9: List[List[float]] | None = ..., at10: List[List[float]] | None = ..., at11: List[List[str]] | None = ..., at12: List[List[str]] | None = ..., at13: List[List[Type[Any]]] | None = ..., at14: List[List[Any]] | None = ..., at15: List[List[test_codemaker_codemakertests_Enum2_]] | None = ..., at16: List[List[test_codemaker_codemakertests_Struct1_]] | None = ..., at17: List[List[com_sun_star_uno_XInterface_]] | None = ..., at18: List[List[com_sun_star_uno_XNamingService_]] | None = ...) -> None: + ... + + p1: bool + p2: int + p3: int + p4: int + p5: int + p6: int + p7: int + p8: int + p9: float + p10: float + p11: str + p12: str + p13: Type[Any] + p14: Any + p15: test_codemaker_codemakertests_Enum2_ + p16: test_codemaker_codemakertests_Struct1_ + p17: com_sun_star_uno_XInterface_ + p18: com_sun_star_uno_XNamingService_ + t1: bool + t2: int + t3: int + t4: int + t5: int + t6: int + t7: int + t8: int + t9: float + t10: float + t11: str + t12: str + t13: Type[Any] + t14: Any + t15: test_codemaker_codemakertests_Enum2_ + t16: test_codemaker_codemakertests_Struct1_ + t17: com_sun_star_uno_XInterface_ + t18: com_sun_star_uno_XNamingService_ + a1: List[bool] + a2: List[int] + a3: List[int] + a4: List[int] + a5: List[int] + a6: List[int] + a7: List[int] + a8: List[int] + a9: List[float] + a10: List[float] + a11: List[str] + a12: List[str] + a13: List[Type[Any]] + a14: List[Any] + a15: List[test_codemaker_codemakertests_Enum2_] + a16: List[test_codemaker_codemakertests_Struct1_] + a17: List[com_sun_star_uno_XInterface_] + a18: List[com_sun_star_uno_XNamingService_] + aa1: List[List[bool]] + aa2: List[List[int]] + aa3: List[List[int]] + aa4: List[List[int]] + aa5: List[List[int]] + aa6: List[List[int]] + aa7: List[List[int]] + aa8: List[List[int]] + aa9: List[List[float]] + aa10: List[List[float]] + aa11: List[List[str]] + aa12: List[List[str]] + aa13: List[List[Type[Any]]] + aa14: List[List[Any]] + aa15: List[List[test_codemaker_codemakertests_Enum2_]] + aa16: List[List[test_codemaker_codemakertests_Struct1_]] + aa17: List[List[com_sun_star_uno_XInterface_]] + aa18: List[List[com_sun_star_uno_XNamingService_]] + at1: List[List[bool]] + at2: List[List[int]] + at3: List[List[int]] + at4: List[List[int]] + at5: List[List[int]] + at6: List[List[int]] + at7: List[List[int]] + at8: List[List[int]] + at9: List[List[float]] + at10: List[List[float]] + at11: List[List[str]] + at12: List[List[str]] + at13: List[List[Type[Any]]] + at14: List[List[Any]] + at15: List[List[test_codemaker_codemakertests_Enum2_]] + at16: List[List[test_codemaker_codemakertests_Struct1_]] + at17: List[List[com_sun_star_uno_XInterface_]] + at18: List[List[com_sun_star_uno_XNamingService_]] diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/TestConstantsBasic.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/TestConstantsBasic.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/TestConstantsBasic.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/TestConstantsBasic.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Type.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Type.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Type.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/Type.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/UnsignedHyper.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/UnsignedHyper.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/UnsignedHyper.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/UnsignedHyper.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/UnsignedLong.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/UnsignedLong.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/UnsignedLong.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/UnsignedLong.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/UnsignedShort.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/UnsignedShort.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/UnsignedShort.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/UnsignedShort.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/XIfc.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/XIfc.pyi similarity index 52% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/XIfc.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/XIfc.pyi index 87940d5ea949..5a38044491db 100644 --- a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/XIfc.pyi +++ b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/XIfc.pyi @@ -3,15 +3,15 @@ from __future__ import annotations from abc import abstractmethod from com.sun.star.uno.XInterface import XInterface as com_sun_star_uno_XInterface_ -from test.codemaker.pythonmaker.PolyStruct import PolyStruct as test_codemaker_pythonmaker_PolyStruct_ +from test.codemaker.codemakertests.PolyStruct import PolyStruct as test_codemaker_codemakertests_PolyStruct_ from typing import Any class XIfc(com_sun_star_uno_XInterface_): @abstractmethod - def f1(self, arg: test_codemaker_pythonmaker_PolyStruct_[int, int]) -> None: + def f1(self, arg: test_codemaker_codemakertests_PolyStruct_[int, int]) -> None: ... @abstractmethod - def f2(self, arg: test_codemaker_pythonmaker_PolyStruct_[Any, com_sun_star_uno_XInterface_]) -> None: + def f2(self, arg: test_codemaker_codemakertests_PolyStruct_[Any, com_sun_star_uno_XInterface_]) -> None: ... diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/XInterface.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/XInterface.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/XInterface.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/XInterface.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/XNamingService.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/XNamingService.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/XNamingService.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/XNamingService.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/XTest.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/XTest.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/XTest.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/XTest.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/__init__.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/__init__.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/__init__.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/__init__.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/abstract.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/abstract.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/abstract.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/abstract.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/assert.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/assert.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/assert.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/assert.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/break.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/break.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/break.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/break.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/catch.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/catch.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/catch.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/catch.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/class.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/class.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/class.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/class.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/continue.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/continue.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/continue.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/continue.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/do.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/do.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/do.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/do.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/else.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/else.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/else.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/else.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/exceptions/MyBaseError.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/exceptions/MyBaseError.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/exceptions/MyBaseError.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/exceptions/MyBaseError.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/exceptions/SimpleError.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/exceptions/SimpleError.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/exceptions/SimpleError.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/exceptions/SimpleError.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/exceptions/__init__.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/exceptions/__init__.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/exceptions/__init__.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/exceptions/__init__.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/extends.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/extends.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/extends.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/extends.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/final.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/final.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/final.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/final.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/finally.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/finally.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/finally.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/finally.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/for.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/for.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/for.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/for.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/goto.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/goto.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/goto.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/goto.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/if.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/if.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/if.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/if.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/implements.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/implements.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/implements.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/implements.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/import.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/import.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/import.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/import.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/instanceof.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/instanceof.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/instanceof.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/instanceof.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/int.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/int.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/int.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/int.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/native.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/native.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/native.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/native.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/new.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/new.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/new.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/new.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/package.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/package.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/package.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/package.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/private.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/private.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/private.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/private.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/protected.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/protected.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/protected.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/protected.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/public.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/public.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/public.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/public.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/return.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/return.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/return.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/return.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/__init__.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/__init__.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/__init__.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/__init__.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/abstract.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/abstract.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/abstract.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/abstract.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/assert.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/assert.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/assert.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/assert.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/break.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/break.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/break.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/break.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/catch.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/catch.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/catch.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/catch.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/class.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/class.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/class.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/class.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/continue.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/continue.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/continue.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/continue.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/do.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/do.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/do.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/do.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/else.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/else.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/else.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/else.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/extends.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/extends.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/extends.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/extends.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/final.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/final.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/final.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/final.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/finally.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/finally.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/finally.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/finally.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/for.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/for.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/for.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/for.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/goto.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/goto.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/goto.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/goto.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/if.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/if.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/if.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/if.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/implements.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/implements.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/implements.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/implements.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/import.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/import.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/import.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/import.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/instanceof.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/instanceof.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/instanceof.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/instanceof.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/int.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/int.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/int.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/int.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/native.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/native.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/native.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/native.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/new.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/new.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/new.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/new.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/package.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/package.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/package.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/package.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/private.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/private.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/private.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/private.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/protected.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/protected.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/protected.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/protected.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/public.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/public.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/public.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/public.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/return.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/return.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/return.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/return.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/static.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/static.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/static.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/static.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/strictfp.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/strictfp.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/strictfp.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/strictfp.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/super.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/super.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/super.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/super.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/synchronized.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/synchronized.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/synchronized.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/synchronized.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/this.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/this.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/this.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/this.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/throw.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/throw.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/throw.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/throw.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/throws.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/throws.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/throws.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/throws.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/try.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/try.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/try.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/try.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/volatile.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/volatile.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/volatile.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/volatile.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/while.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/while.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/services/while.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/services/while.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/static.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/static.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/static.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/static.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/strictfp.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/strictfp.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/strictfp.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/strictfp.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/super.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/super.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/super.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/super.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/synchronized.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/synchronized.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/synchronized.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/synchronized.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/this.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/this.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/this.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/this.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/throw.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/throw.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/throw.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/throw.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/throws.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/throws.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/throws.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/throws.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/try.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/try.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/try.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/try.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/volatile.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/volatile.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/volatile.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/volatile.pyi diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/while.pyi b/codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/while.pyi similarity index 100% rename from codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/while.pyi rename to codemaker/tests/expected_pythonmaker_stubs/test/codemaker/codemakertests/while.pyi diff --git a/codemaker/tests/pythonmaker/README.md b/codemaker/tests/pythonmaker/README.md deleted file mode 100644 index 19ba0b183ac3..000000000000 --- a/codemaker/tests/pythonmaker/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# Pythonmaker Test Suite - -This directory contains the integration test suite for the `pythonmaker` tool. The purpose of this suite is to ensure that `pythonmaker` correctly generates Python stub files (`.pyi`) from UNO IDL definitions. It verifies the syntactic correctness of the output and protects against future regressions. - -The test is automatically executed as part of the `make check` command for the `codemaker` module. - -## Testing Philosophy - -The test suite follows a "Golden File" testing methodology. This is a standard and robust approach for testing compilers and code generators. The process is as follows: - -1. **Source IDL:** A comprehensive test IDL file (`idl/pythontypes.idl`) serves as the single source of truth for all UNO constructs that `pythonmaker` is expected to handle. -2. **Generate Output:** During the test run, this IDL is compiled into an `.rdb` file, and `pythonmaker` is executed to generate a complete set of `.pyi` stubs in a temporary directory. -3. **Compare Against "Golden" Files:** The newly generated stubs are recursively compared against a set of manually verified, correct "golden" stub files located in the `expected_pyi_stubs/` directory. -4. **Pass/Fail:** The test passes only if the generated output is an exact match to the golden files. Any difference—missing files, extra files, or content mismatches—will cause the test to fail. - -This approach ensures that any change to `pythonmaker` that alters its output is immediately detected. - -## Directory Structure - -- `idl/pythontypes.idl`: The master IDL file containing all test cases. This includes enums, constants, typedefs, structs (plain, inherited, and polymorphic), exceptions, interfaces, services, and singletons. It also includes edge cases like the use of keywords as identifiers. -- `expected_pyi_stubs/`: Contains the "golden" `.pyi` file structure that `pythonmaker` is expected to generate from `pythontypes.idl`. This is the reference standard for correctness. -- `test_pythonmaker.py`: The Python script that orchestrates the entire test. It is executed by the build system and is responsible for compiling the IDL, running `pythonmaker`, and performing the directory comparison. -- `makefile.mk`: The gbuild makefile that integrates the Python test script into the LibreOffice `make check` process. - ---- - -## How to Modify or Extend the Test Suite - -Future developers may need to modify these tests when fixing a bug or adding a new feature to `pythonmaker`. Here is the standard workflow. - -### Scenario 1: Fixing a Bug in `pythonmaker` - -If you have fixed a bug that was causing `pythonmaker` to generate incorrect `.pyi` files, the test suite should now fail because the new, correct output will not match the old, incorrect golden files. - -**To update the tests:** - -1. **Verify the Fix:** After fixing the C++ code in `pythonmaker`, run the test to confirm that it fails as expected. The `diff` error will show you the difference between the new output and the old golden files. -2. **Regenerate the Golden Files:** - a. First, delete the old golden files to ensure a clean slate. - ```bash - rm -rf codemaker/tests/pythonmaker/expected_pyi_stubs/* - ``` - b. Run your updated `pythonmaker` manually to generate the new, correct stubs into a temporary directory. You can find the exact command to run from the test script's log output during a `make check` run. A typical command would be: - ```bash - # Run from .../libreoffice/instdir/program/ - ./pathToPythonmaker.exe -O /path/to/new_golden_output /path/to/test.rdb - ``` -3. **Replace the Golden Files:** Copy the entire generated output into the `expected_pyi_stubs/` directory. - ```bash - cp -r /path/to/new_golden_output/* codemaker/tests/pythonmaker/expected_pyi_stubs/ - ``` -4. **Validate:** Run `mypy --strict codemaker/tests/pythonmaker/expected_pyi_stubs/` to ensure the new golden files are syntactically correct and type-safe. -5. **Commit:** Commit the changes to `pythonmaker`'s C++ code **along with** the updated golden files in your patch. The commit message should explain that the golden files were updated to reflect the bug fix. - -### Scenario 2: Adding a New Feature to `pythonmaker` - -If you add support for a new IDL feature (e.g., a new type or an annotation), you should add a test case for it. - -1. **Add a Test Case to the IDL:** - * Open `codemaker/tests/pythonmaker/idl/pythontypes.idl`. - * Add a new, simple example of the feature you've implemented. For example, add a new `interface` with a specific attribute you are now supporting. -2. **Generate and Verify the New Golden File:** - * Since you've added a new type, a new `.pyi` file will be generated. Run `pythonmaker` manually as described above. - * Locate the newly generated `.pyi` file for your new test case. - * **Manually inspect this new file** to ensure it is 100% correct. - * Run `mypy --strict` on this individual file. - * Once verified, place this new golden file in the correct subdirectory within `expected_pyi_stubs/`. -3. **Run the Full Test Suite:** Run `make check` for the module. The test should now pass, as the newly generated output will match your newly added golden file. -4. **Commit:** Commit the changes to `pythonmaker`'s C++ code, the updated `pythontypes.idl`, and the new golden `.pyi` file(s) together in your patch. - -By following this workflow, the test suite remains a reliable and comprehensive measure of `pythonmaker`'s correctness. diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Enum.pyi b/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Enum.pyi deleted file mode 100644 index d2c2bc3bb3a5..000000000000 --- a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Enum.pyi +++ /dev/null @@ -1,6 +0,0 @@ -# Auto-generated by pythonmaker - DO NOT EDIT. -from __future__ import annotations - -from test.codemaker.pythonmaker.Enum2 import Enum2 as test_codemaker_pythonmaker_Enum2_ - -Enum = test_codemaker_pythonmaker_Enum2_ diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/S1.pyi b/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/S1.pyi deleted file mode 100644 index 275d4be7f698..000000000000 --- a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/S1.pyi +++ /dev/null @@ -1,52 +0,0 @@ -# Auto-generated by pythonmaker - DO NOT EDIT. -from __future__ import annotations - -from com.sun.star.lang.ClassNotFoundException import ClassNotFoundException as com_sun_star_lang_ClassNotFoundException_ -from com.sun.star.lang.IllegalAccessException import IllegalAccessException as com_sun_star_lang_IllegalAccessException_ -from com.sun.star.uno.DeploymentException import DeploymentException as com_sun_star_uno_DeploymentException_ -from com.sun.star.uno.Exception import Exception as com_sun_star_uno_Exception_ -from com.sun.star.uno.RuntimeException import RuntimeException as com_sun_star_uno_RuntimeException_ -from com.sun.star.uno.XComponentContext import XComponentContext as com_sun_star_uno_XComponentContext_ -from com.sun.star.uno.XInterface import XInterface as com_sun_star_uno_XInterface_ -from com.sun.star.uno.XNamingService import XNamingService as com_sun_star_uno_XNamingService_ -from test.codemaker.pythonmaker.Enum2 import Enum2 as test_codemaker_pythonmaker_Enum2_ -from test.codemaker.pythonmaker.Struct1 import Struct1 as test_codemaker_pythonmaker_Struct1_ -from test.codemaker.pythonmaker.XTest import XTest as test_codemaker_pythonmaker_XTest_ -from typing import Any -from typing import List -from typing import Type - -class S1: - @staticmethod - def create1(ctx: com_sun_star_uno_XComponentContext_) -> test_codemaker_pythonmaker_XTest_: - ... - - @staticmethod - def create2(ctx: com_sun_star_uno_XComponentContext_, *args: Any) -> test_codemaker_pythonmaker_XTest_: - """Raises: - com_sun_star_uno_RuntimeException_ - com_sun_star_lang_ClassNotFoundException_ - com_sun_star_uno_Exception_ - com_sun_star_lang_IllegalAccessException_ - com_sun_star_uno_DeploymentException_ - """ - ... - - @staticmethod - def create3(ctx: com_sun_star_uno_XComponentContext_, S1: List[Any]) -> test_codemaker_pythonmaker_XTest_: - """Raises: - com_sun_star_uno_RuntimeException_ - com_sun_star_lang_ClassNotFoundException_ - com_sun_star_lang_IllegalAccessException_ - com_sun_star_uno_DeploymentException_ - """ - ... - - @staticmethod - def create4(ctx: com_sun_star_uno_XComponentContext_, javamaker: int, S1: int, create4: int) -> test_codemaker_pythonmaker_XTest_: - ... - - @staticmethod - def create5(ctx: com_sun_star_uno_XComponentContext_, p1: bool, p2: int, p3: int, p4: int, p5: int, p6: int, p7: int, p8: int, p9: float, p10: float, p11: str, p12: str, p13: Type[Any], p14: Any, p15: test_codemaker_pythonmaker_Enum2_, p16: test_codemaker_pythonmaker_Struct1_, p17: com_sun_star_uno_XInterface_, p18: com_sun_star_uno_XNamingService_, t1: bool, t2: int, t3: int, t4: int, t5: int, t6: int, t7: int, t8: int, t9: float, t10: float, t11: str, t12: str, t13: Type[Any], t14: Any, t15: test_codemaker_pythonmaker_Enum2_, t16: test_codemaker_pythonmaker_Struct1_, t17: com_sun_star_uno_XInterface_, t18: com_sun_star_uno_XNamingService_, a1: List[bool], a2: List[int], a3: List[int], a4: List[int], a5: List[int], a6: List[int], a7: List[int], a8: List[int], a9: List[float], a10: List[float], a11: List[str], a12: List[str], a13: List[Type[Any]], a14: List[Any], a15: List[test_codemaker_pythonmaker_Enum2_], a16: List[test_codemaker_pythonmaker_Struct1_], a17: List[com_sun_star_uno_XInterface_], a18: List[com_sun_star_uno_XNamingService_], aa1: List[List[bool]], aa2: List[List[int]], aa3: List[List[int]], aa4: List[List[int]], aa5: List[List[int]], aa6: List[List[int]], aa7: List[List[int]], aa8: List[List[int]], aa9: List[List[float]], aa10: List[List[float]], aa11: List[List[str]], aa12: List[List[str]], aa13: List[List[Type[Any]]], aa14: List[List[Any]], aa15: List[List[test_codemaker_pythonmaker_Enum2_]], aa16: List[List[test_codemaker_pythonmaker_Struct1_]], aa17: List[List[com_sun_star_uno_XInterface_]], aa18: List[List[com_sun_star_uno_XNamingService_]], at1: List[List[bool]], at2: List[List[int]], at3: List[List[int]], at4: List[List[int]], at5: List[List[int]], at6: List[List[int]], at7: List[List[int]], at8: List[List[int]], at9: List[List[float]], at10: List[List[float]], at11: List[List[str]], at12: List[List[str]], at13: List[List[Type[Any]]], at14: List[List[Any]], at15: List[List[test_codemaker_pythonmaker_Enum2_]], at16: List[List[test_codemaker_pythonmaker_Struct1_]], at17: List[List[com_sun_star_uno_XInterface_]], at18: List[List[com_sun_star_uno_XNamingService_]]) -> test_codemaker_pythonmaker_XTest_: - ... - diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceEnum.pyi b/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceEnum.pyi deleted file mode 100644 index c0eae23cc497..000000000000 --- a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceEnum.pyi +++ /dev/null @@ -1,7 +0,0 @@ -# Auto-generated by pythonmaker - DO NOT EDIT. -from __future__ import annotations - -from test.codemaker.pythonmaker.Enum2 import Enum2 as test_codemaker_pythonmaker_Enum2_ -from typing import List - -SequenceEnum = List[test_codemaker_pythonmaker_Enum2_] diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceStruct.pyi b/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceStruct.pyi deleted file mode 100644 index d607af826208..000000000000 --- a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/SequenceStruct.pyi +++ /dev/null @@ -1,7 +0,0 @@ -# Auto-generated by pythonmaker - DO NOT EDIT. -from __future__ import annotations - -from test.codemaker.pythonmaker.Struct1 import Struct1 as test_codemaker_pythonmaker_Struct1_ -from typing import List - -SequenceStruct = List[test_codemaker_pythonmaker_Struct1_] diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Struct.pyi b/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Struct.pyi deleted file mode 100644 index e9127de5dbeb..000000000000 --- a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Struct.pyi +++ /dev/null @@ -1,6 +0,0 @@ -# Auto-generated by pythonmaker - DO NOT EDIT. -from __future__ import annotations - -from test.codemaker.pythonmaker.Struct1 import Struct1 as test_codemaker_pythonmaker_Struct1_ - -Struct = test_codemaker_pythonmaker_Struct1_ diff --git a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Struct2.pyi b/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Struct2.pyi deleted file mode 100644 index 7136529440d3..000000000000 --- a/codemaker/tests/pythonmaker/expected_pyi_stubs/test/codemaker/pythonmaker/Struct2.pyi +++ /dev/null @@ -1,105 +0,0 @@ -# Auto-generated by pythonmaker - DO NOT EDIT. -from __future__ import annotations - -from com.sun.star.uno.XInterface import XInterface as com_sun_star_uno_XInterface_ -from com.sun.star.uno.XNamingService import XNamingService as com_sun_star_uno_XNamingService_ -from test.codemaker.pythonmaker.Enum2 import Enum2 as test_codemaker_pythonmaker_Enum2_ -from test.codemaker.pythonmaker.Struct1 import Struct1 as test_codemaker_pythonmaker_Struct1_ -from typing import Any -from typing import List -from typing import Type - -class Struct2(object): - def __init__(self, p1: bool | None = ..., p2: int | None = ..., p3: int | None = ..., p4: int | None = ..., p5: int | None = ..., p6: int | None = ..., p7: int | None = ..., p8: int | None = ..., p9: float | None = ..., p10: float | None = ..., p11: str | None = ..., p12: str | None = ..., p13: Type[Any] | None = ..., p14: Any | None = ..., p15: test_codemaker_pythonmaker_Enum2_ | None = ..., p16: test_codemaker_pythonmaker_Struct1_ | None = ..., p17: com_sun_star_uno_XInterface_ | None = ..., p18: com_sun_star_uno_XNamingService_ | None = ..., t1: bool | None = ..., t2: int | None = ..., t3: int | None = ..., t4: int | None = ..., t5: int | None = ..., t6: int | None = ..., t7: int | None = ..., t8: int | None = ..., t9: float | None = ..., t10: float | None = ..., t11: str | None = ..., t12: str | None = ..., t13: Type[Any] | None = ..., t14: Any | None = ..., t15: test_codemaker_pythonmaker_Enum2_ | None = ..., t16: test_codemaker_pythonmaker_Struct1_ | None = ..., t17: com_sun_star_uno_XInterface_ | None = ..., t18: com_sun_star_uno_XNamingService_ | None = ..., a1: List[bool] | None = ..., a2: List[int] | None = ..., a3: List[int] | None = ..., a4: List[int] | None = ..., a5: List[int] | None = ..., a6: List[int] | None = ..., a7: List[int] | None = ..., a8: List[int] | None = ..., a9: List[float] | None = ..., a10: List[float] | None = ..., a11: List[str] | None = ..., a12: List[str] | None = ..., a13: List[Type[Any]] | None = ..., a14: List[Any] | None = ..., a15: List[test_codemaker_pythonmaker_Enum2_] | None = ..., a16: List[test_codemaker_pythonmaker_Struct1_] | None = ..., a17: List[com_sun_star_uno_XInterface_] | None = ..., a18: List[com_sun_star_uno_XNamingService_] | None = ..., aa1: List[List[bool]] | None = ..., aa2: List[List[int]] | None = ..., aa3: List[List[int]] | None = ..., aa4: List[List[int]] | None = ..., aa5: List[List[int]] | None = ..., aa6: List[List[int]] | None = ..., aa7: List[List[int]] | None = ..., aa8: List[List[int]] | None = ..., aa9: List[List[float]] | None = ..., aa10: List[List[float]] | None = ..., aa11: List[List[str]] | None = ..., aa12: List[List[str]] | None = ..., aa13: List[List[Type[Any]]] | None = ..., aa14: List[List[Any]] | None = ..., aa15: List[List[test_codemaker_pythonmaker_Enum2_]] | None = ..., aa16: List[List[test_codemaker_pythonmaker_Struct1_]] | None = ..., aa17: List[List[com_sun_star_uno_XInterface_]] | None = ..., aa18: List[List[com_sun_star_uno_XNamingService_]] | None = ..., at1: List[List[bool]] | None = ..., at2: List[List[int]] | None = ..., at3: List[List[int]] | None = ..., at4: List[List[int]] | None = ..., at5: List[List[int]] | None = ..., at6: List[List[int]] | None = ..., at7: List[List[int]] | None = ..., at8: List[List[int]] | None = ..., at9: List[List[float]] | None = ..., at10: List[List[float]] | None = ..., at11: List[List[str]] | None = ..., at12: List[List[str]] | None = ..., at13: List[List[Type[Any]]] | None = ..., at14: List[List[Any]] | None = ..., at15: List[List[test_codemaker_pythonmaker_Enum2_]] | None = ..., at16: List[List[test_codemaker_pythonmaker_Struct1_]] | None = ..., at17: List[List[com_sun_star_uno_XInterface_]] | None = ..., at18: List[List[com_sun_star_uno_XNamingService_]] | None = ...) -> None: - ... - - p1: bool - p2: int - p3: int - p4: int - p5: int - p6: int - p7: int - p8: int - p9: float - p10: float - p11: str - p12: str - p13: Type[Any] - p14: Any - p15: test_codemaker_pythonmaker_Enum2_ - p16: test_codemaker_pythonmaker_Struct1_ - p17: com_sun_star_uno_XInterface_ - p18: com_sun_star_uno_XNamingService_ - t1: bool - t2: int - t3: int - t4: int - t5: int - t6: int - t7: int - t8: int - t9: float - t10: float - t11: str - t12: str - t13: Type[Any] - t14: Any - t15: test_codemaker_pythonmaker_Enum2_ - t16: test_codemaker_pythonmaker_Struct1_ - t17: com_sun_star_uno_XInterface_ - t18: com_sun_star_uno_XNamingService_ - a1: List[bool] - a2: List[int] - a3: List[int] - a4: List[int] - a5: List[int] - a6: List[int] - a7: List[int] - a8: List[int] - a9: List[float] - a10: List[float] - a11: List[str] - a12: List[str] - a13: List[Type[Any]] - a14: List[Any] - a15: List[test_codemaker_pythonmaker_Enum2_] - a16: List[test_codemaker_pythonmaker_Struct1_] - a17: List[com_sun_star_uno_XInterface_] - a18: List[com_sun_star_uno_XNamingService_] - aa1: List[List[bool]] - aa2: List[List[int]] - aa3: List[List[int]] - aa4: List[List[int]] - aa5: List[List[int]] - aa6: List[List[int]] - aa7: List[List[int]] - aa8: List[List[int]] - aa9: List[List[float]] - aa10: List[List[float]] - aa11: List[List[str]] - aa12: List[List[str]] - aa13: List[List[Type[Any]]] - aa14: List[List[Any]] - aa15: List[List[test_codemaker_pythonmaker_Enum2_]] - aa16: List[List[test_codemaker_pythonmaker_Struct1_]] - aa17: List[List[com_sun_star_uno_XInterface_]] - aa18: List[List[com_sun_star_uno_XNamingService_]] - at1: List[List[bool]] - at2: List[List[int]] - at3: List[List[int]] - at4: List[List[int]] - at5: List[List[int]] - at6: List[List[int]] - at7: List[List[int]] - at8: List[List[int]] - at9: List[List[float]] - at10: List[List[float]] - at11: List[List[str]] - at12: List[List[str]] - at13: List[List[Type[Any]]] - at14: List[List[Any]] - at15: List[List[test_codemaker_pythonmaker_Enum2_]] - at16: List[List[test_codemaker_pythonmaker_Struct1_]] - at17: List[List[com_sun_star_uno_XInterface_]] - at18: List[List[com_sun_star_uno_XNamingService_]] diff --git a/codemaker/tests/pythonmaker/test_pythonmaker.py b/codemaker/tests/pythonmaker/test_pythonmaker.py deleted file mode 100644 index e455cef2d224..000000000000 --- a/codemaker/tests/pythonmaker/test_pythonmaker.py +++ /dev/null @@ -1,246 +0,0 @@ -#! /usr/bin/env python -# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -import unittest -import os -import subprocess -import shutil -import filecmp -import glob -import sys - -from typing import Optional, List, Set - - -class TestPythonMaker(unittest.TestCase): - """Test pythonmaker tool by comparing generated stubs with expected files""" - - def setUp(self) -> None: - # Build environment - self.srcdir: str = os.environ.get("SRCDIR", os.getcwd()) - self.builddir: str = os.environ.get("BUILDDIR", os.getcwd()) - self.instdir: str = os.environ.get( - "INSTDIR", os.path.join(self.builddir, "instdir") - ) - self.workdir: str = os.environ.get( - "WORKDIR", os.path.join(self.builddir, "workdir") - ) - - # SDK tools - self.unoidl_write: Optional[str] = None - self.pythonmaker: Optional[str] = None - - sdk_patterns: List[str] = [ - os.path.join(self.instdir, "sdk", "bin"), - os.path.join(self.instdir, "LibreOffice*_SDK", "bin"), - ] - - exe_suffix: str = ".exe" if os.name == "nt" else "" - - for pattern in sdk_patterns: - for sdk_dir in glob.glob(pattern): - unoidl_path = os.path.join(sdk_dir, "unoidl-write" + exe_suffix) - pythonmaker_path = os.path.join(sdk_dir, "pythonmaker" + exe_suffix) - - if os.path.exists(unoidl_path) and os.path.exists(pythonmaker_path): - self.unoidl_write = unoidl_path - self.pythonmaker = pythonmaker_path - break - - if self.unoidl_write and self.pythonmaker: - break - - # Program directory - self.program_dir: Optional[str] - - if sys.platform == "darwin": - self.program_dir = None - app_patterns: List[str] = [ - os.path.join( - self.instdir, - "LibreOfficeDev.app", - "Contents", - "Resources", - ), - os.path.join( - self.instdir, - "LibreOffice.app", - "Contents", - "Resources", - ), - ] - for pattern in app_patterns: - if os.path.exists(pattern): - self.program_dir = pattern - break - else: - self.program_dir = os.path.join(self.instdir, "program") - - # Test paths - self.golden_dir: str = os.path.join( - self.srcdir, - "codemaker", - "tests", - "pythonmaker", - "expected_pyi_stubs", - ) - - self.idl_file: str = os.path.join( - self.srcdir, - "codemaker", - "tests", - "pythonmaker", - "idl", - "pythontypes.idl", - ) - - self.test_workdir: str = os.path.join(self.workdir, "pythonmaker_test") - os.makedirs(self.test_workdir, exist_ok=True) - - self.types_rdb: str = os.path.join( - self.workdir, "UnoApiTarget", "udkapi.rdb" - ) - - self.temp_rdb: str = os.path.join(self.test_workdir, "temptest.rdb") - self.output_dir: str = os.path.join(self.test_workdir, "generated_stubs") - - def tearDown(self) -> None: - if os.path.exists(self.test_workdir): - shutil.rmtree(self.test_workdir, ignore_errors=True) - - def test_pythonmaker_golden_comparison(self) -> None: - self.assertIsNotNone(self.unoidl_write) - self.assertIsNotNone(self.pythonmaker) - self.assertIsNotNone(self.program_dir) - - assert self.unoidl_write is not None - assert self.pythonmaker is not None - - self.assertTrue(os.path.exists(self.unoidl_write)) - self.assertTrue(os.path.exists(self.pythonmaker)) - self.assertTrue(os.path.exists(self.types_rdb)) - - self._convert_idl_to_rdb() - self._generate_python_stubs() - self._compare_with_expected_files() - - def _convert_idl_to_rdb(self) -> None: - assert self.unoidl_write is not None - - cmd: List[str] = [ - self.unoidl_write, - self.types_rdb, - self.idl_file, - self.temp_rdb, - ] - - try: - subprocess.run( - cmd, - cwd=self.test_workdir, - capture_output=True, - text=True, - check=True, - ) - self.assertTrue(os.path.exists(self.temp_rdb)) - except subprocess.CalledProcessError as e: - self.fail( - "Failed to convert IDL to RDB:\n" - + (e.stderr or "") - + "\nCommand: " - + " ".join(cmd) - ) - - def _generate_python_stubs(self) -> None: - assert self.pythonmaker is not None - - os.makedirs(self.output_dir, exist_ok=True) - - cmd: List[str] = [ - self.pythonmaker, - "-O", - self.output_dir, - self.temp_rdb, - "-X", - self.types_rdb, - ] - - try: - subprocess.run( - cmd, - cwd=self.test_workdir, - capture_output=True, - text=True, - check=True, - ) - - generated_files: List[str] = [] - for _, _, files in os.walk(self.output_dir): - for name in files: - if not name.lower().endswith(".tmp"): - generated_files.append(name) - - self.assertGreater(len(generated_files), 0) - - except subprocess.CalledProcessError as e: - self.fail( - "Failed to generate Python stubs:\n" - + (e.stderr or "") - + "\nCommand: " - + " ".join(cmd) - ) - - def _compare_with_expected_files(self) -> None: - if not os.path.exists(self.golden_dir): - self.fail("Expected directory does not exist: " + self.golden_dir) - - expected_files: List[str] = [] - for root, _, files in os.walk(self.golden_dir): - for name in files: - expected_files.append( - os.path.relpath(os.path.join(root, name), self.golden_dir) - ) - - generated_files: List[str] = [] - for root, _, files in os.walk(self.output_dir): - for name in files: - if not name.lower().endswith(".tmp"): - generated_files.append( - os.path.relpath(os.path.join(root, name), self.output_dir) - ) - - expected_set: Set[str] = set(expected_files) - generated_set: Set[str] = set(generated_files) - - missing = expected_set - generated_set - extra = generated_set - expected_set - - if missing: - self.fail("Missing generated files: " + str(missing)) - if extra: - self.fail("Unexpected generated files: " + str(extra)) - - differences: List[str] = [] - for rel_path in expected_files: - if not filecmp.cmp( - os.path.join(self.golden_dir, rel_path), - os.path.join(self.output_dir, rel_path), - shallow=False, - ): - differences.append(rel_path) - - if differences: - self.fail("File content differences found in: " + str(differences)) - - -if __name__ == "__main__": - unittest.main() - -# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file diff --git a/codemaker/tests/pythonmaker/idl/pythontypes.idl b/codemaker/tests/tests.idl similarity index 99% rename from codemaker/tests/pythonmaker/idl/pythontypes.idl rename to codemaker/tests/tests.idl index c8215efd1dc8..0994eb3a3d08 100644 --- a/codemaker/tests/pythonmaker/idl/pythontypes.idl +++ b/codemaker/tests/tests.idl @@ -1,9 +1,8 @@ - module test { module codemaker { - module pythonmaker + module codemakertests { // --- ENUMS --- // Simple enum with negative and positive values @@ -230,7 +229,7 @@ module test get raises(com::sun::star::uno::DeploymentException); }; }; - service S1 : test::codemaker::pythonmaker::XTest + service S1 : test::codemaker::codemakertests::XTest { create1(); create2([in] any... create2) raises(com::sun::star::uno::RuntimeException, @@ -452,4 +451,4 @@ module test //TODO: singleton void: com::sun::star::uno::XNamingService; singleton volatile : com::sun::star::uno::XNamingService; singleton while : com::sun::star::uno::XNamingService; - };};}; \ No newline at end of file + };};}; diff --git a/compilerplugins/clang/buriedassign.cxx b/compilerplugins/clang/buriedassign.cxx index 2974f84be998..1ee5f65ce8d6 100644 --- a/compilerplugins/clang/buriedassign.cxx +++ b/compilerplugins/clang/buriedassign.cxx @@ -14,6 +14,7 @@ #include "plugin.hxx" #include "check.hxx" +#include "compat.hxx" #include "config_clang.h" #include "clang/AST/CXXInheritance.h" #include "clang/AST/StmtVisitor.h" @@ -441,8 +442,10 @@ bool BuriedAssign::VisitIfStmt(IfStmt const* ifStmt) if (auto binaryOp2 = dyn_cast(binaryOp->getLHS()->IgnoreParenImpCasts())) { + APValue res; if (!binaryOp->getRHS()->isValueDependent() - && binaryOp->getRHS()->isCXX11ConstantExpr(compiler.getASTContext()) + && compat::isCXX11ConstantExpr(binaryOp->getRHS(), compiler.getASTContext(), + res) && isAssignmentOp(binaryOp2->getOpcode())) report(DiagnosticsEngine::Warning, "buried assignment, rather put on own line", expr->getBeginLoc()) @@ -451,8 +454,10 @@ bool BuriedAssign::VisitIfStmt(IfStmt const* ifStmt) if (auto binaryOp2 = dyn_cast(binaryOp->getRHS()->IgnoreParenImpCasts())) { + APValue res; if (!binaryOp->getLHS()->isValueDependent() - && binaryOp->getLHS()->isCXX11ConstantExpr(compiler.getASTContext()) + && compat::isCXX11ConstantExpr(binaryOp->getLHS(), compiler.getASTContext(), + res) && isAssignmentOp(binaryOp2->getOpcode())) report(DiagnosticsEngine::Warning, "buried assignment, rather put on own line", expr->getBeginLoc()) diff --git a/compilerplugins/clang/colorcheck.cxx b/compilerplugins/clang/colorcheck.cxx index 7480222900d2..38f644c6f4e3 100644 --- a/compilerplugins/clang/colorcheck.cxx +++ b/compilerplugins/clang/colorcheck.cxx @@ -19,6 +19,7 @@ #include "config_clang.h" #include "check.hxx" +#include "compat.hxx" #include "plugin.hxx" /** @@ -69,7 +70,8 @@ bool ColorCheck::VisitCXXConstructExpr(const CXXConstructExpr* constructExpr) return true; auto arg0 = constructExpr->getArg(0); - if (arg0->isCXX11ConstantExpr(compiler.getASTContext())) + APValue res; + if (compat::isCXX11ConstantExpr(arg0, compiler.getASTContext(), res)) { if (!arg0->isValueDependent()) { diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx index 03d6c3c6ac74..727233a8c936 100644 --- a/compilerplugins/clang/compat.hxx +++ b/compilerplugins/clang/compat.hxx @@ -120,6 +120,16 @@ inline const clang::Expr *getSubExprAsWritten(const clang::CastExpr *This) { return getSubExprAsWritten(const_cast(This)); } +inline bool isCXX11ConstantExpr( + clang::Expr const * expr, clang::ASTContext const & Ctx, clang::APValue & Result) +{ +#if CLANG_VERSION >= 240000 + return expr->isCXX11ConstantExpr(Ctx, Result); +#else + return expr->isCXX11ConstantExpr(Ctx, &Result); +#endif +} + inline bool isUnnamedBitField(clang::FieldDecl const * decl) { #if CLANG_VERSION >= 190000 return decl->isUnnamedBitField(); diff --git a/compilerplugins/clang/conststringvar.cxx b/compilerplugins/clang/conststringvar.cxx index 99cfb01c06f7..86b8be50bf77 100644 --- a/compilerplugins/clang/conststringvar.cxx +++ b/compilerplugins/clang/conststringvar.cxx @@ -12,6 +12,7 @@ #include #include "check.hxx" +#include "compat.hxx" #include "plugin.hxx" // Find non-const vars of 'char const *' type initialized with a const expr, @@ -122,7 +123,7 @@ public: return true; } APValue v; - if (!init->isCXX11ConstantExpr(compiler.getASTContext(), &v)) { + if (!compat::isCXX11ConstantExpr(init, compiler.getASTContext(), v)) { return true; } vars_.insert(decl); diff --git a/compilerplugins/clang/consttobool.cxx b/compilerplugins/clang/consttobool.cxx index 831ef6d300ac..5e4e59d698c0 100644 --- a/compilerplugins/clang/consttobool.cxx +++ b/compilerplugins/clang/consttobool.cxx @@ -16,6 +16,7 @@ #include "clang/Basic/Builtins.h" #include "check.hxx" +#include "compat.hxx" #include "plugin.hxx" // Find implicit conversions from non-'bool' constants (e.g., 'sal_False') to 'bool'. @@ -156,7 +157,7 @@ public: return true; } APValue res; - if (!sub->isCXX11ConstantExpr(compiler.getASTContext(), &res)) + if (!compat::isCXX11ConstantExpr(sub, compiler.getASTContext(), res)) { return true; } diff --git a/compilerplugins/clang/cppunitassertequals.cxx b/compilerplugins/clang/cppunitassertequals.cxx index df50f57537bc..5b5b054957ea 100644 --- a/compilerplugins/clang/cppunitassertequals.cxx +++ b/compilerplugins/clang/cppunitassertequals.cxx @@ -232,8 +232,12 @@ Expr const * stripConstructor(Expr const * expr) { bool CppunitAssertEquals::isCompileTimeConstant(Expr const * expr) { - if (expr->isCXX11ConstantExpr(compiler.getASTContext())) + APValue res; + if (!expr->isValueDependent() + && compat::isCXX11ConstantExpr(expr, compiler.getASTContext(), res)) + { return true; + } // is string literal ? expr = expr->IgnoreParenImpCasts(); expr = stripConstructor(expr); diff --git a/compilerplugins/clang/fieldcanbelocal.cxx b/compilerplugins/clang/fieldcanbelocal.cxx index 4a50ca81b799..52388e3ca297 100644 --- a/compilerplugins/clang/fieldcanbelocal.cxx +++ b/compilerplugins/clang/fieldcanbelocal.cxx @@ -453,7 +453,8 @@ bool FieldCanBeLocal::isSomeKindOfConstant(const Expr* arg) assert(arg); if (arg->isValueDependent()) return false; - return arg->isCXX11ConstantExpr(compiler.getASTContext()); + APValue res; + return compat::isCXX11ConstantExpr(arg, compiler.getASTContext(), res); } loplugin::Plugin::Registration X("fieldcanbelocal", false); diff --git a/compilerplugins/clang/getimplementationname.cxx b/compilerplugins/clang/getimplementationname.cxx index 9c91a62310c2..034d73f49084 100644 --- a/compilerplugins/clang/getimplementationname.cxx +++ b/compilerplugins/clang/getimplementationname.cxx @@ -20,6 +20,7 @@ #include #include #include "check.hxx" +#include "compat.hxx" #include "plugin.hxx" #include "clang/Frontend/CompilerInstance.h" @@ -177,7 +178,7 @@ bool GetImplementationName::isStringConstant( return true; } APValue v; - if (!expr->isCXX11ConstantExpr(compiler.getASTContext(), &v)) { + if (!compat::isCXX11ConstantExpr(expr, compiler.getASTContext(), v)) { return false; } switch (v.getKind()) { diff --git a/compilerplugins/clang/moveparam.cxx b/compilerplugins/clang/moveparam.cxx index dc7a84b4d64d..93484ef60b5f 100644 --- a/compilerplugins/clang/moveparam.cxx +++ b/compilerplugins/clang/moveparam.cxx @@ -90,12 +90,6 @@ bool MoveParam::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr* callExpr) if (!loplugin::TypeCheck(parmVarDecl->getType()).LvalueReference().Const()) return true; - StringRef aFileName = getFilenameOfLocation( - compiler.getSourceManager().getSpellingLoc(parmVarDecl->getBeginLoc())); - if (loplugin::hasPathnamePrefix(aFileName, - SRCDIR "/svx/source/sidebar/line/LineWidthValueSet.cxx")) - return true; - report(DiagnosticsEngine::Warning, "rather use move && param1", callExpr->getBeginLoc()); return true; diff --git a/compilerplugins/clang/smartpointerderefaddress.cxx b/compilerplugins/clang/smartpointerderefaddress.cxx new file mode 100644 index 000000000000..28b22566dce5 --- /dev/null +++ b/compilerplugins/clang/smartpointerderefaddress.cxx @@ -0,0 +1,136 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef LO_CLANG_SHARED_PLUGINS + +#include +#include +#include +#include +#include + +#include + +#include "check.hxx" +#include "plugin.hxx" + +/** + * Look for: + * &(*x) + * when x is a smart pointer like unique_ptr. That can be transformed to: + * x.get() + * + * This is important when x is null, because in that case *x is undefined behavior. This can lead to + * difficult bugs because the compiler will often let you get away with it, but some compilers might + * also take advantage of that to assume that x is never null and then optimise away chunks of code. + * See tdf#173585 for an example. + * + * Either way x.get() is easier to understand. + * + * Whether the object is a smart pointer or not is determined by whether it has a get() method which + * returns the same type as the original expression. + */ + +namespace +{ +class SmartPointerDerefAddress : public loplugin::FilteringPlugin +{ +public: + explicit SmartPointerDerefAddress(loplugin::InstantiationData const& data) + : FilteringPlugin(data) + { + } + + virtual void run() override + { + if (preRun()) + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + + bool VisitUnaryOperator(UnaryOperator const*); +}; + +bool cxxRecordHasGetMethod(const CXXRecordDecl* recordDecl, const QualType& expressionType) +{ + for (auto method : recordDecl->methods()) + { + if (!method->isInstance() || method->param_size() != 0 + || !loplugin::DeclCheck(method).Function("get")) + { + continue; + } + + QualType returnType = method->getReturnType().getUnqualifiedType().getCanonicalType(); + + if (returnType == expressionType) + return true; + } + + return false; +} + +bool cxxRecordOrBaseHasGetMethod(const CXXRecordDecl* recordDecl, const QualType& expressionType) +{ + if (cxxRecordHasGetMethod(recordDecl, expressionType)) + return true; + + auto baseCallback = [&](const CXXRecordDecl* baseRecordDecl) { + return !cxxRecordHasGetMethod(baseRecordDecl, expressionType); + }; + + return !recordDecl->forallBases(baseCallback); +} + +bool SmartPointerDerefAddress::VisitUnaryOperator(UnaryOperator const* unaryOperator) +{ + if (ignoreLocation(unaryOperator)) + return true; + if (unaryOperator->getBeginLoc().isMacroID()) + return true; + if (unaryOperator->getOpcode() != UO_AddrOf) + return true; + auto subExpr = unaryOperator->getSubExpr()->IgnoreParenImpCasts(); + auto innerOp = dyn_cast(subExpr); + if (!innerOp || innerOp->getOperator() != OO_Star) + return true; + + const Expr* derefedExpr = innerOp->getArg(0); + + // Remove any implicit casts so we can get the type of the original expression, not the one + // where operator* is defined + while (const ImplicitCastExpr* castExpr = dyn_cast(derefedExpr)) + derefedExpr = castExpr->getSubExpr(); + + // Check if the dereferenced type is a struct or a class that also has a get method that returns + // the same type as the whole expression + const CXXRecordDecl* recordDecl = derefedExpr->getType()->getAsCXXRecordDecl(); + + if (!recordDecl) + return true; + + QualType expressionType = unaryOperator->getType().getUnqualifiedType().getCanonicalType(); + + if (cxxRecordOrBaseHasGetMethod(recordDecl, expressionType)) + { + report(DiagnosticsEngine::Warning, + "'*' followed by '&' operating on %0, rather use '.get()'", + unaryOperator->getBeginLoc()) + << innerOp->getArg(0)->getType() << unaryOperator->getSourceRange(); + } + + return true; +} + +loplugin::Plugin::Registration + smartpointerderefaddress("smartpointerderefaddress"); + +} // namespace + +#endif // LO_CLANG_SHARED_PLUGINS + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx index c3d4d538f02d..791b3707cb00 100644 --- a/compilerplugins/clang/stringconstant.cxx +++ b/compilerplugins/clang/stringconstant.cxx @@ -1557,7 +1557,7 @@ bool StringConstant::isStringConstant( return true; } APValue v; - if (!expr->isCXX11ConstantExpr(compiler.getASTContext(), &v)) { + if (!compat::isCXX11ConstantExpr(expr, compiler.getASTContext(), v)) { return false; } switch (v.getKind()) { diff --git a/compilerplugins/clang/test/smartpointerderefaddress.cxx b/compilerplugins/clang/test/smartpointerderefaddress.cxx new file mode 100644 index 000000000000..bf378e36348c --- /dev/null +++ b/compilerplugins/clang/test/smartpointerderefaddress.cxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include + +namespace sw +{ +// Mockup of UnoCursorPointer because it’s probably difficult to include the header +class UnoCursorPointer +{ +public: + int& operator*() { return *m_pInteger; }; + int* get() { return m_pInteger; }; + +private: + int* m_pInteger; +}; +} + +int* function1(std::unique_ptr& x) +{ + return &*x; // expected-error-re {{'*' followed by '&' operating on '{{.*}}unique_ptr{{.*}}', rather use '.get()' [loplugin:smartpointerderefaddress]}} +} + +int* function2(std::shared_ptr& x) +{ + return &*x; // expected-error-re {{'*' followed by '&' operating on '{{.*}}shared_ptr{{.*}}', rather use '.get()' [loplugin:smartpointerderefaddress]}} +} + +int* function3(sw::UnoCursorPointer& x) +{ + return &*x; // expected-error-re {{'*' followed by '&' operating on '{{.*}}UnoCursorPointer{{.*}}', rather use '.get()' [loplugin:smartpointerderefaddress]}} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/config_host/config_md4c.h.in b/config_host/config_md4c.h.in new file mode 100644 index 000000000000..510693f3d3de --- /dev/null +++ b/config_host/config_md4c.h.in @@ -0,0 +1,7 @@ +#ifndef CONFIG_MD4C_H +#define CONFIG_MD4C_H + +#undef MD4C_MAJOR +#undef MD4C_MINOR + +#endif diff --git a/configure.ac b/configure.ac index 2b9a769034cb..48e2fc0a622c 100644 --- a/configure.ac +++ b/configure.ac @@ -10162,6 +10162,8 @@ if test "x$with_system_md4c" = "xauto"; then fi AC_MSG_CHECKING([which md4c to use]) +MD4C_MAJOR=0 +MD4C_MINOR=6 case "$with_system_md4c" in yes) AC_MSG_RESULT([system]) @@ -10181,6 +10183,10 @@ case "$with_system_md4c" in AC_CHECK_LIB([md4c-html], [md_html], [ MD4C_LIBS="$MD4C_LIBS -lmd4c-html" ], [ AC_MSG_ERROR([system md4c-html library not found or broken.]) ]) + + MD4C_VERSION=`$PKG_CONFIG --modversion md4c 2>/dev/null` + MD4C_MAJOR=`echo $MD4C_VERSION | cut -d"." -f1` + MD4C_MINOR=`echo $MD4C_VERSION | cut -d"." -f2` ;; ""|no) @@ -10201,6 +10207,9 @@ AC_SUBST(MD4C_LIBS) AC_SUBST(MD4C_CFLAGS) AC_SUBST(BUILD_TYPE) +AC_DEFINE_UNQUOTED(MD4C_MAJOR,$MD4C_MAJOR) +AC_DEFINE_UNQUOTED(MD4C_MINOR,$MD4C_MINOR) + dnl =================================================================== dnl Check for system jpeg dnl =================================================================== @@ -10855,7 +10864,7 @@ if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_pyt SYSTEM_PYTHON= PYTHON_VERSION_MAJOR=3 PYTHON_VERSION_MINOR=13 - PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.15 + PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.16 if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst]) fi @@ -16583,6 +16592,7 @@ AC_CONFIG_HEADERS([config_host/config_lgpl.h]) AC_CONFIG_HEADERS([config_host/config_libcxx.h]) AC_CONFIG_HEADERS([config_host/config_liblangtag.h]) AC_CONFIG_HEADERS([config_host/config_locales.h]) +AC_CONFIG_HEADERS([config_host/config_md4c.h]) AC_CONFIG_HEADERS([config_host/config_mpl.h]) AC_CONFIG_HEADERS([config_host/config_oox.h]) AC_CONFIG_HEADERS([config_host/config_options.h]) diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 93884155048c..f3892457b207 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -79,7 +79,9 @@ namespace connectivity : ODriverDelegator_BASE(m_aMutex) ,m_xContext(_rxContext) ,m_bInShutDownConnections(false) + ,m_aDatabaseDirectory(nullptr, true) { + m_aDatabaseDirectory.EnableKillingFile(true); } @@ -199,8 +201,33 @@ namespace connectivity ::comphelper::NamedValueCollection aProperties; + // The database path keeps the document's file name as its last part, because the + // streams in older documents are named after it. + OUString sKey = StorageContainer::getRegisteredKey(xStorage); + OUString sDatabasePath; + if (!sKey.isEmpty()) + sDatabasePath = StorageContainer::getRegisteredStorage(sKey).url; + else + { + OUString sDirectoryPath; + if (m_aDatabaseDirectory.IsValid()) + { + const OUString sDirectoryURL + = ::utl::CreateTempURL(&m_aDatabaseDirectory.GetURL(), true); + osl_getSystemPathFromFileURL(sDirectoryURL.pData, &sDirectoryPath.pData); + } + if (sDirectoryPath.isEmpty()) + { + ::connectivity::SharedResources aResources; + const OUString sMessage = aResources.getResourceString(STR_NO_STORAGE); + ::dbtools::throwGenericSQLException(sMessage ,*this); + } + sDatabasePath = sDirectoryPath + OUStringChar(SAL_PATHDELIMITER) + + StorageContainer::removeOldURLPrefix(sSystemPath); + sKey = StorageContainer::registerStorage(xStorage, sDatabasePath); + } + // properties for accessing the embedded storage - OUString sKey = StorageContainer::registerStorage( xStorage, sSystemPath ); aProperties.put( u"storage_key"_ustr, sKey ); aProperties.put( u"storage_class_name"_ustr, u"com.sun.star.sdbcx.comp.hsqldb.StorageAccess"_ustr ); @@ -339,7 +366,7 @@ namespace connectivity Sequence< PropertyValue > aConnectionArgs; aProperties >>= aConnectionArgs; - OUString sConnectURL = "jdbc:hsqldb:" + sSystemPath; + OUString sConnectURL = "jdbc:hsqldb:" + sDatabasePath; Reference xOrig; try { diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx index 89b806564cfc..b0d4379ea454 100644 --- a/connectivity/source/drivers/odbc/OConnection.cxx +++ b/connectivity/source/drivers/odbc/OConnection.cxx @@ -27,7 +27,9 @@ #include #include +#include #include +#include using namespace connectivity::odbc; using namespace connectivity; @@ -166,6 +168,20 @@ SQLRETURN OConnection::OpenConnection(const OUString& aConnectStr, sal_Int32 nTi return nSQLRETURN; } +namespace +{ +// An attribute value ends at the next ";" unless it is in braces, and a braced value ends at the +// first "}". +OUString quoteValue(const OUString& rValue, OConnection& rConnection) +{ + if (rValue.indexOf(';') == -1 && !o3tl::starts_with(o3tl::trim(rValue), u"{")) + return rValue; + if (rValue.indexOf('}') != -1) + rConnection.throwGenericSQLException(STR_URI_SYNTAX_ERROR, rConnection); + return "{" + rValue + "}"; +} +} + SQLRETURN OConnection::Construct(const OUString& url,const Sequence< PropertyValue >& info) { m_aConnectionHandle = SQL_NULL_HANDLE; @@ -179,7 +195,7 @@ SQLRETURN OConnection::Construct(const OUString& url,const Sequence< PropertyVal sal_Int32 nLen = url.indexOf(':'); nLen = url.indexOf(':',nLen+2); OUString aDSN(u"DSN="_ustr), aUID, aPWD, aSysDrvSettings; - aDSN += url.subView(nLen+1); + aDSN += quoteValue(OUString(url.subView(nLen+1)), *this); sal_Int32 nTimeout = 20; bool bSilent = true; @@ -223,13 +239,13 @@ SQLRETURN OConnection::Construct(const OUString& url,const Sequence< PropertyVal { if (!(rPropertyValue.Value >>= aUID)) SAL_WARN("connectivity.odbc", "Construct: unable to get property user"); - aDSN += ";UID=" + aUID; + aDSN += ";UID=" + quoteValue(aUID, *this); } else if (rPropertyValue.Name == "password") { if (!(rPropertyValue.Value >>= aPWD)) SAL_WARN("connectivity.odbc", "Construct: unable to get property password"); - aDSN += ";PWD=" + aPWD; + aDSN += ";PWD=" + quoteValue(aPWD, *this); } else if (rPropertyValue.Name == "UseCatalog") { diff --git a/connectivity/source/inc/hsqldb/HDriver.hxx b/connectivity/source/inc/hsqldb/HDriver.hxx index 7b4735517fd5..bfa3f2a0274b 100644 --- a/connectivity/source/inc/hsqldb/HDriver.hxx +++ b/connectivity/source/inc/hsqldb/HDriver.hxx @@ -27,6 +27,7 @@ #include #include #include +#include #include @@ -62,6 +63,9 @@ namespace connectivity::hsqldb css::uno::Reference< css::sdbc::XDriver > m_xDriver; css::uno::Reference< css::uno::XComponentContext > m_xContext; bool m_bInShutDownConnections; + // Private directory, removed with its contents when the driver goes away. It holds one + // subdirectory per registered storage, and that storage's database path lies inside it. + ::utl::TempFileNamed m_aDatabaseDirectory; /** load the driver we want to delegate. The m_xDriver may be if the driver could not be loaded. diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 6166c981934a..b510c06e6bab 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -769,7 +769,7 @@ void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef, OUString& _rTableRange, OUString& _out_rColumnAliasIfPresent ) const { - lcl_getColumnRange( _pColumnRef, m_pImpl->m_xConnection, _rColumnName, _rTableRange, &*m_aSelectColumns, _out_rColumnAliasIfPresent ); + lcl_getColumnRange( _pColumnRef, m_pImpl->m_xConnection, _rColumnName, _rTableRange, m_aSelectColumns.get(), _out_rColumnAliasIfPresent ); } diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx index 8bbec8a6eccf..70dbec1e1678 100644 --- a/cui/source/dialogs/linkdlg.cxx +++ b/cui/source/dialogs/linkdlg.cxx @@ -481,7 +481,7 @@ IMPL_LINK( SvBaseLinksDlg, EndEditHdl, sfx2::SvBaseLink&, _rLink, void ) // edited link needs to be refreshed. bool bLinkFnd = false; for( size_t n = pLinkMgr->GetLinks().size(); n; ) - if( &_rLink == &(*pLinkMgr->GetLinks()[ --n ]) ) + if( &_rLink == pLinkMgr->GetLinks()[ --n ].get() ) { bLinkFnd = true; break; diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 20cb242cc2d1..ea309f2f0cee 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -158,8 +157,7 @@ class SvxTransparenceTabPage : public SfxTabPage bool bBitmap; - XFillAttrSetItem aXFillAttr; - SfxItemSet& rXFSet; + SfxItemSet m_aFillAttributeSet; SvxXRectPreview m_aCtlBitmapPreview; SvxXRectPreview m_aCtlXRectPreview; @@ -253,8 +251,7 @@ private: ChangeType* m_pnColorListState; - XFillAttrSetItem m_aXFillAttr; - SfxItemSet& m_rXFSet; + SfxItemSet m_aFillAttributeSet; bool m_bBtnClicked = false; @@ -328,8 +325,7 @@ private: PageType m_nPageType; sal_uInt16 m_nDlgType; - XFillAttrSetItem m_aXFillAttr; - SfxItemSet& m_rXFSet; + SfxItemSet m_aFillAttributeSet; MapUnit m_ePoolUnit; SvxRectCtl m_aCtlPosition; @@ -380,8 +376,7 @@ private: ChangeType m_nGradientListState; ChangeType* m_pnColorListState; - XFillAttrSetItem m_aXFillAttr; - SfxItemSet& m_rXFSet; + SfxItemSet m_aFillAttributeSet; // MCGR: Preserve ColorStops until we have a UI to edit these basegfx::BColorStops m_aColorStops; @@ -461,8 +456,7 @@ private: ChangeType m_nHatchingListState; ChangeType* m_pnColorListState; - XFillAttrSetItem m_aXFillAttr; - SfxItemSet& m_rXFSet; + SfxItemSet m_aFillAttributeSet; MapUnit m_ePoolUnit; @@ -532,8 +526,7 @@ class SvxBitmapTabPage : public SfxTabPage double m_fObjectHeight; bool m_bLogicalSize; - XFillAttrSetItem m_aXFillAttr; - SfxItemSet& m_rXFSet; + SfxItemSet m_aFillAttributeSet; const SdrView* mpView; MapUnit mePoolUnit; FieldUnit meFieldUnit; @@ -607,8 +600,7 @@ private: ChangeType m_nPatternListState; ChangeType* m_pnColorListState; - XFillAttrSetItem m_aXFillAttr; - SfxItemSet& m_rXFSet; + SfxItemSet m_aFillAttributeSet; SvxXRectPreview m_aCtlPreview; std::unique_ptr m_xCtlPixel; @@ -671,8 +663,7 @@ private: ChangeType* m_pnColorListState; - XFillAttrSetItem m_aXFillAttr; - SfxItemSet& m_rXFSet; + SfxItemSet m_aFillAttributeSet; ColorModel m_eCM; diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx index 63d555d08be1..b9cff3ce0612 100644 --- a/cui/source/inc/cuitabline.hxx +++ b/cui/source/inc/cuitabline.hxx @@ -25,7 +25,7 @@ #include #include #include -#include +// #include #include #include #include @@ -122,8 +122,7 @@ private: const SfxItemSet& m_rOutAttrs; bool m_bObjSelected; - XLineAttrSetItem m_aXLineAttr; - SfxItemSet& m_rXLSet; + SfxItemSet m_aLineAttributeSet; XDashListRef m_pDashList; XLineEndListRef m_pLineEndList; @@ -250,8 +249,7 @@ private: const SfxItemSet& rOutAttrs; XDash aDash; - XLineAttrSetItem aXLineAttr; - SfxItemSet& rXLSet; + SfxItemSet m_aLineAttributeSet; XDashListRef pDashList; @@ -330,8 +328,7 @@ private: const SfxItemSet& rOutAttrs; const SdrObject* pPolyObj; - XLineAttrSetItem aXLineAttr; - SfxItemSet& rXLSet; + SfxItemSet m_aLineAttributeSet; XLineEndListRef pLineEndList; diff --git a/cui/source/inc/labdlg.hxx b/cui/source/inc/labdlg.hxx index ca70d48dc082..6d4d13883c89 100644 --- a/cui/source/inc/labdlg.hxx +++ b/cui/source/inc/labdlg.hxx @@ -18,13 +18,14 @@ */ #pragma once -#include #include #include #include #include #include #include +#include +#include #include #include #include @@ -33,15 +34,11 @@ class SdrView; // class SvxCaptionTabPage ----------------------------------------------- -const sal_uInt16 CAPTYPE_BITMAPS_COUNT = 3; - class SvxCaptionTabPage : public SfxTabPage { private: static const WhichRangesContainer pCaptionRanges; - Image m_aBmpCapTypes[CAPTYPE_BITMAPS_COUNT]; - std::vector m_aStrHorzList; std::vector m_aStrVertList; @@ -70,15 +67,14 @@ private: std::unique_ptr m_xFT_LENGTHFT; std::unique_ptr m_xMF_LENGTH; std::unique_ptr m_xCB_OPTIMAL; - std::unique_ptr m_xCT_CAPTTYPE; - std::unique_ptr m_xCT_CAPTTYPEWin; + std::unique_ptr m_xCT_CAPTTYPE; void SetupExtension_Impl( sal_uInt16 nType ); void SetupType_Impl( SdrCaptionType nType ); DECL_LINK(ExtensionSelectHdl_Impl, weld::ComboBox&, void); DECL_LINK(PositionSelectHdl_Impl, weld::ComboBox&, void); DECL_LINK(LineOptHdl_Impl, weld::Toggleable&, void); - DECL_LINK(SelectCaptTypeHdl_Impl, ValueSet*, void); + DECL_LINK(CaptionTypeActivatedHdl, const weld::TreeIter&, bool); public: SvxCaptionTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); @@ -92,8 +88,6 @@ public: void Construct(); void SetView( const SdrView* pSdrView ) { pView = pSdrView; } - - void FillValueSet(); }; // class SvxCaptionTabDialog --------------------------------------------- diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx index a2af733f6d23..ee504be855b4 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -46,6 +46,7 @@ class ColorListBox; class SvxNumValueSet; class SvxNumRule; class SvxBmpNumValueSet; +class ValueSet; struct ImplSVEvent; struct SvxNumSettings_Impl diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx index 6786183dd78c..1a9bc9a182d0 100644 --- a/cui/source/tabpages/labdlg.cxx +++ b/cui/source/tabpages/labdlg.cxx @@ -36,7 +36,6 @@ #include #include -#include // define ---------------------------------------------------------------- @@ -50,9 +49,9 @@ #define POS_MIDDLE 1 #define POS_BOTTOM 2 -#define BMP_CAPTTYPE_1 1 -#define BMP_CAPTTYPE_2 2 -#define BMP_CAPTTYPE_3 3 +#define BMP_CAPTTYPE_1 0 +#define BMP_CAPTTYPE_2 1 +#define BMP_CAPTTYPE_3 2 // static ---------------------------------------------------------------- @@ -88,12 +87,8 @@ SvxCaptionTabPage::SvxCaptionTabPage(weld::Container* pPage, weld::DialogControl , m_xFT_LENGTHFT(m_xBuilder->weld_label(u"lengthft"_ustr)) , m_xMF_LENGTH(m_xBuilder->weld_metric_spin_button(u"length"_ustr, FieldUnit::MM)) , m_xCB_OPTIMAL(m_xBuilder->weld_check_button(u"optimal"_ustr)) - , m_xCT_CAPTTYPE(new ValueSet(m_xBuilder->weld_scrolled_window(u"valuesetwin"_ustr, true))) - , m_xCT_CAPTTYPEWin(new weld::CustomWeld(*m_xBuilder, u"valueset"_ustr, *m_xCT_CAPTTYPE)) + , m_xCT_CAPTTYPE(m_xBuilder->weld_icon_view("iconview")) { - Size aSize(m_xCT_CAPTTYPE->GetDrawingArea()->get_ref_device().LogicToPixel(Size(187, 38), MapMode(MapUnit::MapAppFont))); - m_xCT_CAPTTYPEWin->set_size_request(aSize.Width(), aSize.Height()); - assert(m_xLB_POSITION->get_count() == 6); for (int i = 0; i < 3; ++i) m_aStrHorzList.push_back(m_xLB_POSITION->get_text(i)); @@ -107,34 +102,27 @@ SvxCaptionTabPage::SvxCaptionTabPage(weld::Container* pPage, weld::DialogControl for (int i = 0; i < 3; ++i) aLineTypes.push_back(m_xLineTypes->get_text(i)); - static_assert(CAPTYPE_BITMAPS_COUNT == 3, "unexpected"); - m_aBmpCapTypes[0] = Image(StockImage::Yes, RID_SVXBMP_LEGTYP1); - m_aBmpCapTypes[1] = Image(StockImage::Yes, RID_SVXBMP_LEGTYP2); - m_aBmpCapTypes[2] = Image(StockImage::Yes, RID_SVXBMP_LEGTYP3); + m_xCT_CAPTTYPE->connect_item_activated(LINK(this, SvxCaptionTabPage, CaptionTypeActivatedHdl)); - //------------install ValueSet-------------------------- - m_xCT_CAPTTYPE->SetStyle( m_xCT_CAPTTYPE->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD ); - m_xCT_CAPTTYPE->SetColCount(5);//XXX - m_xCT_CAPTTYPE->SetLineCount(1); - m_xCT_CAPTTYPE->SetSelectHdl(LINK( this, SvxCaptionTabPage, SelectCaptTypeHdl_Impl)); - - Image aImage; - m_xCT_CAPTTYPE->InsertItem(BMP_CAPTTYPE_1, aImage, aLineTypes[0]); - m_xCT_CAPTTYPE->InsertItem(BMP_CAPTTYPE_2, aImage, aLineTypes[1]); - m_xCT_CAPTTYPE->InsertItem(BMP_CAPTTYPE_3, aImage, aLineTypes[2]); - - FillValueSet(); + const Bitmap aBitmapCaptionType1 = Image(StockImage::Yes, RID_SVXBMP_LEGTYP1).GetBitmap(); + m_xCT_CAPTTYPE->insert(BMP_CAPTTYPE_1, nullptr, nullptr, &aBitmapCaptionType1, nullptr); + m_xCT_CAPTTYPE->set_item_accessible_name(BMP_CAPTTYPE_1, aLineTypes[0]); + m_xCT_CAPTTYPE->set_item_tooltip_text(BMP_CAPTTYPE_1, aLineTypes[0]); + const Bitmap aBitmapCaptionType2 = Image(StockImage::Yes, RID_SVXBMP_LEGTYP2).GetBitmap(); + m_xCT_CAPTTYPE->insert(BMP_CAPTTYPE_2, nullptr, nullptr, &aBitmapCaptionType2, nullptr); + m_xCT_CAPTTYPE->set_item_accessible_name(BMP_CAPTTYPE_2, aLineTypes[1]); + m_xCT_CAPTTYPE->set_item_tooltip_text(BMP_CAPTTYPE_2, aLineTypes[1]); + const Bitmap aBitmapCaptionType3 = Image(StockImage::Yes, RID_SVXBMP_LEGTYP3).GetBitmap(); + m_xCT_CAPTTYPE->insert(BMP_CAPTTYPE_3, nullptr, nullptr, &aBitmapCaptionType3, nullptr); + m_xCT_CAPTTYPE->set_item_accessible_name(BMP_CAPTTYPE_3, aLineTypes[2]); + m_xCT_CAPTTYPE->set_item_tooltip_text(BMP_CAPTTYPE_3, aLineTypes[2]); m_xLB_EXTENSION->connect_changed(LINK(this, SvxCaptionTabPage, ExtensionSelectHdl_Impl)); m_xLB_POSITION->connect_changed(LINK(this, SvxCaptionTabPage, PositionSelectHdl_Impl)); m_xCB_OPTIMAL->connect_toggled(LINK(this, SvxCaptionTabPage, LineOptHdl_Impl)); } -SvxCaptionTabPage::~SvxCaptionTabPage() -{ - m_xCT_CAPTTYPEWin.reset(); - m_xCT_CAPTTYPE.reset(); -} +SvxCaptionTabPage::~SvxCaptionTabPage() { m_xCT_CAPTTYPE.reset(); } void SvxCaptionTabPage::Construct() { @@ -149,7 +137,7 @@ bool SvxCaptionTabPage::FillItemSet( SfxItemSet* _rOutAttrs) MapUnit eUnit; - nCaptionType = static_cast(m_xCT_CAPTTYPE->GetSelectedItemId()-1); + nCaptionType = static_cast(m_xCT_CAPTTYPE->get_selected_index()); _rOutAttrs->Put( SdrCaptionTypeItem( nCaptionType ) ); @@ -326,7 +314,7 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* ) m_xLB_EXTENSION->set_active(nExtension); SetupExtension_Impl( nExtension ); - m_xCT_CAPTTYPE->SelectItem( static_cast(nCaptionType)+1 ); // Enum starts at 0! + m_xCT_CAPTTYPE->select(static_cast(nCaptionType)); SetupType_Impl( nCaptionType ); } @@ -425,9 +413,11 @@ IMPL_LINK( SvxCaptionTabPage, LineOptHdl_Impl, weld::Toggleable&, rButton, void } } -IMPL_LINK_NOARG(SvxCaptionTabPage, SelectCaptTypeHdl_Impl, ValueSet*, void) +IMPL_LINK(SvxCaptionTabPage, CaptionTypeActivatedHdl, const weld::TreeIter&, rIter, bool) { - SetupType_Impl( static_cast(m_xCT_CAPTTYPE->GetSelectedItemId()) ); + SetupType_Impl( + static_cast(m_xCT_CAPTTYPE->get_iter_index_in_parent(rIter) + 1)); + return true; } void SvxCaptionTabPage::SetupType_Impl( SdrCaptionType nType ) @@ -449,13 +439,6 @@ void SvxCaptionTabPage::SetupType_Impl( SdrCaptionType nType ) } } -void SvxCaptionTabPage::FillValueSet() -{ - m_xCT_CAPTTYPE->SetItemImage(BMP_CAPTTYPE_1, m_aBmpCapTypes[0] ); - m_xCT_CAPTTYPE->SetItemImage(BMP_CAPTTYPE_2, m_aBmpCapTypes[1] ); - m_xCT_CAPTTYPE->SetItemImage(BMP_CAPTTYPE_3, m_aBmpCapTypes[2] ); -} - SvxCaptionTabDialog::SvxCaptionTabDialog(weld::Window* pParent, const SdrView* pSdrView, SvxAnchorIds nAnchorTypes) : SfxTabDialogController(pParent, u"cui/ui/calloutdialog.ui"_ustr, u"CalloutDialog"_ustr) diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index a9e246b4efce..760ab3e83279 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -1710,15 +1710,20 @@ IMPL_LINK_NOARG(SvxParaAlignTabPage, AlignHdl_Impl, weld::Toggleable&, void) m_xLabelMinimum->set_sensitive(bJustify); m_xLabelDesired->set_sensitive(bJustify); m_xLabelMaximum->set_sensitive(bJustify); + m_xLabelLetterSpacing->set_sensitive(bJustify); m_xWordSpacing->set_sensitive(bJustify); m_xWordSpacingMinimum->set_sensitive(bJustify); m_xWordSpacingMaximum->set_sensitive(bJustify); m_xWordSpacingMaximum->set_sensitive(bJustify); m_xParagraphComposer->set_sensitive(bJustify); + if (bJustify && m_xParagraphComposer->get_state() == TRISTATE_INDET) + m_xParagraphComposer->set_active(false); // TODO visualize CharKerning with percentage m_xLetterSpacingMinimum->set_sensitive(bJustify); m_xLetterSpacingMaximum->set_sensitive(bJustify); m_xCompoundBased->set_sensitive(bJustify); + if (bJustify && m_xCompoundBased->get_state() == TRISTATE_INDET) + m_xCompoundBased->set_active(false); m_xLabelGlyphScaling->set_sensitive(bJustify); // TODO visualize CharScaleWidth with percentage m_xGlyphScalingMinimum->set_sensitive(bJustify); diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index b137aff0e73b..739b72dc8e18 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -79,8 +79,7 @@ SvxAreaTabPage::SvxAreaTabPage(weld::Container* pPage, weld::DialogController* p , maFixed_ChangeType(ChangeType::NONE) // init with pointers to fixed ChangeType , m_pnColorListState(&maFixed_ChangeType) - , m_aXFillAttr(rInAttrs.GetPool()) - , m_rXFSet(m_aXFillAttr.GetItemSet()) + , m_aFillAttributeSet(rInAttrs.getPool(), WhichRangesContainer(XATTR_FILL_FIRST, XATTR_FILL_LAST)) , m_xFillTab(m_xBuilder->weld_container(u"fillstylebox"_ustr)) , m_xBtnNone(m_xBuilder->weld_toggle_button(u"btnnone"_ustr)) , m_xBtnColor(m_xBuilder->weld_toggle_button(u"btncolor"_ustr)) @@ -120,30 +119,30 @@ void SvxAreaTabPage::SetOptimalSize(weld::DialogController* pController) m_xFillTab->set_size_request(-1, -1); // Calculate optimal size of all pages... - m_xFillTabPage = SvxColorTabPage::Create(m_xFillTab.get(), pController, m_rXFSet); + m_xFillTabPage = SvxColorTabPage::Create(m_xFillTab.get(), pController, m_aFillAttributeSet); Size aSize(m_xFillTab->get_preferred_size()); if (m_xBtnGradient->get_visible()) { - m_xFillTabPage = SvxGradientTabPage::Create(m_xFillTab.get(), pController, m_rXFSet); + m_xFillTabPage = SvxGradientTabPage::Create(m_xFillTab.get(), pController, m_aFillAttributeSet); Size aGradientSize = m_xFillTab->get_preferred_size(); lclExtendSize(aSize, aGradientSize); } if (m_xBtnBitmap->get_visible()) { - m_xFillTabPage = SvxBitmapTabPage::Create(m_xFillTab.get(), pController, m_rXFSet); + m_xFillTabPage = SvxBitmapTabPage::Create(m_xFillTab.get(), pController, m_aFillAttributeSet); Size aBitmapSize = m_xFillTab->get_preferred_size(); lclExtendSize(aSize, aBitmapSize); } if (m_xBtnHatch->get_visible()) { - m_xFillTabPage = SvxHatchTabPage::Create(m_xFillTab.get(), pController, m_rXFSet); + m_xFillTabPage = SvxHatchTabPage::Create(m_xFillTab.get(), pController, m_aFillAttributeSet); Size aHatchSize = m_xFillTab->get_preferred_size(); lclExtendSize(aSize, aHatchSize); } if (m_xBtnPattern->get_visible()) { - m_xFillTabPage = SvxPatternTabPage::Create(m_xFillTab.get(), pController, m_rXFSet); + m_xFillTabPage = SvxPatternTabPage::Create(m_xFillTab.get(), pController, m_aFillAttributeSet); Size aPatternSize = m_xFillTab->get_preferred_size(); lclExtendSize(aSize, aPatternSize); } @@ -166,7 +165,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) { const XFillStyleItem& aFillStyleItem( rSet.Get( GetWhich( XATTR_FILLSTYLE ) ) ); eXFS = aFillStyleItem.GetValue(); - m_rXFSet.Put( aFillStyleItem ); + m_aFillAttributeSet.Put( aFillStyleItem ); } switch(eXFS) @@ -183,22 +182,22 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) } case drawing::FillStyle_SOLID: { - m_rXFSet.Put( rSet.Get( GetWhich( XATTR_FILLCOLOR ) ) ); + m_aFillAttributeSet.Put( rSet.Get( GetWhich( XATTR_FILLCOLOR ) ) ); SelectFillType(*m_xBtnColor); break; } case drawing::FillStyle_GRADIENT: { - m_rXFSet.Put( rSet.Get( GetWhich( XATTR_FILLGRADIENT ) ) ); - m_rXFSet.Put(rSet.Get(GetWhich(XATTR_GRADIENTSTEPCOUNT))); + m_aFillAttributeSet.Put( rSet.Get( GetWhich( XATTR_FILLGRADIENT ) ) ); + m_aFillAttributeSet.Put(rSet.Get(GetWhich(XATTR_GRADIENTSTEPCOUNT))); SelectFillType(*m_xBtnGradient); break; } case drawing::FillStyle_HATCH: { - m_rXFSet.Put( rSet.Get(XATTR_FILLHATCH) ); - m_rXFSet.Put( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND) ); - m_rXFSet.Put( rSet.Get(XATTR_FILLCOLOR) ); + m_aFillAttributeSet.Put( rSet.Get(XATTR_FILLHATCH) ); + m_aFillAttributeSet.Put( rSet.Get(XATTR_FILLUSESLIDEBACKGROUND) ); + m_aFillAttributeSet.Put( rSet.Get(XATTR_FILLCOLOR) ); SelectFillType(*m_xBtnHatch); break; } @@ -206,7 +205,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) { const bool bPattern = rSet.Get(GetWhich(XATTR_FILLBITMAP)).isPattern(); // pass full item set here, bitmap fill has many attributes (tiling, size, offset etc.) - m_rXFSet.Put( rSet ); + m_aFillAttributeSet.Put( rSet ); if (!bPattern) SelectFillType(*m_xBtnBitmap); else @@ -404,7 +403,7 @@ IMPL_LINK(SvxAreaTabPage, SelectFillTypeHdl_Impl, weld::Toggleable&, rButton, vo void SvxAreaTabPage::SelectFillType(weld::Toggleable& rButton, const SfxItemSet* _pSet) { if (_pSet) - m_rXFSet.Set(*_pSet); + m_aFillAttributeSet.Set(*_pSet); if (_pSet || maBox.GetFillType(rButton) != maBox.GetCurrentFillType()) { @@ -442,62 +441,62 @@ std::unique_ptr SvxAreaTabPage::CreatePage(FillType eFillType) case FillType::SOLID: { std::unique_ptr pColorTabPage - = SvxColorTabPage::Create(m_xFillTab.get(), pController, m_rXFSet); + = SvxColorTabPage::Create(m_xFillTab.get(), pController, m_aFillAttributeSet); pColorTabPage->SetColorList(m_pColorList); pColorTabPage->SetColorChgd(m_pnColorListState); pColorTabPage->Construct(); - pColorTabPage->ActivatePage(m_rXFSet); - pColorTabPage->Reset(&m_rXFSet); + pColorTabPage->ActivatePage(m_aFillAttributeSet); + pColorTabPage->Reset(&m_aFillAttributeSet); pColorTabPage->set_visible(true); return pColorTabPage; } case FillType::GRADIENT: { std::unique_ptr pGradientTabPage - = SvxGradientTabPage::Create(m_xFillTab.get(), pController, m_rXFSet); + = SvxGradientTabPage::Create(m_xFillTab.get(), pController, m_aFillAttributeSet); pGradientTabPage->SetColorList(m_pColorList); pGradientTabPage->SetGradientList(m_pGradientList); pGradientTabPage->SetColorChgd(m_pnColorListState); pGradientTabPage->Construct(); - pGradientTabPage->ActivatePage(m_rXFSet); - pGradientTabPage->Reset(&m_rXFSet); + pGradientTabPage->ActivatePage(m_aFillAttributeSet); + pGradientTabPage->Reset(&m_aFillAttributeSet); pGradientTabPage->set_visible(true); return pGradientTabPage; } case FillType::HATCH: { std::unique_ptr pHatchTabPage - = SvxHatchTabPage::Create(m_xFillTab.get(), pController, m_rXFSet); + = SvxHatchTabPage::Create(m_xFillTab.get(), pController, m_aFillAttributeSet); pHatchTabPage->SetColorList(m_pColorList); pHatchTabPage->SetHatchingList(m_pHatchingList); pHatchTabPage->SetColorChgd(m_pnColorListState); pHatchTabPage->Construct(); - pHatchTabPage->ActivatePage(m_rXFSet); - pHatchTabPage->Reset(&m_rXFSet); + pHatchTabPage->ActivatePage(m_aFillAttributeSet); + pHatchTabPage->Reset(&m_aFillAttributeSet); pHatchTabPage->set_visible(true); return pHatchTabPage; } case FillType::BITMAP: { std::unique_ptr pBitmapTabPage - = SvxBitmapTabPage::Create(m_xFillTab.get(), pController, m_rXFSet); + = SvxBitmapTabPage::Create(m_xFillTab.get(), pController, m_aFillAttributeSet); pBitmapTabPage->SetBitmapList(m_pBitmapList); pBitmapTabPage->Construct(); - pBitmapTabPage->ActivatePage(m_rXFSet); - pBitmapTabPage->Reset(&m_rXFSet); + pBitmapTabPage->ActivatePage(m_aFillAttributeSet); + pBitmapTabPage->Reset(&m_aFillAttributeSet); pBitmapTabPage->set_visible(true); return pBitmapTabPage; } case FillType::PATTERN: { std::unique_ptr pPatternTabPage - = SvxPatternTabPage::Create(m_xFillTab.get(), pController, m_rXFSet); + = SvxPatternTabPage::Create(m_xFillTab.get(), pController, m_aFillAttributeSet); pPatternTabPage->SetColorList(m_pColorList); pPatternTabPage->SetPatternList(m_pPatternList); pPatternTabPage->SetColorChgd(m_pnColorListState); pPatternTabPage->Construct(); - pPatternTabPage->ActivatePage(m_rXFSet); - pPatternTabPage->Reset(&m_rXFSet); + pPatternTabPage->ActivatePage(m_aFillAttributeSet); + pPatternTabPage->Reset(&m_aFillAttributeSet); pPatternTabPage->set_visible(true); return pPatternTabPage; } diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 85757aac849f..0a048aab132d 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -82,8 +82,7 @@ SvxBitmapTabPage::SvxBitmapTabPage(weld::Container* pPage, weld::DialogControlle , m_fObjectWidth(0.0) , m_fObjectHeight(0.0) , m_bLogicalSize(false) - , m_aXFillAttr(rInAttrs.GetPool()) - , m_rXFSet(m_aXFillAttr.GetItemSet()) + , m_aFillAttributeSet(rInAttrs.getPool(), WhichRangesContainer(XATTR_FILL_FIRST, XATTR_FILL_LAST)) , mpView(nullptr) , m_xBitmapsPresets(m_xBuilder->weld_icon_view(u"images"_ustr)) , m_xBitmapLB(new SvxPresetListBox(*m_xBitmapsPresets)) @@ -104,9 +103,9 @@ SvxBitmapTabPage::SvxBitmapTabPage(weld::Container* pPage, weld::DialogControlle , m_xCtlBitmapPreview(new weld::CustomWeld(*m_xBuilder, u"CTL_IMAGE_PREVIEW"_ustr, m_aCtlBitmapPreview)) { // setting the output device - m_rXFSet.Put( XFillStyleItem(drawing::FillStyle_BITMAP) ); - m_rXFSet.Put( XFillBitmapItem(OUString(), Graphic()) ); - m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aFillAttributeSet.Put( XFillStyleItem(drawing::FillStyle_BITMAP) ); + m_aFillAttributeSet.Put( XFillBitmapItem(OUString(), Graphic()) ); + m_aCtlBitmapPreview.SetAttributes(m_aFillAttributeSet); m_xBitmapsPresets->connect_item_activated(LINK(this, SvxBitmapTabPage, ModifyBitmapHdl)); m_xBitmapLB->SetRenameHdl( LINK(this, SvxBitmapTabPage, ClickRenameHdl) ); @@ -129,7 +128,7 @@ SvxBitmapTabPage::SvxBitmapTabPage(weld::Container* pPage, weld::DialogControlle Size aSize = getDrawPreviewOptimalSize(m_aCtlBitmapPreview.GetDrawingArea()->get_ref_device()); m_xCtlBitmapPreview->set_size_request(aSize.Width(), aSize.Height()); - SfxItemPool* pPool = m_rXFSet.GetPool(); + SfxItemPool* pPool = m_aFillAttributeSet.GetPool(); mePoolUnit = pPool->GetMetric( XATTR_FILLBMP_SIZEX ); meFieldUnit = GetModuleFieldUnit( rInAttrs ); SetFieldUnit( *m_xBitmapWidth, meFieldUnit, true ); @@ -304,8 +303,8 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) if(!aItem.isPattern()) { - m_rXFSet.Put( aItem ); - m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aFillAttributeSet.Put( aItem ); + m_aCtlBitmapPreview.SetAttributes(m_aFillAttributeSet); m_aCtlBitmapPreview.Invalidate(); } else @@ -517,11 +516,11 @@ void SvxBitmapTabPage::UpdateBitmap() ModifyBitmapStyleHdl( *m_xBitmapStyleLB ); ModifyBitmapPositionHdl( *m_xPositionLB ); - m_rXFSet.ClearItem(XATTR_FILLBITMAP); - m_rXFSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP)); - m_rXFSet.Put(XFillBitmapItem(OUString(), *pGraphicObject)); + m_aFillAttributeSet.ClearItem(XATTR_FILLBITMAP); + m_aFillAttributeSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP)); + m_aFillAttributeSet.Put(XFillBitmapItem(OUString(), *pGraphicObject)); - m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.SetAttributes(m_aFillAttributeSet); m_aCtlBitmapPreview.Invalidate(); } else @@ -612,7 +611,7 @@ IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapSizeHdl, weld::MetricSpinButton&, } ModifyBitmapStyleHdl(*m_xBitmapStyleLB); - m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.SetAttributes(m_aFillAttributeSet); m_aCtlBitmapPreview.Invalidate(); } @@ -657,8 +656,8 @@ IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapStyleHdl, weld::ComboBox&, void ) m_xPositionOffBox->set_sensitive( bIsTiled ); m_xTileOffBox->set_sensitive( bIsTiled ); - m_rXFSet.Put( XFillBmpTileItem( bIsTiled ) ); - m_rXFSet.Put( XFillBmpStretchItem( bIsStretched ) ); + m_aFillAttributeSet.Put( XFillBmpTileItem( bIsTiled ) ); + m_aFillAttributeSet.Put( XFillBmpStretchItem( bIsStretched ) ); if(!bIsStretched) { @@ -684,32 +683,32 @@ IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapStyleHdl, weld::ComboBox&, void ) break; } - m_rXFSet.Put( XFillBmpSizeXItem( aSetBitmapSize.Width() ) ); - m_rXFSet.Put( XFillBmpSizeYItem( aSetBitmapSize.Height() ) ); + m_aFillAttributeSet.Put( XFillBmpSizeXItem( aSetBitmapSize.Width() ) ); + m_aFillAttributeSet.Put( XFillBmpSizeYItem( aSetBitmapSize.Height() ) ); } - m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.SetAttributes(m_aFillAttributeSet); m_aCtlBitmapPreview.Invalidate(); } IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyBitmapPositionHdl, weld::ComboBox&, void) { if (m_xPositionLB->get_sensitive()) - m_rXFSet.Put( XFillBmpPosItem( static_cast< RectPoint >( m_xPositionLB->get_active() ) ) ); + m_aFillAttributeSet.Put( XFillBmpPosItem( static_cast< RectPoint >( m_xPositionLB->get_active() ) ) ); - m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.SetAttributes(m_aFillAttributeSet); m_aCtlBitmapPreview.Invalidate(); } IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyPositionOffsetHdl, weld::MetricSpinButton&, void) { if (m_xPositionOffX->get_sensitive()) - m_rXFSet.Put( XFillBmpPosOffsetXItem( m_xPositionOffX->get_value(FieldUnit::PERCENT) ) ); + m_aFillAttributeSet.Put( XFillBmpPosOffsetXItem( m_xPositionOffX->get_value(FieldUnit::PERCENT) ) ); if (m_xPositionOffY->get_sensitive()) - m_rXFSet.Put( XFillBmpPosOffsetYItem( m_xPositionOffY->get_value(FieldUnit::PERCENT) ) ); + m_aFillAttributeSet.Put( XFillBmpPosOffsetYItem( m_xPositionOffY->get_value(FieldUnit::PERCENT) ) ); - m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.SetAttributes(m_aFillAttributeSet); m_aCtlBitmapPreview.Invalidate(); } @@ -724,10 +723,10 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ModifyTileOffsetHdl, weld::MetricSpinButton&, if(m_xTileOffLB->get_active() == static_cast(COLUMN)) nTileYOff = o3tl::sanitizing_cast(m_xTileOffset->get_value(FieldUnit::PERCENT)); - m_rXFSet.Put( XFillBmpTileOffsetXItem(nTileXOff) ); - m_rXFSet.Put( XFillBmpTileOffsetYItem(nTileYOff) ); + m_aFillAttributeSet.Put( XFillBmpTileOffsetXItem(nTileXOff) ); + m_aFillAttributeSet.Put( XFillBmpTileOffsetYItem(nTileYOff) ); - m_aCtlBitmapPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.SetAttributes(m_aFillAttributeSet); m_aCtlBitmapPreview.Invalidate(); } diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 4d35e7c4a86e..4ced78ab9583 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -51,8 +51,7 @@ SvxColorTabPage::SvxColorTabPage(weld::Container* pPage, weld::DialogController* , m_rOutAttrs(rInAttrs) // All the horrific pointers we store and should not , m_pnColorListState( nullptr ) - , m_aXFillAttr( rInAttrs.GetPool() ) - , m_rXFSet( m_aXFillAttr.GetItemSet() ) + , m_aFillAttributeSet(rInAttrs.getPool(), WhichRangesContainer(XATTR_FILL_FIRST, XATTR_FILL_LAST)) , m_eCM( ColorModel::RGB ) , m_aColorIconView(m_xBuilder->weld_icon_view(u"coloriconview"_ustr)) , m_aRecentIconView(m_xBuilder->weld_icon_view(u"recentcoloriconview"_ustr)) @@ -96,10 +95,10 @@ SvxColorTabPage::SvxColorTabPage(weld::Container* pPage, weld::DialogController* SetExchangeSupport(); // setting the output device - m_rXFSet.Put(XFillStyleItem(drawing::FillStyle_SOLID)); - m_rXFSet.Put(XFillColorItem(OUString(), COL_BLACK)); - m_aCtlPreviewOld.SetAttributes(m_aXFillAttr.GetItemSet()); - m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aFillAttributeSet.Put(XFillStyleItem(drawing::FillStyle_SOLID)); + m_aFillAttributeSet.Put(XFillColorItem(OUString(), COL_BLACK)); + m_aCtlPreviewOld.SetAttributes(m_aFillAttributeSet); + m_aCtlPreviewNew.SetAttributes(m_aFillAttributeSet); // set handler m_xSelectPalette->connect_changed(LINK(this, SvxColorTabPage, SelectPaletteLBHdl)); @@ -178,7 +177,7 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& ) SelectPaletteLBHdl(*m_xSelectPalette); - m_aCtlPreviewOld.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aCtlPreviewOld.SetAttributes(m_aFillAttributeSet); m_aCtlPreviewOld.Invalidate(); const int nSelectedIndex = m_aColorIconView.get_selected_index(); @@ -253,8 +252,8 @@ IMPL_LINK_NOARG(SvxColorTabPage, SpinValueHdl_Impl, weld::SpinButton&, void) static_cast(PercentToColor_Impl(m_xBcustom->get_value()))); UpdateColorValues(); - m_rXFSet.Put(XFillColorItem(OUString(), m_aCurrentColor.m_aColor)); - m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aFillAttributeSet.Put(XFillColorItem(OUString(), m_aCurrentColor.m_aColor)); + m_aCtlPreviewNew.SetAttributes(m_aFillAttributeSet); m_aCtlPreviewNew.Invalidate(); } @@ -268,8 +267,8 @@ IMPL_LINK_NOARG(SvxColorTabPage, MetricSpinValueHdl_Impl, weld::MetricSpinButton static_cast(PercentToColor_Impl(m_xMcustom->get_value(FieldUnit::NONE)))); ConvertColorValues (m_aCurrentColor.m_aColor, ColorModel::RGB); - m_rXFSet.Put(XFillColorItem(OUString(), m_aCurrentColor.m_aColor)); - m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aFillAttributeSet.Put(XFillColorItem(OUString(), m_aCurrentColor.m_aColor)); + m_aCtlPreviewNew.SetAttributes(m_aFillAttributeSet); m_aCtlPreviewNew.Invalidate(); } @@ -279,8 +278,8 @@ IMPL_LINK_NOARG(SvxColorTabPage, ModifiedHdl_Impl, weld::Entry&, void) m_aCurrentColor.m_aColor = m_xHexcustom->GetColor(); UpdateColorValues(); - m_rXFSet.Put(XFillColorItem(OUString(), m_aCurrentColor.m_aColor)); - m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aFillAttributeSet.Put(XFillColorItem(OUString(), m_aCurrentColor.m_aColor)); + m_aCtlPreviewNew.SetAttributes(m_aFillAttributeSet); m_aCtlPreviewNew.Invalidate(); } @@ -354,9 +353,9 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, weld::Button&, void) m_aCurrentColor.m_aColor = aPreviewColor; UpdateColorValues( false ); // fill ItemSet and pass it on to XOut - m_rXFSet.Put(XFillColorItem(OUString(), aPreviewColor)); - //m_aCtlPreviewOld.SetAttributes(m_aXFillAttr); - m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aFillAttributeSet.Put(XFillColorItem(OUString(), aPreviewColor)); + //m_aCtlPreviewOld.SetAttributes(m_aFillAttributeSet); + m_aCtlPreviewNew.SetAttributes(m_aFillAttributeSet); m_aCtlPreviewNew.Invalidate(); } @@ -474,8 +473,8 @@ IMPL_LINK_NOARG(SvxColorTabPage, SelectPaletteLBHdl, weld::ComboBox&, void) void SvxColorTabPage::UpdateToSelectedColor(const NamedColor& rNamedColor) { - m_rXFSet.Put(XFillColorItem(OUString(), rNamedColor.m_aColor)); - m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aFillAttributeSet.Put(XFillColorItem(OUString(), rNamedColor.m_aColor)); + m_aCtlPreviewNew.SetAttributes(m_aFillAttributeSet); m_aCtlPreviewNew.Invalidate(); ChangeColor(rNamedColor, false); @@ -569,9 +568,9 @@ void SvxColorTabPage::ChangeColor(const NamedColor &rNewColor, bool bUpdatePrese // fill ItemSet and pass it on to XOut XFillColorItem aItem(OUString(), m_aCurrentColor.m_aColor); aItem.setComplexColor(m_aCurrentColor.getComplexColor()); - m_rXFSet.Put(aItem); + m_aFillAttributeSet.Put(aItem); - m_aCtlPreviewNew.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aCtlPreviewNew.SetAttributes(m_aFillAttributeSet); m_aCtlPreviewNew.Invalidate(); } diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index 2cb05cad2860..1da10b92b8b8 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -50,8 +50,7 @@ SvxGradientTabPage::SvxGradientTabPage(weld::Container* pPage, weld::DialogContr , m_rOutAttrs(rInAttrs) , m_nGradientListState(ChangeType::NONE) , m_pnColorListState(nullptr) - , m_aXFillAttr(rInAttrs.GetPool()) - , m_rXFSet(m_aXFillAttr.GetItemSet()) + , m_aFillAttributeSet(rInAttrs.getPool(), WhichRangesContainer(XATTR_FILL_FIRST, XATTR_FILL_LAST)) , m_xLbGradientType(m_xBuilder->weld_combo_box(u"gradienttypelb"_ustr)) , m_xFtCenter(m_xBuilder->weld_label(u"centerft"_ustr)) , m_xMtrCenterX(m_xBuilder->weld_metric_spin_button(u"centerxmtr"_ustr, FieldUnit::PERCENT)) @@ -86,9 +85,9 @@ SvxGradientTabPage::SvxGradientTabPage(weld::Container* pPage, weld::DialogContr m_xMtrColorFrom->set_value(100, FieldUnit::PERCENT); // setting the output device - m_rXFSet.Put( XFillStyleItem(drawing::FillStyle_GRADIENT) ); - m_rXFSet.Put( XFillGradientItem(OUString(), basegfx::BGradient())); - m_aCtlPreview.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aFillAttributeSet.Put( XFillStyleItem(drawing::FillStyle_GRADIENT) ); + m_aFillAttributeSet.Put( XFillGradientItem(OUString(), basegfx::BGradient())); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); // set handler m_xGradientPresets->connect_item_activated(LINK(this, SvxGradientTabPage, ChangeGradientHdl)); @@ -324,11 +323,11 @@ void SvxGradientTabPage::ModifiedHdl_Impl( void const * pControl ) if (pControl == m_xLbGradientType.get() || pControl == this) SetControlState_Impl( eXGS ); - m_rXFSet.Put( XGradientStepCountItem( nValue ) ); + m_aFillAttributeSet.Put( XGradientStepCountItem( nValue ) ); // displaying in XOutDev - m_rXFSet.Put( XFillGradientItem( OUString(), aBGradient ) ); - m_aCtlPreview.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aFillAttributeSet.Put( XFillGradientItem( OUString(), aBGradient ) ); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); } @@ -584,9 +583,9 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl() SetControlState_Impl( eXGS ); // fill ItemSet and pass it on to aCtlPreview - m_rXFSet.Put( XFillGradientItem( OUString(), *pGradient ) ); - m_rXFSet.Put( XGradientStepCountItem( nValue ) ); - m_aCtlPreview.SetAttributes(m_aXFillAttr.GetItemSet()); + m_aFillAttributeSet.Put( XFillGradientItem( OUString(), *pGradient ) ); + m_aFillAttributeSet.Put( XGradientStepCountItem( nValue ) ); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); } diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 3a3a35a782d6..62bc571d7a49 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -53,8 +53,7 @@ SvxHatchTabPage::SvxHatchTabPage(weld::Container* pPage, weld::DialogController* , m_rOutAttrs(rInAttrs) , m_nHatchingListState(ChangeType::NONE) , m_pnColorListState(nullptr) - , m_aXFillAttr(rInAttrs.GetPool()) - , m_rXFSet(m_aXFillAttr.GetItemSet()) + , m_aFillAttributeSet(rInAttrs.getPool(), WhichRangesContainer(XATTR_FILL_FIRST, XATTR_FILL_LAST)) //m_aXFillAttr.GetItemSet()) , m_xMtrDistance(m_xBuilder->weld_metric_spin_button(u"distancemtr"_ustr, FieldUnit::MM)) , m_xMtrAngle(m_xBuilder->weld_metric_spin_button(u"anglemtr"_ustr, FieldUnit::DEGREE)) , m_xSliderAngle(m_xBuilder->weld_scale(u"angleslider"_ustr)) @@ -95,9 +94,9 @@ SvxHatchTabPage::SvxHatchTabPage(weld::Container* pPage, weld::DialogController* m_ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH ); // setting the output device - m_rXFSet.Put( XFillStyleItem(drawing::FillStyle_HATCH) ); - m_rXFSet.Put( XFillHatchItem(OUString(), XHatch()) ); - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aFillAttributeSet.Put( XFillStyleItem(drawing::FillStyle_HATCH) ); + m_aFillAttributeSet.Put( XFillHatchItem(OUString(), XHatch()) ); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_xHatchPresets->connect_item_activated(LINK(this, SvxHatchTabPage, ChangeHatchHdl)); m_xHatchLB->SetRenameHdl( LINK( this, SvxHatchTabPage, ClickRenameHdl_Impl ) ); m_xHatchLB->SetDeleteHdl( LINK( this, SvxHatchTabPage, ClickDeleteHdl_Impl ) ); @@ -183,7 +182,7 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) } const XFillBackgroundItem& aBckItem( rSet.Get(XATTR_FILLBACKGROUND)); - m_rXFSet.Put( aBckItem ); + m_aFillAttributeSet.Put( aBckItem ); if (aBckItem.GetValue()) { @@ -192,7 +191,7 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) Color aColor(aColorItem.GetColorValue()); m_xLbBackgroundColor->SelectEntry(aColor); m_xLbBackgroundColor->set_sensitive(true); - m_rXFSet.Put( aColorItem ); + m_aFillAttributeSet.Put( aColorItem ); } else { @@ -201,7 +200,7 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) m_xLbBackgroundColor->set_sensitive(false); } - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); } @@ -266,16 +265,16 @@ void SvxHatchTabPage::Reset( const SfxItemSet* rSet ) const XFillColorItem& aColItem( rSet->Get(XATTR_FILLCOLOR) ); m_xLbBackgroundColor->SelectEntry(aColItem.GetColorValue()); - m_rXFSet.Put( aColItem ); + m_aFillAttributeSet.Put( aColItem ); const XFillBackgroundItem& aBckItem( rSet->Get(XATTR_FILLBACKGROUND) ); if(aBckItem.GetValue()) m_xCbBackgroundColor->set_state(TRISTATE_TRUE); else m_xCbBackgroundColor->set_state(TRISTATE_FALSE); - m_rXFSet.Put( aBckItem ); + m_aFillAttributeSet.Put( aBckItem ); - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); } @@ -305,7 +304,7 @@ IMPL_LINK_NOARG( SvxHatchTabPage, ToggleHatchBackgroundColor_Impl, weld::Togglea m_xLbBackgroundColor->set_sensitive(true); else m_xLbBackgroundColor->set_sensitive(false); - m_rXFSet.Put( XFillBackgroundItem( m_xCbBackgroundColor->get_active() ) ); + m_aFillAttributeSet.Put( XFillBackgroundItem( m_xCbBackgroundColor->get_active() ) ); ModifiedBackgroundHdl_Impl(*m_xLbBackgroundColor); } @@ -315,12 +314,12 @@ IMPL_LINK_NOARG( SvxHatchTabPage, ModifiedBackgroundHdl_Impl, ColorListBox&, voi if (m_xCbBackgroundColor->get_active()) { aColor = m_xLbBackgroundColor->GetSelectEntryColor(); - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); } - m_rXFSet.Put(XFillColorItem( OUString(), aColor )); + m_aFillAttributeSet.Put(XFillColorItem( OUString(), aColor )); - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); } @@ -349,9 +348,9 @@ void SvxHatchTabPage::ModifiedHdl_Impl( void const * p ) GetCoreValue( *m_xMtrDistance, m_ePoolUnit ), Degree10(static_cast((m_xMtrAngle->get_value(FieldUnit::NONE) % 360) * 10)) ); - m_rXFSet.Put( XFillHatchItem( OUString(), aXHatch ) ); + m_aFillAttributeSet.Put( XFillHatchItem( OUString(), aXHatch ) ); - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); } @@ -397,8 +396,8 @@ void SvxHatchTabPage::ChangeHatchHdl_Impl() m_xSliderAngle->set_value(nHatchAngle); // fill ItemSet and pass it on to m_aCtlPreview - m_rXFSet.Put( XFillHatchItem( OUString(), *pHatch ) ); - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aFillAttributeSet.Put( XFillHatchItem( OUString(), *pHatch ) ); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); pHatch.reset(); diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 51a0e8721e2c..3c230085170c 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -92,8 +92,7 @@ SvxLineTabPage::SvxLineTabPage(weld::Container* pPage, weld::DialogController* p , m_bSymbols(false) , m_rOutAttrs(rInAttrs) , m_bObjSelected(false) - , m_aXLineAttr(rInAttrs.GetPool()) - , m_rXLSet(m_aXLineAttr.GetItemSet()) + , m_aLineAttributeSet(rInAttrs.getPool(), WhichRangesContainer(XATTR_LINE_FIRST, XATTR_LINE_LAST)) , m_pnLineEndListState(nullptr) , m_pnDashListState(nullptr) , m_pnColorListState(nullptr) @@ -664,20 +663,20 @@ void SvxLineTabPage::FillXLSet_Impl() if (m_xLbLineStyle->get_active() == -1) { - m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) ); + m_aLineAttributeSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) ); } else if (m_xLbLineStyle->get_active() == 0) - m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) ); + m_aLineAttributeSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) ); else if (m_xLbLineStyle->get_active() == 1) - m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) ); + m_aLineAttributeSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) ); else { - m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_DASH ) ); + m_aLineAttributeSet.Put( XLineStyleItem( drawing::LineStyle_DASH ) ); nPos = m_xLbLineStyle->get_active(); if (nPos != -1) { - m_rXLSet.Put( XLineDashItem( m_xLbLineStyle->get_active_text(), + m_aLineAttributeSet.Put( XLineDashItem( m_xLbLineStyle->get_active_text(), m_pDashList->GetDash( nPos - 2 )->GetDash() ) ); } } @@ -686,18 +685,18 @@ void SvxLineTabPage::FillXLSet_Impl() if (nPos != -1) { if( nPos == 0 ) - m_rXLSet.Put( XLineStartItem() ); + m_aLineAttributeSet.Put( XLineStartItem() ); else - m_rXLSet.Put( XLineStartItem( m_xLbStartStyle->get_active_text(), + m_aLineAttributeSet.Put( XLineStartItem( m_xLbStartStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) ); } nPos = m_xLbEndStyle->get_active(); if (nPos != -1) { if( nPos == 0 ) - m_rXLSet.Put( XLineEndItem() ); + m_aLineAttributeSet.Put( XLineEndItem() ); else - m_rXLSet.Put( XLineEndItem( m_xLbEndStyle->get_active_text(), + m_aLineAttributeSet.Put( XLineEndItem( m_xLbEndStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) ); } @@ -708,22 +707,22 @@ void SvxLineTabPage::FillXLSet_Impl() { case 0: // Rounded, default { - m_rXLSet.Put(XLineJointItem(css::drawing::LineJoint_ROUND)); + m_aLineAttributeSet.Put(XLineJointItem(css::drawing::LineJoint_ROUND)); break; } case 1: // - none - { - m_rXLSet.Put(XLineJointItem(css::drawing::LineJoint_NONE)); + m_aLineAttributeSet.Put(XLineJointItem(css::drawing::LineJoint_NONE)); break; } case 2: // Miter { - m_rXLSet.Put(XLineJointItem(css::drawing::LineJoint_MITER)); + m_aLineAttributeSet.Put(XLineJointItem(css::drawing::LineJoint_MITER)); break; } case 3: // Bevel { - m_rXLSet.Put(XLineJointItem(css::drawing::LineJoint_BEVEL)); + m_aLineAttributeSet.Put(XLineJointItem(css::drawing::LineJoint_BEVEL)); break; } } @@ -737,47 +736,47 @@ void SvxLineTabPage::FillXLSet_Impl() { case 0: // Butt (=Flat), default { - m_rXLSet.Put(XLineCapItem(css::drawing::LineCap_BUTT)); + m_aLineAttributeSet.Put(XLineCapItem(css::drawing::LineCap_BUTT)); break; } case 1: // Round { - m_rXLSet.Put(XLineCapItem(css::drawing::LineCap_ROUND)); + m_aLineAttributeSet.Put(XLineCapItem(css::drawing::LineCap_ROUND)); break; } case 2: // Square { - m_rXLSet.Put(XLineCapItem(css::drawing::LineCap_SQUARE)); + m_aLineAttributeSet.Put(XLineCapItem(css::drawing::LineCap_SQUARE)); break; } } } - m_rXLSet.Put( XLineStartWidthItem( GetCoreValue( *m_xMtrStartWidth, m_ePoolUnit ) ) ); - m_rXLSet.Put( XLineEndWidthItem( GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit ) ) ); + m_aLineAttributeSet.Put( XLineStartWidthItem( GetCoreValue( *m_xMtrStartWidth, m_ePoolUnit ) ) ); + m_aLineAttributeSet.Put( XLineEndWidthItem( GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit ) ) ); - m_rXLSet.Put( XLineWidthItem( GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit ) ) ); + m_aLineAttributeSet.Put( XLineWidthItem( GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit ) ) ); NamedColor aNamedColor = m_xLbColor->GetSelectedEntry(); XLineColorItem aLineColor(aNamedColor.m_aName, aNamedColor.m_aColor); aLineColor.setComplexColor(aNamedColor.getComplexColor()); - m_rXLSet.Put(aLineColor); + m_aLineAttributeSet.Put(aLineColor); // Centered line end if( m_xTsbCenterStart->get_state() == TRISTATE_TRUE ) - m_rXLSet.Put( XLineStartCenterItem( true ) ); + m_aLineAttributeSet.Put( XLineStartCenterItem( true ) ); else if( m_xTsbCenterStart->get_state() == TRISTATE_FALSE ) - m_rXLSet.Put( XLineStartCenterItem( false ) ); + m_aLineAttributeSet.Put( XLineStartCenterItem( false ) ); if( m_xTsbCenterEnd->get_state() == TRISTATE_TRUE ) - m_rXLSet.Put( XLineEndCenterItem( true ) ); + m_aLineAttributeSet.Put( XLineEndCenterItem( true ) ); else if( m_xTsbCenterEnd->get_state() == TRISTATE_FALSE ) - m_rXLSet.Put( XLineEndCenterItem( false ) ); + m_aLineAttributeSet.Put( XLineEndCenterItem( false ) ); // Transparency sal_uInt16 nVal = o3tl::sanitizing_cast(m_xMtrTransparent->get_value(FieldUnit::PERCENT)); - m_rXLSet.Put( XLineTransparenceItem( nVal ) ); + m_aLineAttributeSet.Put( XLineTransparenceItem( nVal ) ); - m_aCtlPreview.SetLineAttributes(m_aXLineAttr.GetItemSet()); + m_aCtlPreview.SetLineAttributes(m_aLineAttributeSet); } @@ -1228,7 +1227,7 @@ void SvxLineTabPage::ChangePreviewHdl_Impl(const weld::MetricSpinButton* pCntrl) if(m_nActLineWidth == -1) { // Don't initialize yet, get the start value - const SfxPoolItem* pOld = GetOldItem( m_rXLSet, XATTR_LINEWIDTH ); + const SfxPoolItem* pOld = GetOldItem( m_aLineAttributeSet, XATTR_LINEWIDTH ); sal_Int32 nStartLineWidth = 0; if(pOld) nStartLineWidth = static_cast(pOld)->GetValue(); @@ -1387,7 +1386,7 @@ IMPL_LINK_NOARG(SvxLineTabPage, ChangeTransparentHdl_Impl, weld::MetricSpinButto { sal_uInt16 nVal = o3tl::sanitizing_cast(m_xMtrTransparent->get_value(FieldUnit::PERCENT)); - m_rXLSet.Put(XLineTransparenceItem(nVal)); + m_aLineAttributeSet.Put(XLineTransparenceItem(nVal)); FillXLSet_Impl(); diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx index 19b5e41cccc0..dea9b63328bc 100644 --- a/cui/source/tabpages/tplnedef.cxx +++ b/cui/source/tabpages/tplnedef.cxx @@ -54,8 +54,7 @@ constexpr int RET_BTN_2 = 101; SvxLineDefTabPage::SvxLineDefTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs) : SfxTabPage(pPage, pController, u"cui/ui/linestyletabpage.ui"_ustr, u"LineStylePage"_ustr, &rInAttrs) , rOutAttrs(rInAttrs) - , aXLineAttr(rInAttrs.GetPool()) - , rXLSet(aXLineAttr.GetItemSet()) + , m_aLineAttributeSet(rInAttrs.getPool(), WhichRangesContainer(XATTR_LINE_FIRST, XATTR_LINE_LAST)) , pnDashListState(nullptr) , pPageType(nullptr) , nDlgType(0) @@ -99,13 +98,13 @@ SvxLineDefTabPage::SvxLineDefTabPage(weld::Container* pPage, weld::DialogControl assert(pPool && "Where is the pool?"); ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH ); - rXLSet.Put( XLineStyleItem(drawing::LineStyle_DASH) ); - rXLSet.Put( XLineWidthItem(XOUT_WIDTH) ); - rXLSet.Put( XLineDashItem( OUString(), XDash( css::drawing::DashStyle_RECT, 3, 7, 2, 40, 15 ) ) ); - rXLSet.Put( XLineColorItem(OUString(), COL_BLACK) ); + m_aLineAttributeSet.Put( XLineStyleItem(drawing::LineStyle_DASH) ); + m_aLineAttributeSet.Put( XLineWidthItem(XOUT_WIDTH) ); + m_aLineAttributeSet.Put( XLineDashItem( OUString(), XDash( css::drawing::DashStyle_RECT, 3, 7, 2, 40, 15 ) ) ); + m_aLineAttributeSet.Put( XLineColorItem(OUString(), COL_BLACK) ); // #i34740# - m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + m_aCtlPreview.SetLineAttributes(m_aLineAttributeSet); m_xBtnAdd->connect_clicked(LINK(this, SvxLineDefTabPage, ClickAddHdl_Impl)); m_xBtnModify->connect_clicked(LINK(this, SvxLineDefTabPage, ClickModifyHdl_Impl)); @@ -323,10 +322,10 @@ void SvxLineDefTabPage::SelectLinestyleHdl_Impl(const weld::ComboBox* p) FillDialog_Impl(); - rXLSet.Put( XLineDashItem( OUString(), aDash ) ); + m_aLineAttributeSet.Put( XLineDashItem( OUString(), aDash ) ); // #i34740# - m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + m_aCtlPreview.SetLineAttributes(m_aLineAttributeSet); m_aCtlPreview.Invalidate(); // Is not set before, in order to take the new style @@ -780,10 +779,10 @@ void SvxLineDefTabPage::FillDash_Impl() aDash.SetDashLen( m_xLbType2->get_active() == 0 ? 0 : GetCoreValue( *m_xMtrLength2, ePoolUnit ) ); aDash.SetDistance( GetCoreValue( *m_xMtrDistance, ePoolUnit ) ); - rXLSet.Put( XLineDashItem( OUString(), aDash ) ); + m_aLineAttributeSet.Put( XLineDashItem( OUString(), aDash ) ); // #i34740# - m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + m_aCtlPreview.SetLineAttributes(m_aLineAttributeSet); } void SvxLineDefTabPage::FillDialog_Impl() diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx index 0cb457c0a531..2db5f899bf3a 100644 --- a/cui/source/tabpages/tplneend.cxx +++ b/cui/source/tabpages/tplneend.cxx @@ -52,8 +52,7 @@ SvxLineEndDefTabPage::SvxLineEndDefTabPage(weld::Container* pPage, weld::DialogC : SfxTabPage(pPage, pController, u"cui/ui/lineendstabpage.ui"_ustr, u"LineEndPage"_ustr, &rInAttrs) , rOutAttrs(rInAttrs) , pPolyObj(nullptr) - , aXLineAttr(rInAttrs.GetPool()) - , rXLSet(aXLineAttr.GetItemSet()) + , m_aLineAttributeSet(rInAttrs.getPool(), WhichRangesContainer(XATTR_LINE_FIRST, XATTR_LINE_LAST)) , pnLineEndListState(nullptr) , pPageType(nullptr) , nDlgType(0) @@ -70,14 +69,14 @@ SvxLineEndDefTabPage::SvxLineEndDefTabPage(weld::Container* pPage, weld::DialogC // this page needs ExchangeSupport SetExchangeSupport(); - rXLSet.Put( XLineStyleItem(css::drawing::LineStyle_SOLID) ); - rXLSet.Put( XLineWidthItem(XOUT_WIDTH) ); - rXLSet.Put( XLineColorItem( OUString(), COL_BLACK ) ); - rXLSet.Put( XLineStartWidthItem( m_aCtlPreview.GetOutputSize().Height() / 2 ) ); - rXLSet.Put( XLineEndWidthItem( m_aCtlPreview.GetOutputSize().Height() / 2 ) ); + m_aLineAttributeSet.Put( XLineStyleItem(css::drawing::LineStyle_SOLID) ); + m_aLineAttributeSet.Put( XLineWidthItem(XOUT_WIDTH) ); + m_aLineAttributeSet.Put( XLineColorItem( OUString(), COL_BLACK ) ); + m_aLineAttributeSet.Put( XLineStartWidthItem( m_aCtlPreview.GetOutputSize().Height() / 2 ) ); + m_aLineAttributeSet.Put( XLineEndWidthItem( m_aCtlPreview.GetOutputSize().Height() / 2 ) ); // #i34740# - m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + m_aCtlPreview.SetLineAttributes(m_aLineAttributeSet); m_xBtnAdd->connect_clicked(LINK(this, SvxLineEndDefTabPage, ClickAddHdl_Impl)); m_xBtnModify->connect_clicked(LINK( this, SvxLineEndDefTabPage, ClickModifyHdl_Impl)); @@ -207,11 +206,11 @@ void SvxLineEndDefTabPage::Reset( const SfxItemSet* ) m_xEdtName->set_text(m_xLbLineEnds->get_active_text()); - rXLSet.Put( XLineStartItem( OUString(), pEntry->GetLineEnd() ) ); - rXLSet.Put( XLineEndItem( OUString(), pEntry->GetLineEnd() ) ); + m_aLineAttributeSet.Put( XLineStartItem( OUString(), pEntry->GetLineEnd() ) ); + m_aLineAttributeSet.Put( XLineEndItem( OUString(), pEntry->GetLineEnd() ) ); // #i34740# - m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + m_aCtlPreview.SetLineAttributes(m_aLineAttributeSet); m_aCtlPreview.Invalidate(); } @@ -246,11 +245,11 @@ void SvxLineEndDefTabPage::SelectLineEndHdl_Impl() m_xEdtName->set_text(m_xLbLineEnds->get_active_text()); - rXLSet.Put( XLineStartItem( OUString(), pEntry->GetLineEnd() ) ); - rXLSet.Put( XLineEndItem( OUString(), pEntry->GetLineEnd() ) ); + m_aLineAttributeSet.Put( XLineStartItem( OUString(), pEntry->GetLineEnd() ) ); + m_aLineAttributeSet.Put( XLineEndItem( OUString(), pEntry->GetLineEnd() ) ); // #i34740# - m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + m_aCtlPreview.SetLineAttributes(m_aLineAttributeSet); m_aCtlPreview.Invalidate(); // Is not set before, in order to only take the new style, diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx index 5ed3751e7047..67fd8d1614ee 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -80,8 +80,7 @@ SvxPatternTabPage::SvxPatternTabPage(weld::Container* pPage, weld::DialogControl , m_rOutAttrs(rInAttrs) , m_nPatternListState(ChangeType::NONE) , m_pnColorListState(nullptr) - , m_aXFillAttr(rInAttrs.GetPool()) - , m_rXFSet(m_aXFillAttr.GetItemSet()) + , m_aFillAttributeSet(rInAttrs.getPool(), WhichRangesContainer(XATTR_FILL_FIRST, XATTR_FILL_LAST)) , m_xCtlPixel(new SvxPixelCtl(this)) , m_xLbColor(new ColorListBox(m_xBuilder->weld_menu_button(u"LB_COLOR"_ustr), [this]{ return GetDialogController()->getDialog(); })) @@ -104,8 +103,8 @@ SvxPatternTabPage::SvxPatternTabPage(weld::Container* pPage, weld::DialogControl SetExchangeSupport(); // setting the output device - m_rXFSet.Put( XFillStyleItem(drawing::FillStyle_BITMAP) ); - m_rXFSet.Put( XFillBitmapItem(OUString(), Graphic()) ); + m_aFillAttributeSet.Put( XFillStyleItem(drawing::FillStyle_BITMAP) ); + m_aFillAttributeSet.Put( XFillBitmapItem(OUString(), Graphic()) ); m_xBtnAdd->connect_clicked( LINK( this, SvxPatternTabPage, ClickAddHdl_Impl ) ); m_xBtnModify->connect_clicked( LINK( this, SvxPatternTabPage, ClickModifyHdl_Impl ) ); @@ -227,8 +226,8 @@ void SvxPatternTabPage::Reset( const SfxItemSet* ) const XFillBitmapItem aBmpItem(OUString(), Graphic(m_xBitmapCtl->GetBitmap())); if(aBmpItem.isPattern()) { - m_rXFSet.Put( aBmpItem ); - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aFillAttributeSet.Put( aBmpItem ); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); } @@ -315,10 +314,10 @@ void SvxPatternTabPage::UpdatePattern() // update m_xBitmapCtl, rXFSet and m_aCtlPreview m_xBitmapCtl->SetPixelColor( aPixelColor ); m_xBitmapCtl->SetBackgroundColor( aBackColor ); - m_rXFSet.ClearItem(); - m_rXFSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP)); - m_rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_xBitmapCtl->GetBitmap()))); - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aFillAttributeSet.ClearItem(); + m_aFillAttributeSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP)); + m_aFillAttributeSet.Put(XFillBitmapItem(OUString(), Graphic(m_xBitmapCtl->GetBitmap()))); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); } else @@ -516,8 +515,8 @@ void SvxPatternTabPage::ChangeColor_Impl() m_xBitmapCtl->SetBackgroundColor( m_xLbBackgroundColor->GetSelectEntryColor() ); // get bitmap and display it - m_rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_xBitmapCtl->GetBitmap()))); - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aFillAttributeSet.Put(XFillBitmapItem(OUString(), Graphic(m_xBitmapCtl->GetBitmap()))); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); } @@ -528,8 +527,8 @@ void SvxPatternTabPage::PointChanged(weld::DrawingArea* pDrawingArea, RectPoint) m_xBitmapCtl->SetBmpArray(m_xCtlPixel->GetBitmapPixelPtr()); // get bitmap and display it - m_rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_xBitmapCtl->GetBitmap()))); - m_aCtlPreview.SetAttributes( m_aXFillAttr.GetItemSet() ); + m_aFillAttributeSet.Put(XFillBitmapItem(OUString(), Graphic(m_xBitmapCtl->GetBitmap()))); + m_aCtlPreview.SetAttributes(m_aFillAttributeSet); m_aCtlPreview.Invalidate(); } diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx index bd9b66f3c0fd..d984db540f45 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -57,8 +57,7 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle , m_pnColorListState(nullptr) , m_nPageType(PageType::Area) , m_nDlgType(0) - , m_aXFillAttr(rInAttrs.GetPool()) - , m_rXFSet(m_aXFillAttr.GetItemSet()) + , m_aFillAttributeSet(rInAttrs.getPool(), WhichRangesContainer(XATTR_FILL_FIRST, XATTR_FILL_LAST)) , m_aCtlPosition(this) , m_xTsbShowShadow(m_xBuilder->weld_check_button(u"TSB_SHOW_SHADOW"_ustr)) , m_xGridShadow(m_xBuilder->weld_widget(u"gridSHADOW"_ustr)) @@ -101,21 +100,21 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle case drawing::FillStyle_SOLID: if( SfxItemState::INVALID != m_rOutAttrs.GetItemState( XATTR_FILLCOLOR ) ) { - m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLCOLOR ) ); + m_aFillAttributeSet.Put( m_rOutAttrs.Get( XATTR_FILLCOLOR ) ); } break; case drawing::FillStyle_GRADIENT: if( SfxItemState::INVALID != m_rOutAttrs.GetItemState( XATTR_FILLGRADIENT ) ) { - m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLGRADIENT ) ); + m_aFillAttributeSet.Put( m_rOutAttrs.Get( XATTR_FILLGRADIENT ) ); } break; case drawing::FillStyle_HATCH: if( SfxItemState::INVALID != m_rOutAttrs.GetItemState( XATTR_FILLHATCH ) ) { - m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLHATCH ) ); + m_aFillAttributeSet.Put( m_rOutAttrs.Get( XATTR_FILLHATCH ) ); } break; @@ -123,7 +122,7 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle { if( SfxItemState::INVALID != m_rOutAttrs.GetItemState( XATTR_FILLBITMAP ) ) { - m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLBITMAP ) ); + m_aFillAttributeSet.Put( m_rOutAttrs.Get( XATTR_FILLBITMAP ) ); } } break; @@ -133,7 +132,7 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle } else { - m_rXFSet.Put( XFillColorItem( OUString(), COL_LIGHTRED ) ); + m_aFillAttributeSet.Put( XFillColorItem( OUString(), COL_LIGHTRED ) ); } if(drawing::FillStyle_NONE == eXFS) @@ -145,8 +144,8 @@ SvxShadowTabPage::SvxShadowTabPage(weld::Container* pPage, weld::DialogControlle eXFS = drawing::FillStyle_SOLID; } - m_rXFSet.Put( XFillStyleItem( eXFS ) ); - m_aCtlXRectPreview.SetRectangleAttributes(m_aXFillAttr.GetItemSet()); + m_aFillAttributeSet.Put( XFillStyleItem( eXFS ) ); + m_aCtlXRectPreview.SetRectangleAttributes(m_aFillAttributeSet); m_xTsbShowShadow->connect_toggled(LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl)); m_xLbShadowColor->SetSelectHdl( LINK( this, SvxShadowTabPage, SelectShadowHdl_Impl ) ); @@ -465,13 +464,13 @@ IMPL_LINK_NOARG(SvxShadowTabPage, SelectShadowHdl_Impl, ColorListBox&, void) IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl, weld::MetricSpinButton&, void) { if (m_xTsbShowShadow->get_state() == TRISTATE_TRUE) - m_rXFSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) ); + m_aFillAttributeSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) ); else - m_rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) ); + m_aFillAttributeSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) ); - m_rXFSet.Put( XFillColorItem( OUString(), m_xLbShadowColor->GetSelectEntryColor() ) ); + m_aFillAttributeSet.Put( XFillColorItem( OUString(), m_xLbShadowColor->GetSelectEntryColor() ) ); sal_uInt16 nVal = static_cast(m_xMtrTransparent->get_value(FieldUnit::PERCENT)); - m_rXFSet.Put( XFillTransparenceItem( nVal ) ); + m_aFillAttributeSet.Put( XFillTransparenceItem( nVal ) ); // shadow removal sal_Int32 nX = 0, nY = 0; @@ -491,7 +490,7 @@ IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl, weld::MetricSpinButton&, m_aCtlXRectPreview.SetShadowPosition(Point(nX, nY)); - m_aCtlXRectPreview.SetShadowAttributes(m_aXFillAttr.GetItemSet()); + m_aCtlXRectPreview.SetShadowAttributes(m_aFillAttributeSet); m_aCtlXRectPreview.Invalidate(); } diff --git a/cui/source/tabpages/tptrans.cxx b/cui/source/tabpages/tptrans.cxx index e9e159c6713d..579f2c7fe162 100644 --- a/cui/source/tabpages/tptrans.cxx +++ b/cui/source/tabpages/tptrans.cxx @@ -54,10 +54,10 @@ IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransOffHdl_Impl, weld::Toggleable& ActivateGradient(false); // Preview - rXFSet.ClearItem(XATTR_FILLTRANSPARENCE); - rXFSet.ClearItem(XATTR_FILLFLOATTRANSPARENCE); - m_aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - m_aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); + m_aFillAttributeSet.ClearItem(XATTR_FILLTRANSPARENCE); + m_aFillAttributeSet.ClearItem(XATTR_FILLFLOATTRANSPARENCE); + m_aCtlXRectPreview.SetAttributes(m_aFillAttributeSet); + m_aCtlBitmapPreview.SetAttributes(m_aFillAttributeSet); InvalidatePreview(false); } @@ -69,7 +69,7 @@ IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransLinearHdl_Impl, weld::Toggleab ActivateGradient(false); // preview - rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE); + m_aFillAttributeSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE); ModifyTransparentHdl_Impl(*m_xMtrTransparent); } @@ -80,7 +80,7 @@ IMPL_LINK_NOARG(SvxTransparenceTabPage, ClickTransGradientHdl_Impl, weld::Toggle ActivateGradient(true); // preview - rXFSet.ClearItem (XATTR_FILLTRANSPARENCE); + m_aFillAttributeSet.ClearItem (XATTR_FILLTRANSPARENCE); ModifiedTrgrHdl_Impl(nullptr); } @@ -96,7 +96,7 @@ void SvxTransparenceTabPage::ActivateLinear(bool bActivate) IMPL_LINK_NOARG(SvxTransparenceTabPage, ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void) { sal_uInt16 nPos = o3tl::sanitizing_cast(m_xMtrTransparent->get_value(FieldUnit::PERCENT)); - rXFSet.Put(XFillTransparenceItem(nPos)); + m_aFillAttributeSet.Put(XFillTransparenceItem(nPos)); // preview InvalidatePreview(); @@ -131,7 +131,7 @@ void SvxTransparenceTabPage::ModifiedTrgrHdl_Impl(const weld::ComboBox* pControl 100, 100); XFillFloatTransparenceItem aItem( aTmpGradient); - rXFSet.Put ( aItem ); + m_aFillAttributeSet.Put ( aItem ); InvalidatePreview(); } @@ -191,8 +191,7 @@ SvxTransparenceTabPage::SvxTransparenceTabPage(weld::Container* pPage, weld::Dia , nPageType(PageType::Area) , nDlgType(0) , bBitmap(false) - , aXFillAttr(rInAttrs.GetPool()) - , rXFSet(aXFillAttr.GetItemSet()) + , m_aFillAttributeSet(rInAttrs.getPool(), WhichRangesContainer(XATTR_FILL_FIRST, XATTR_FILL_LAST)) , m_xRbtTransOff(m_xBuilder->weld_radio_button(u"RBT_TRANS_OFF"_ustr)) , m_xRbtTransLinear(m_xBuilder->weld_radio_button(u"RBT_TRANS_LINEAR"_ustr)) , m_xRbtTransGradient(m_xBuilder->weld_radio_button(u"RBT_TRANS_GRADIENT"_ustr)) @@ -459,15 +458,15 @@ bool SvxTransparenceTabPage::InitPreview(const SfxItemSet& rSet) // Get fillstyle for preview rSet.SetAccessTrackerIgnore(true); - rXFSet.Put ( rSet.Get(XATTR_FILLSTYLE) ); - rXFSet.Put ( rSet.Get(XATTR_FILLCOLOR) ); - rXFSet.Put ( rSet.Get(XATTR_FILLGRADIENT) ); - rXFSet.Put ( rSet.Get(XATTR_FILLHATCH) ); - rXFSet.Put ( rSet.Get(XATTR_FILLBACKGROUND) ); - rXFSet.Put ( rSet.Get(XATTR_FILLBITMAP) ); + m_aFillAttributeSet.Put ( rSet.Get(XATTR_FILLSTYLE) ); + m_aFillAttributeSet.Put ( rSet.Get(XATTR_FILLCOLOR) ); + m_aFillAttributeSet.Put ( rSet.Get(XATTR_FILLGRADIENT) ); + m_aFillAttributeSet.Put ( rSet.Get(XATTR_FILLHATCH) ); + m_aFillAttributeSet.Put ( rSet.Get(XATTR_FILLBACKGROUND) ); + m_aFillAttributeSet.Put ( rSet.Get(XATTR_FILLBITMAP) ); - m_aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - m_aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); + m_aCtlXRectPreview.SetAttributes(m_aFillAttributeSet); + m_aCtlBitmapPreview.SetAttributes(m_aFillAttributeSet); bBitmap = rSet.Get(XATTR_FILLSTYLE).GetValue() == drawing::FillStyle_BITMAP; rSet.SetAccessTrackerIgnore(false); @@ -494,7 +493,7 @@ void SvxTransparenceTabPage::InvalidatePreview (bool bEnable) if ( bEnable ) { m_xCtlBitmapPreview->set_sensitive(true); - m_aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); + m_aCtlBitmapPreview.SetAttributes(m_aFillAttributeSet); } else m_xCtlBitmapPreview->set_sensitive(false); @@ -505,7 +504,7 @@ void SvxTransparenceTabPage::InvalidatePreview (bool bEnable) if ( bEnable ) { m_xCtlXRectPreview->set_sensitive(true); - m_aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); + m_aCtlXRectPreview.SetAttributes(m_aFillAttributeSet); } else m_xCtlXRectPreview->set_sensitive(false); diff --git a/cui/uiconfig/ui/calloutpage.ui b/cui/uiconfig/ui/calloutpage.ui index f0f82114a97b..919bb1198b3b 100644 --- a/cui/uiconfig/ui/calloutpage.ui +++ b/cui/uiconfig/ui/calloutpage.ui @@ -1,54 +1,50 @@ - + 2400 - 0.5 - 10 + 0.5 + 10 2400 - 0.5 - 10 + 0.5 + 10 2400 - 0.5 - 10 + 0.5 + 10 + + + + + + + + + + True - False - 6 + False + 6 vertical 12 - + True - True - start - never - never - in - - - True - False - - - True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - - - Click the Callout style that you want to apply to the selected callout. - - - - - - + True + 6 + iconview_model + 3 + 0 + 0 + 0 + 2 + 18 False @@ -57,36 +53,97 @@ - + True - False - 6 - 18 + False + 6 + 18 - - + + True - False - 12 + False + 12 - + True - False - _Extension: - True - extension + False + _Spacing: + True + spacing 0 - 0 - 0 + 0 + 0 + + + + + True + True + True + 0.00 + True + adjustment3 + 2 + + + Enter the amount of space that you want to leave between the end of the callout line, and the callout box. + + + + + 1 + 0 + + + + + 0 + 0 + + + + + False + True + + Straight Line + Angled Line + Angled Connector Line + + + + 1 + 0 + + + + + + True + False + 12 + + + True + False + _Extension: + True + extension + 0 + + + 0 + 0 True - False + False Optimal From top @@ -101,120 +158,41 @@ - 1 - 0 + 1 + 0 - 0 - 1 + 0 + 1 - - - True - False - 12 - - - True - True - True - 0.00 - adjustment1 - 2 - True - - - Enter the length of the callout line segment that extends from the callout box to the inflection point of the line. - - - - - 1 - 0 - - - - - True - False - _Length: - True - length - 0 - - - 0 - 0 - - - - - 0 - 2 - - - - - _Optimal - True - True - False - True - True - - - Click here to display a single-angled line in an optimal way. - - - - - 1 - 2 - - - - + True - False - 6 - 12 + False + 6 + 12 True - False + False _Position: - True - position + True + position 0 - 0 - 0 - - - - - True - False - _By: - True - by - 0 - - - 0 - 1 + 0 + 0 True - False + False Top Middle @@ -230,19 +208,33 @@ - 1 - 0 + 1 + 0 + + + + + True + False + _By: + True + by + 0 + + + 0 + 1 True - True - True + True + True 0.00 + True adjustment2 2 - True Select where you want to extend the callout line from, in relation to the callout box. @@ -250,75 +242,79 @@ - 1 - 1 + 1 + 1 - 1 - 1 + 1 + 1 - - + + True - False - 12 + False + 12 - + True - False - _Spacing: - True - spacing + False + _Length: + True + length 0 - 0 - 0 + 0 + 0 - + True - True - True + True + True 0.00 - adjustment3 - 2 True + adjustment1 + 2 - - Enter the amount of space that you want to leave between the end of the callout line, and the callout box. + + Enter the length of the callout line segment that extends from the callout box to the inflection point of the line. - 1 - 0 + 1 + 0 - 0 - 0 + 0 + 2 - - False - True - - Straight Line - Angled Line - Angled Connector Line - + + _Optimal + True + True + False + True + True + + + Click here to display a single-angled line in an optimal way. + + - 1 - 0 + 1 + 2 diff --git a/cui/uiconfig/ui/hyperlinkinternetpage.ui b/cui/uiconfig/ui/hyperlinkinternetpage.ui index c4fc71796faf..b886a1f3ebb8 100644 --- a/cui/uiconfig/ui/hyperlinkinternetpage.ui +++ b/cui/uiconfig/ui/hyperlinkinternetpage.ui @@ -25,37 +25,6 @@ True 6 12 - - - True - False - Te_xt: - True - indication - 0 - - - 0 - 0 - - - - - True - True - True - True - - - Specifies the visible text or button caption for the hyperlink. - - - - - 1 - 0 - - True @@ -68,7 +37,7 @@ 0 - 1 + 0 @@ -90,6 +59,37 @@ + + 1 + 0 + + + + + True + False + Te_xt: + True + indication + 0 + + + 0 + 1 + + + + + True + True + True + True + + + Specifies the visible text or button caption for the hyperlink. + + + 1 1 diff --git a/cui/uiconfig/ui/paragalignpage.ui b/cui/uiconfig/ui/paragalignpage.ui index 7f75098f7373..4ef5e7e35c06 100644 --- a/cui/uiconfig/ui/paragalignpage.ui +++ b/cui/uiconfig/ui/paragalignpage.ui @@ -751,7 +751,7 @@ True - Select this check box, if you want to prefer compound word splitting during justification. + Select this check box, if you want compound word splitting to be preferred during justification. diff --git a/dbaccess/CppunitTest_dbaccess_rowset_test.mk b/dbaccess/CppunitTest_dbaccess_rowset_test.mk new file mode 100644 index 000000000000..6a70d07ed461 --- /dev/null +++ b/dbaccess/CppunitTest_dbaccess_rowset_test.mk @@ -0,0 +1,58 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,dbaccess_rowset_test)) + +$(eval $(call gb_CppunitTest_use_externals,dbaccess_rowset_test, \ + boost_headers \ + libxml2 \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,dbaccess_rowset_test, \ + dbaccess/qa/unit/rowset_test \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,dbaccess_rowset_test, \ + comphelper \ + cppu \ + cppuhelper \ + dbaxml \ + dbtools \ + sal \ + subsequenttest \ + utl \ + test \ + tk \ + tl \ + unotest \ + xo \ +)) + +$(eval $(call gb_CppunitTest_use_api,dbaccess_rowset_test,\ + offapi \ + oovbaapi \ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_use_ure,dbaccess_rowset_test)) +$(eval $(call gb_CppunitTest_use_vcl,dbaccess_rowset_test)) + +$(eval $(call gb_CppunitTest_use_rdb,dbaccess_rowset_test,services)) + +$(eval $(call gb_CppunitTest_use_configuration,dbaccess_rowset_test)) + +$(eval $(call gb_CppunitTest_use_uiconfigs,dbaccess_rowset_test, \ + dbaccess \ +)) + +$(eval $(call gb_CppunitTest_use_jars,dbaccess_rowset_test, \ + sdbc_hsqldb \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/dbaccess/CppunitTest_dbaccess_xmlimport.mk b/dbaccess/CppunitTest_dbaccess_xmlimport.mk new file mode 100644 index 000000000000..a9232df53872 --- /dev/null +++ b/dbaccess/CppunitTest_dbaccess_xmlimport.mk @@ -0,0 +1,41 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,dbaccess_xmlimport)) + +$(eval $(call gb_CppunitTest_use_externals,dbaccess_xmlimport, \ + libxml2 \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,dbaccess_xmlimport, \ + dbaccess/qa/unit/xmlimport \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,dbaccess_xmlimport, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + subsequenttest \ + test \ + tl \ + unotest \ + utl \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,dbaccess_xmlimport)) + +$(eval $(call gb_CppunitTest_use_ure,dbaccess_xmlimport)) +$(eval $(call gb_CppunitTest_use_vcl,dbaccess_xmlimport)) + +$(eval $(call gb_CppunitTest_use_rdb,dbaccess_xmlimport,services)) + +$(eval $(call gb_CppunitTest_use_configuration,dbaccess_xmlimport)) + +# vim: set noet sw=4 ts=4: diff --git a/dbaccess/Module_dbaccess.mk b/dbaccess/Module_dbaccess.mk index 035c0445c62c..04c8cd9b9851 100644 --- a/dbaccess/Module_dbaccess.mk +++ b/dbaccess/Module_dbaccess.mk @@ -34,6 +34,10 @@ $(eval $(call gb_Module_add_targets,dbaccess,\ UIConfig_dbtdata \ )) +$(eval $(call gb_Module_add_check_targets,dbaccess,\ + CppunitTest_dbaccess_xmlimport \ +)) + ifneq ($(OS),iOS) ifeq ($(ENABLE_FIREBIRD_SDBC),TRUE) $(eval $(call gb_Module_add_check_targets,dbaccess,\ @@ -59,6 +63,7 @@ $(eval $(call gb_Module_add_check_targets,dbaccess,\ CppunitTest_dbaccess_hsqldb_test \ CppunitTest_dbaccess_RowSetClones \ CppunitTest_dbaccess_CRMDatabase_test \ + CppunitTest_dbaccess_rowset_test \ )) endif diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java index ed42a271b46f..87a97e00d0de 100644 --- a/dbaccess/qa/complex/dbaccess/RowSet.java +++ b/dbaccess/qa/complex/dbaccess/RowSet.java @@ -812,131 +812,5 @@ public class RowSet extends TestCase testPosition(clone, cloneRow, 1, "mixed clone/rowset move/insertion: clone check"); testPosition(m_resultSet, m_row, 100, "mixed clone/rowset move/insertion: rowset check"); } - - - private void testTableParameters() throws com.sun.star.uno.Exception - { - // for a row set simply based on a table, there should be not parameters at all - createRowSet("products", CommandType.TABLE, false); - verifyParameters(new String[] - { - }, "testTableParameters"); - } - - - private void testParametersAfterNormalExecute() throws com.sun.star.uno.Exception - { - createRowSet("SELECT * FROM \"customers\"", CommandType.COMMAND, true); - m_rowSetProperties.setPropertyValue("Command", "SELECT * FROM \"customers\" WHERE \"City\" = :city"); - final XParameters rowsetParams = UnoRuntime.queryInterface( XParameters.class, m_rowSet ); - rowsetParams.setString(1, "London"); - m_rowSet.execute(); - } - - - private void verifyParameters(String[] _paramNames, String _context) throws com.sun.star.uno.Exception - { - final XIndexAccess params = m_paramsSupplier.getParameters(); - final int expected = _paramNames.length; - final int found = params != null ? params.getCount() : 0; - - assertTrue("wrong number of parameters (expected: " + expected + ", found: " + found + ") in " + _context, - found == expected); - - if (found == 0) - { - return; - } - - for (int i = 0; i < expected; ++i) - { - final XPropertySet parameter = UnoRuntime.queryInterface( XPropertySet.class, params.getByIndex( i ) ); - - final String expectedName = _paramNames[i]; - final String foundName = (String) parameter.getPropertyValue("Name"); - assertTrue("wrong parameter name (expected: " + expectedName + ", found: " + foundName + ") in" + _context, - expectedName.equals(foundName)); - } - } - - - private void testParametrizedQuery() throws com.sun.star.uno.Exception - { - // for a row set based on a parametrized query, those parameters should be properly - // recognized - m_dataSource.createQuery("products like", "SELECT * FROM \"products\" WHERE \"Name\" LIKE :product_name"); - createRowSet("products like", CommandType.QUERY, false); - verifyParameters(new String[] - { - "product_name" - }, "testParametrizedQuery"); - } - - - private void testParametersInteraction() throws com.sun.star.uno.Exception - { - createRowSet("products like", CommandType.QUERY, false); - - // let's fill in a parameter value via XParameters, and see whether it is respected by the parameters container - final XParameters rowsetParams = UnoRuntime.queryInterface(XParameters.class, m_rowSet); - rowsetParams.setString(1, "Apples"); - - XIndexAccess params = m_paramsSupplier.getParameters(); - XPropertySet firstParam = UnoRuntime.queryInterface( XPropertySet.class, params.getByIndex( 0 ) ); - Object firstParamValue = firstParam.getPropertyValue("Value"); - - assertTrue("XParameters and the parameters container do not properly interact", - "Apples".equals(firstParamValue)); - - // let's see whether this also survives an execute of the row set - rowsetParams.setString(1, "Oranges"); - m_rowSet.execute(); - { - // TODO: the following would not be necessary if the parameters container would *survive* - // the execution of the row set. It currently doesn't (though the values it represents do). - // It would be nice, but not strictly necessary, if it would. - params = m_paramsSupplier.getParameters(); - firstParam = UnoRuntime.queryInterface( XPropertySet.class, params.getByIndex( 0 ) ); - } - firstParamValue = firstParam.getPropertyValue("Value"); - assertTrue("XParameters and the parameters container do not properly interact, after the row set has been executed", - "Oranges".equals(firstParamValue)); - } - - - private void testParametersInFilter() throws com.sun.star.uno.Exception - { - createRowSet("SELECT * FROM \"customers\"", CommandType.COMMAND, false); - m_rowSetProperties.setPropertyValue("Filter", "\"City\" = :city"); - - m_rowSetProperties.setPropertyValue("ApplyFilter", Boolean.TRUE); - verifyParameters(new String[] - { - "city" - }, "testParametersInFilter"); - - m_rowSetProperties.setPropertyValue("ApplyFilter", Boolean.FALSE); - verifyParameters(new String[] - { - }, "testParametersInFilter"); - } - - - /** checks the XParametersSupplier functionality of a RowSet - */ - @Test - public void testParameters() throws Exception - { - createTestCase(false); - // use an own RowSet instance, not the one which is also used for the other cases - - testTableParameters(); - testParametrizedQuery(); - testParametersInFilter(); - - testParametersAfterNormalExecute(); - - testParametersInteraction(); - } } diff --git a/dbaccess/qa/uitest/data/tdf160343.odb b/dbaccess/qa/uitest/data/tdf160343.odb new file mode 100644 index 000000000000..b0196b060fa8 Binary files /dev/null and b/dbaccess/qa/uitest/data/tdf160343.odb differ diff --git a/dbaccess/qa/uitest/edit_field/tdf160343.py b/dbaccess/qa/uitest/edit_field/tdf160343.py new file mode 100644 index 000000000000..0bd377c2fbdb --- /dev/null +++ b/dbaccess/qa/uitest/edit_field/tdf160343.py @@ -0,0 +1,56 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + +# Bug 160343 - Standard filter don't works with numbers with decimals +class tdf160343(UITestCase): + def standard_filter(self, sTable, sField, sCondition, sValue, nExpectedRows): + with self.ui_test.load_file(get_url_for_data_file("tdf160343.odb")): + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + # connects to the database + self.xUITest.executeCommand(".uno:DBViewTables") + xToolkit.waitUntilAllIdlesDispatched() + xDbController = self.ui_test.get_desktop().getActiveFrame().getController() + xTableController = xDbController.loadComponent(0, sTable, False) # DatabaseObject.TABLE + xToolkit.waitUntilAllIdlesDispatched() + xForm = xTableController.CurrentControl.getModel().getParent() + + with self.ui_test.execute_blocking_action( + self.xUITest.executeCommandForProvider, + args=(".uno:FilterCrit", xTableController.getFrame())) as xDialog: + xDialog.getChild("field1").executeAction("SELECT", mkPropertyValues({"TEXT": sField})) + xDialog.getChild("cond1").executeAction("SELECT", mkPropertyValues({"TEXT": sCondition})) + xDialog.getChild("value1").executeAction("SET", mkPropertyValues({"TEXT": sValue})) + xToolkit.waitUntilAllIdlesDispatched() + + # Without the fix in place, with a locale using a decimal comma the value was lost: + # the filter was not set and all rows were shown + self.assertNotEqual("", xForm.Filter) + self.assertEqual(nExpectedRows, xForm.RowCount) + + def test_decimal_german(self): + with self.ui_test.set_config('/org.openoffice.Setup/L10N/ooSetupSystemLocale', 'de-DE'): + self.standard_filter("tbl_Decimal", "Decimal_2", ">", "4,2", 6) + + def test_decimal_english(self): + with self.ui_test.set_config('/org.openoffice.Setup/L10N/ooSetupSystemLocale', 'en-US'): + self.standard_filter("tbl_Decimal", "Decimal_2", ">", "4.2", 6) + + def test_integer_german(self): + with self.ui_test.set_config('/org.openoffice.Setup/L10N/ooSetupSystemLocale', 'de-DE'): + self.standard_filter("tbl_Decimal", "ID", ">", "3", 7) + + def test_date_german(self): + with self.ui_test.set_config('/org.openoffice.Setup/L10N/ooSetupSystemLocale', 'de-DE'): + self.standard_filter("tbl_DateTime", "DateValue", ">", "07.02.2026", 1) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/dbaccess/qa/unit/CRMDatabase_test.cxx b/dbaccess/qa/unit/CRMDatabase_test.cxx index 0c445450e27c..995dc7d572aa 100644 --- a/dbaccess/qa/unit/CRMDatabase_test.cxx +++ b/dbaccess/qa/unit/CRMDatabase_test.cxx @@ -30,7 +30,6 @@ class CRMDBTest : public DBTestBase public: void testCRMDatabase(); void testRegistrationName(); - uno::Reference setUpDBConnection(); void testQueryColumns(); void testODBCEscapeQuery(); @@ -42,24 +41,9 @@ public: CPPUNIT_TEST_SUITE_END(); }; -uno::Reference CRMDBTest::setUpDBConnection() -{ - createDBDocument(u"sdbc:embedded:hsqldb"_ustr); - uno::Reference xDocument(mxComponent, UNO_QUERY_THROW); - uno::Reference xDataSource = xDocument->getDataSource(); - CPPUNIT_ASSERT(xDataSource.is()); - - // create queries before establishing connection to database - createQueries(xDataSource); - - uno::Reference xConnection = getConnectionForDocument(xDocument); - return xConnection; -} - void CRMDBTest::testCRMDatabase() { uno::Reference xConnection = setUpDBConnection(); - createTables(xConnection); // test selection Reference xStatement = xConnection->createStatement(); @@ -109,11 +93,9 @@ void CRMDBTest::testRegistrationName() // 2. register a newly created data source, and verify it has the proper name // Setup the CRMDatabase - createDBDocument(u"sdbc:embedded:hsqldb"_ustr); - uno::Reference xDocument(mxComponent, UNO_QUERY_THROW); - uno::Reference xConnection = getConnectionForDocument(xDocument); - createTables(xConnection); + uno::Reference xConnection = setUpDBConnection(); + uno::Reference xDocument(mxComponent, UNO_QUERY_THROW); uno::Reference xDataSource = xDocument->getDataSource(); CPPUNIT_ASSERT(xDataSource.is()); @@ -142,16 +124,7 @@ void CRMDBTest::testQueryColumns() // Ported from dbaccess/Query.java // Test prepared queries return the expected column names - createDBDocument(u"sdbc:embedded:hsqldb"_ustr); - uno::Reference xDocument(mxComponent, UNO_QUERY_THROW); - uno::Reference xDataSource = xDocument->getDataSource(); - CPPUNIT_ASSERT(xDataSource.is()); - - // Create queries before establishing connection to database - createQueries(xDataSource); - - uno::Reference xConnection = getConnectionForDocument(xDocument); - createTables(xConnection); + uno::Reference xConnection = setUpDBConnection(); uno::Reference xQuerySupplier(xConnection, UNO_QUERY_THROW); uno::Reference xQueryAccess = xQuerySupplier->getQueries(); @@ -184,7 +157,6 @@ void CRMDBTest::testQueryColumns() void CRMDBTest::testODBCEscapeQuery() { uno::Reference xConnection = setUpDBConnection(); - createTables(xConnection); uno::Reference xFactory(xConnection, UNO_QUERY); CPPUNIT_ASSERT(xFactory.is()); diff --git a/dbaccess/qa/unit/data/document_java_classpath.odb b/dbaccess/qa/unit/data/document_java_classpath.odb new file mode 100644 index 000000000000..fc8137d9b810 Binary files /dev/null and b/dbaccess/qa/unit/data/document_java_classpath.odb differ diff --git a/dbaccess/qa/unit/dbtest_base.cxx b/dbaccess/qa/unit/dbtest_base.cxx index bec6e6817ca1..dae7c3d5f74f 100644 --- a/dbaccess/qa/unit/dbtest_base.cxx +++ b/dbaccess/qa/unit/dbtest_base.cxx @@ -9,8 +9,6 @@ #include -#include - #include #include #include @@ -47,6 +45,8 @@ public: void createQuery(const OUString& sQuery, bool bEscapeProcessing, const OUString& sQueryName, const Reference & xDataSource); + uno::Reference setUpDBConnection(); + virtual void tearDown() override; }; @@ -182,6 +182,23 @@ void DBTestBase::createQuery(const OUString& sQuery, bool bEscapeProcessing, con xNameContainer->insertByName(sQueryName, Any(xQueryProp)); } +uno::Reference DBTestBase::setUpDBConnection() +{ + createDBDocument(u"sdbc:embedded:hsqldb"_ustr); + uno::Reference xDocument(mxComponent, UNO_QUERY_THROW); + uno::Reference xDataSource = xDocument->getDataSource(); + CPPUNIT_ASSERT(xDataSource.is()); + + // create queries before establishing connection to database + createQueries(xDataSource); + + uno::Reference xConnection = getConnectionForDocument(xDocument); + + createTables(xConnection); + + return xConnection; +} + void DBTestBase::tearDown() { if (mxComponent) diff --git a/dbaccess/qa/unit/rowset_test.cxx b/dbaccess/qa/unit/rowset_test.cxx new file mode 100644 index 000000000000..2f2dad4284f3 --- /dev/null +++ b/dbaccess/qa/unit/rowset_test.cxx @@ -0,0 +1,167 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "dbtest_base.cxx" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +class RowSetTest : public DBTestBase +{ +}; + +CPPUNIT_TEST_FIXTURE(RowSetTest, testParameters) +{ + uno::Reference xConnection = setUpDBConnection(); + + Reference xStatement = xConnection->createStatement(); + CPPUNIT_ASSERT(xStatement.is()); + xStatement->execute(u"DROP TABLE \"TEST1\" IF EXISTS"_ustr); + xStatement->execute( + u"CREATE TABLE \"TEST1\" (\"ID\" INTEGER NOT NULL PRIMARY KEY, \"col2\" VARCHAR(50))"_ustr); + + xConnection->prepareStatement(u"INSERT INTO \"TEST1\" VALUES (?,?)"_ustr); + + Reference xPrepared + = xConnection->prepareStatement(u"INSERT INTO \"TEST1\" VALUES (?,?)"_ustr); + Reference xParams(xPrepared, UNO_QUERY); + constexpr int MAX_TABLE_ROWS = 100; + for (int i = 0; i < MAX_TABLE_ROWS; ++i) + { + xParams->setInt(1, i); + xParams->setString(2, u"Test"_ustr + OUString::number(i)); + xPrepared->executeUpdate(); + } + + uno::Reference xTablesSupplier(xConnection, UNO_QUERY_THROW); + uno::Reference xTablesRefresh(xTablesSupplier->getTables(), + UNO_QUERY_THROW); + xTablesRefresh->refresh(); + + uno::Reference xRowSet( + getMultiServiceFactory()->createInstance(u"com.sun.star.sdb.RowSet"_ustr), UNO_QUERY); + CPPUNIT_ASSERT(xRowSet.is()); + uno::Reference xRowSetProperties(xRowSet, UNO_QUERY); + CPPUNIT_ASSERT(xRowSetProperties.is()); + + // testTableParameters + // for a row set simply based on a table, there should be not parameters at all + xRowSetProperties->setPropertyValue(u"Command"_ustr, Any(u"PRODUCTS"_ustr)); + xRowSetProperties->setPropertyValue(u"CommandType"_ustr, Any(CommandType::TABLE)); + xRowSetProperties->setPropertyValue(u"ActiveConnection"_ustr, Any(xConnection)); + + uno::Reference xParametersSupplier(xRowSet, UNO_QUERY); + uno::Reference xIndex = xParametersSupplier->getParameters(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndex->getCount()); + + // testParametrizedQuery + // for a row set based on a parametrized query, those parameters should be properly recognized + uno::Reference xDocument(mxComponent, UNO_QUERY_THROW); + createQuery(u"SELECT * FROM \"PRODUCTS\" WHERE \"NAME\" LIKE :product_name"_ustr, true, + u"products like"_ustr, xDocument->getDataSource()); + + xRowSetProperties->setPropertyValue(u"Command"_ustr, Any(u"products like"_ustr)); + xRowSetProperties->setPropertyValue(u"CommandType"_ustr, Any(CommandType::QUERY)); + xRowSetProperties->setPropertyValue(u"ActiveConnection"_ustr, Any(xConnection)); + + xIndex.set(xParametersSupplier->getParameters()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndex->getCount()); + uno::Reference xPropertySet(xIndex->getByIndex(0), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL(u"product_name"_ustr, + xPropertySet->getPropertyValue(u"Name"_ustr).get()); + + // testParametersInFilter + xRowSetProperties->setPropertyValue(u"Command"_ustr, Any(u"SELECT * FROM \"CUSTOMERS\""_ustr)); + xRowSetProperties->setPropertyValue(u"CommandType"_ustr, Any(CommandType::COMMAND)); + xRowSetProperties->setPropertyValue(u"ActiveConnection"_ustr, Any(xConnection)); + + xRowSetProperties->setPropertyValue(u"Filter"_ustr, Any(u"\"CITY\" = :city"_ustr)); + xRowSetProperties->setPropertyValue(u"ApplyFilter"_ustr, Any(true)); + + xIndex.set(xParametersSupplier->getParameters()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndex->getCount()); + xPropertySet.set(xIndex->getByIndex(0), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL(u"city"_ustr, + xPropertySet->getPropertyValue(u"Name"_ustr).get()); + + xRowSetProperties->setPropertyValue(u"ApplyFilter"_ustr, Any(false)); + + xIndex.set(xParametersSupplier->getParameters()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndex->getCount()); + + // testParametersAfterNormalExecute + xRowSetProperties->setPropertyValue(u"Command"_ustr, Any(u"SELECT * FROM \"CUSTOMERS\""_ustr)); + xRowSetProperties->setPropertyValue(u"CommandType"_ustr, Any(CommandType::COMMAND)); + xRowSetProperties->setPropertyValue(u"ActiveConnection"_ustr, Any(xConnection)); + + xRowSet->execute(); + + xIndex.set(xParametersSupplier->getParameters()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndex->getCount()); + + xRowSetProperties->setPropertyValue( + u"Command"_ustr, Any(u"SELECT * FROM \"CUSTOMERS\" WHERE \"CITY\" = :city"_ustr)); + xParams.set(xRowSet, UNO_QUERY); + xParams->setString(1, u"London"_ustr); + + xRowSet->execute(); + + xIndex.set(xParametersSupplier->getParameters()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndex->getCount()); + xPropertySet.set(xIndex->getByIndex(0), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL(u"city"_ustr, + xPropertySet->getPropertyValue(u"Name"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(u"London"_ustr, + xPropertySet->getPropertyValue(u"Value"_ustr).get()); + + //testParametersInteraction + xRowSetProperties->setPropertyValue(u"Command"_ustr, Any(u"products like"_ustr)); + xRowSetProperties->setPropertyValue(u"CommandType"_ustr, Any(CommandType::QUERY)); + xRowSetProperties->setPropertyValue(u"ActiveConnection"_ustr, Any(xConnection)); + + // let's fill in a parameter value via XParameters, and see whether it is respected by the parameters container + xParams->setString(1, u"Apples"_ustr); + + xIndex.set(xParametersSupplier->getParameters()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndex->getCount()); + xPropertySet.set(xIndex->getByIndex(0), UNO_QUERY_THROW); + + CPPUNIT_ASSERT_EQUAL(u"product_name"_ustr, + xPropertySet->getPropertyValue(u"Name"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(u"Apples"_ustr, + xPropertySet->getPropertyValue(u"Value"_ustr).get()); + + // let's fill in a parameter value via XParameters, and see whether it is respected by the parameters container + xParams->setString(1, u"Oranges"_ustr); + xRowSet->execute(); + + CPPUNIT_ASSERT_EQUAL(u"product_name"_ustr, + xPropertySet->getPropertyValue(u"Name"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(u"Oranges"_ustr, + xPropertySet->getPropertyValue(u"Value"_ustr).get()); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/qa/unit/xmlimport.cxx b/dbaccess/qa/unit/xmlimport.cxx new file mode 100644 index 000000000000..8d9f91c588c4 --- /dev/null +++ b/dbaccess/qa/unit/xmlimport.cxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include +#include +#include +#include +#include + +using namespace ::com::sun::star; + +namespace +{ +class DBXMLImportTest : public UnoApiTest +{ +public: + DBXMLImportTest() + : UnoApiTest(u"dbaccess/qa/unit/data"_ustr) + { + } +}; + +CPPUNIT_TEST_FIXTURE(DBXMLImportTest, testDocumentJavaClassPathIgnored) +{ + // The database names a Java class path both as a db:java-classpath attribute and as a data + // source setting. Neither reaches the data source, opened by URL as a database range does. + uno::Reference xContext + = sdb::DatabaseContext::create(comphelper::getProcessComponentContext()); + uno::Reference xDataSource( + xContext->getByName(createFileURL(u"document_java_classpath.odb")), uno::UNO_QUERY_THROW); + uno::Sequence aInfo; + xDataSource->getPropertyValue(u"Info"_ustr) >>= aInfo; + comphelper::NamedValueCollection aSettings(aInfo); + CPPUNIT_ASSERT_EQUAL(OUString(), + aSettings.getOrDefault(u"JavaDriverClassPath"_ustr, OUString())); +} +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/dbaccess/source/core/dataaccess/documenteventexecutor.cxx b/dbaccess/source/core/dataaccess/documenteventexecutor.cxx index aebaf385e64b..2ce40b75a3f0 100644 --- a/dbaccess/source/core/dataaccess/documenteventexecutor.cxx +++ b/dbaccess/source/core/dataaccess/documenteventexecutor.cxx @@ -27,8 +27,10 @@ #include #include +#include #include #include +#include #include namespace dbaccess @@ -166,6 +168,16 @@ namespace dbaccess if ( bDispatchScriptURL && bNonEmptyScript ) { + // the same three tests an office document takes before a bound script runs + if ( !SfxObjectShell::isScriptURLAllowed( sScript ) ) + return; + + if ( !SfxObjectShell::isScriptAccessAllowed( cppu::getXWeak( xDocument.get() ) ) ) + return; + + if ( SfxObjectShell::UnTrustedScript( sScript ) ) + return; + lcl_dispatchScriptURL_throw( mxDocument, mxURLTransformer, sScript, Event ); } } diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index d3e6a8ea2407..251a0774dda6 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -589,7 +589,10 @@ void ODBFilter::setPropertyInfo() Sequence aInfo; if ( !m_aInfoSequence.empty() ) aInfo = comphelper::containerToSequence(m_aInfoSequence); - aDataSourceSettings.merge( ::comphelper::NamedValueCollection( aInfo ), true ); + ::comphelper::NamedValueCollection aDocumentSettings( aInfo ); + // The Java class path of a driver comes from the driver configuration, not the document. + aDocumentSettings.remove( u"JavaDriverClassPath"_ustr ); + aDataSourceSettings.merge( aDocumentSettings, true ); aDataSourceSettings >>= aInfo; if ( aInfo.hasElements() ) diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx index d6103f165cba..fd90292b9e51 100644 --- a/dbaccess/source/ui/control/tabletree.cxx +++ b/dbaccess/source/ui/control/tabletree.cxx @@ -232,7 +232,7 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn if ( bSupportsCatalogs || bSupportsSchemas ) { // we display empty catalogs if the DB supports catalogs, and they're noted at the beginning of a - // composed name. Otherwise, we display empty schematas. (also see the tree structure explained in + // composed name. Otherwise, we display empty schemas. (also see the tree structure explained in // implAddEntry) bool bCatalogs = bSupportsCatalogs && xMeta->isCatalogAtStart(); diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx index c9a3bfd090f1..f216c1e2d0fd 100644 --- a/dbaccess/source/ui/dlg/queryfilter.cxx +++ b/dbaccess/source/ui/dlg/queryfilter.cxx @@ -317,8 +317,8 @@ bool DlgFilterCrit::getCondition(const weld::ComboBox& _rField,const weld::Combo _rFilter.Handle = GetOSQLPredicateType( _rComp.get_active_text() ); if ( SQLFilterOperator::SQLNULL != _rFilter.Handle && _rFilter.Handle != SQLFilterOperator::NOT_SQLNULL ) { - OUString sPredicateValue; - m_aPredicateInput.getPredicateValue( _rValue.get_text(), getMatchingColumn( _rValue ) ) >>= sPredicateValue; + OUString sPredicateValue(_rValue.get_text()); + m_aPredicateInput.normalizePredicateString(sPredicateValue, getMatchingColumn(_rValue)); if ( _rFilter.Handle == SQLFilterOperator::LIKE || _rFilter.Handle == SQLFilterOperator::NOT_LIKE ) ::Replace_OS_PlaceHolder( sPredicateValue ); diff --git a/dbaccess/source/ui/inc/tabletree.hxx b/dbaccess/source/ui/inc/tabletree.hxx index 6a19bb5285eb..0a9ca4e7e8a3 100644 --- a/dbaccess/source/ui/inc/tabletree.hxx +++ b/dbaccess/source/ui/inc/tabletree.hxx @@ -40,7 +40,7 @@ class OTableTreeListBox : public TreeListBox std::unique_ptr< ImageProvider > m_xImageProvider; // provider for our images bool m_bVirtualRoot; // should the first entry be visible - bool m_bNoEmptyFolders; // should empty catalogs/schematas be prevented from being displayed? + bool m_bNoEmptyFolders; // should empty catalogs/schemas be prevented from being displayed? bool m_bShowToggles; // show toggle buttons public: diff --git a/download.lst b/download.lst index 5b2afc00d5ae..a2ce4979764d 100644 --- a/download.lst +++ b/download.lst @@ -65,8 +65,8 @@ DRAGONBOX_TARBALL := dragonbox-1.1.3.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -FAST_FLOAT_SHA256SUM := 90485994d0fed61d0693e8dba32c464b0e8adf7f2e7c2efbf5bff0df5ef5b13f -FAST_FLOAT_TARBALL := fast_float-8.3.0.tar.gz +FAST_FLOAT_SHA256SUM := 7ff47ad261068517561beb0a7c1d57131f71b8be19bdbac2857c6a517a2eb53c +FAST_FLOAT_TARBALL := fast_float-8.3.1.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts @@ -116,8 +116,8 @@ ETONYEK_TARBALL := libetonyek-0.1.$(ETONYEK_VERSION_MICRO).tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -EXPAT_SHA256SUM := 1e727b8933ec51a77a9a9d9afcf8e688bce45d907c13e36ab7393fe36e703182 -EXPAT_TARBALL := expat-2.8.5.tar.xz +EXPAT_SHA256SUM := 1e6371862cc31999b368c3b89b49994f0677e1bab5f1b2b85ae3741f5d803051 +EXPAT_TARBALL := expat-2.9.0.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts @@ -287,8 +287,8 @@ GRAPHITE_TARBALL := graphite2-minimal-1.3.15.tgz # three static lines # so that git cherry-pick # will not run into conflicts -HARFBUZZ_SHA256SUM := b7132e148358a45185c9feafd049dbaf243649d3c44414b3534d9c95d18592b9 -HARFBUZZ_TARBALL := harfbuzz-14.5.0.tar.xz +HARFBUZZ_SHA256SUM := d07a007327277708a2a73ae437887cdbaf282937f6d03ca5467723e9099af586 +HARFBUZZ_TARBALL := harfbuzz-14.6.0.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts @@ -302,8 +302,8 @@ HSQLDB_TARBALL := 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip # three static lines # so that git cherry-pick # will not run into conflicts -HUNSPELL_SHA256SUM := 66ec82a577395fe9d471504267e6dd04615c76517c61af7c6b9c19e5e34e73c8 -HUNSPELL_TARBALL := hunspell-1.7.4.tar.gz +HUNSPELL_SHA256SUM := 2e559f0c2a592ba48e421477f58e9bf7e01062277a4a7821afb52fc9401010ae +HUNSPELL_TARBALL := hunspell-1.7.5.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts @@ -452,8 +452,8 @@ LZMA_TARBALL := xz-5.8.4.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -MARIADB_CONNECTOR_C_SHA256SUM := a84bba97e59b6a322637a189964d4fd72bd8d92f2d22a9f8d6a5f0657c821e97 -MARIADB_CONNECTOR_C_TARBALL := mariadb-connector-c-3.4.9-src.tar.gz +MARIADB_CONNECTOR_C_SHA256SUM := 521c0712e9291fa96558df9e2ff431376a3a79329f13751896b694cae12765b4 +MARIADB_CONNECTOR_C_TARBALL := mariadb-connector-c-3.4.11-src.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts @@ -524,8 +524,8 @@ OPENLDAP_TARBALL := openldap-2.7.1.tgz # three static lines # so that git cherry-pick # will not run into conflicts -OPENSSL_SHA256SUM := a8f84a39918ec6415ce765d9b429d313ba97b8143169c172e734b9514464f5b2 -OPENSSL_TARBALL := openssl-3.5.8.tar.gz +OPENSSL_SHA256SUM := 603f5602e2eef00d77fbd429d34dcd5822bb301757a1bc9cdb24c670f1eb859a +OPENSSL_TARBALL := openssl-3.5.9.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts @@ -539,8 +539,8 @@ PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -PDFIUM_SHA256SUM := 0340b2fca57cecdf6e2e0366129a3340f6764c132cb090f57db96d9f0f349855 -PDFIUM_TARBALL := pdfium-7988.tar.bz2 +PDFIUM_SHA256SUM := a3624f6f0ac46a7e190969d405aa7a07dbc342baf69f81192487575bf64055a5 +PDFIUM_TARBALL := pdfium-8073.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts @@ -559,8 +559,8 @@ PIXMAN_TARBALL := pixman-0.46.4.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -LIBPNG_SHA256SUM := 28eb403f51f0f7405249132cecfe82ea5c0ef97f1b32c5a65828814ae0d34775 -LIBPNG_TARBALL := libpng-1.6.58.tar.xz +LIBPNG_SHA256SUM := d80dd2a38a37f803cb9b6ac7b14bd6e74ddc3b654780a8380bdf93523fdb4389 +LIBPNG_TARBALL := libpng-1.6.59.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts @@ -569,8 +569,8 @@ LIBTIFF_TARBALL := tiff-4.7.2.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -POPPLER_SHA256SUM := dc906e68cea698109706ac6aa3d2c9d4512fcfcac42d90b8afcda486d1b9abd0 -POPPLER_TARBALL := poppler-26.08.0.tar.xz +POPPLER_SHA256SUM := 6792cb7c69205007ad87d2e936cecc5b3a31fac29ab54ffc3175fdb6b2a6ce35 +POPPLER_TARBALL := poppler-26.10.0.tar.xz POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz # three static lines @@ -581,8 +581,8 @@ POSTGRESQL_TARBALL := postgresql-15.19.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts -PYTHON_SHA256SUM := 1e66a7945a48390ee4c2a4268a0e4185884059a13c4aab6d148aa208deea4a76 -PYTHON_TARBALL := Python-3.13.15.tar.xz +PYTHON_SHA256SUM := f4b1bfb3c79b5bb11b8d228a12504163b4c0dab4d679828d8f5f26b6cb6ab35d +PYTHON_TARBALL := Python-3.13.16.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts @@ -701,8 +701,8 @@ ZMF_TARBALL := libzmf-0.0.2.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -ZXCVBN_C_SHA256SUM := 11e39f6776f9c82c68b2acb94336e32697d4ab6cdb4ac16f9583ccbdd735113a -ZXCVBN_C_TARBALL := zxcvbn-c-2.6.tar.gz +ZXCVBN_C_SHA256SUM := 0548647d8cda5c0d52e6e00cd6896005f2813869f9ed93c245536129e3bd3f4b +ZXCVBN_C_TARBALL := zxcvbn-c-2.7.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index ecdb9d310fb3..65956a51da37 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -221,6 +222,39 @@ tools::Rectangle getPDFGraphicRect(const basegfx::B2DVector& rTranslate, sal_Int32(ceil(aCurrentRange.getMaxX())), sal_Int32(ceil(aCurrentRange.getMaxY()))); } +// the one language a paragraph's text is in, false once its portions disagree +bool getTextLanguage(const drawinglayer::primitive2d::Primitive2DContainer& rChildren, + LanguageType& rLanguage) +{ + for (const auto& rCandidate : rChildren) + { + if (const auto* pText + = dynamic_cast( + rCandidate.get())) + { + // a bullet, a tab and an empty line carry no locale, and would read as the UI's + if (pText->getLocale().Language.isEmpty()) + continue; + + const LanguageType eLanguage(LanguageTag(pText->getLocale()).getLanguageType()); + if (eLanguage == LANGUAGE_DONTKNOW) + continue; + if (rLanguage != LANGUAGE_DONTKNOW && rLanguage != eLanguage) + return false; + rLanguage = eLanguage; + } + else if (const auto* pGroup + = dynamic_cast( + rCandidate.get())) + { + if (!getTextLanguage(pGroup->getChildren(), rLanguage)) + return false; + } + } + + return true; +} + } // end of anonymous namespace namespace drawinglayer::processor2d @@ -1599,6 +1633,15 @@ void VclMetafileProcessor2D::processTextHierarchyParagraphPrimitive2D( mpPDFExtOutDevData->WrapBeginStructureElement(vcl::pdf::StructElement::Paragraph); } + // a run in another language would need an element of its own, so name only one + LanguageType eLanguage(LANGUAGE_DONTKNOW); + if (getTextLanguage(rParagraphPrimitive.getChildren(), eLanguage) + && eLanguage != LANGUAGE_DONTKNOW && eLanguage != LANGUAGE_NONE) + { + mpPDFExtOutDevData->SetStructureAttributeNumerical(vcl::pdf::PDFWriter::Language, + static_cast(eLanguage)); + } + // Process recursively and add MetaFile comment process(rParagraphPrimitive); mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); @@ -2774,6 +2817,18 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( mpPDFExtOutDevData->SetCurrentStructureElement(id); } mpPDFExtOutDevData->WrapBeginStructureElement(rTagElement); + // a title, a description and text that states no language are the document's + if (const css::lang::Locale& rLocale = mpPDFExtOutDevData->GetDocumentLocale(); + rStructureTagCandidate.GetAnchorStructureElementKey() != nullptr + && !rLocale.Language.isEmpty()) + { + const LanguageType eLanguage(LanguageTag(rLocale).getLanguageType()); + if (eLanguage != LANGUAGE_DONTKNOW && eLanguage != LANGUAGE_NONE) + { + mpPDFExtOutDevData->SetStructureAttributeNumerical( + vcl::pdf::PDFWriter::Language, static_cast(eLanguage)); + } + } switch (rTagElement) { case vcl::pdf::StructElement::H1: diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 2c8be1c50447..7ee3c913f651 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -1632,8 +1632,10 @@ namespace emfplushelper if (mbMultipart) { SAL_INFO("drawinglayer.emf", "EMF+ multipart record flags: " << mMFlags); - mMStream.Seek(0); - processObjectRecord(mMStream, mMFlags, 0, true); + // a read-only view of the parts written so far, which cannot grow on a seek + SvMemoryStream aObjectStream(const_cast(mMStream.GetData()), + mMStream.Tell(), StreamMode::READ); + processObjectRecord(aObjectStream, mMFlags, 0, true); } mbMultipart = false; diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index 20e80981e9f3..2ba9eddd99a7 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -1896,7 +1896,7 @@ namespace wmfemfhelper { rTargetHolders.Push(); - // for sub-Mteafile contents, do start with new, default render state + // for sub-Metafile contents, do start with new, default render state // #i124686# ...but copy font, this is already set accordingly vcl::Font aTargetFont = rPropertyHolders.Current().getFont(); rPropertyHolders.PushDefault(); @@ -2723,7 +2723,7 @@ namespace wmfemfhelper drawinglayer::primitive2d::Primitive2DContainer xSubContent; { rTargetHolders.Push(); - // #i# for sub-Mteafile contents, do start with new, default render state + // #i# for sub-Metafile contents, do start with new, default render state rPropertyHolders.PushDefault(); implInterpretMetafile(rContent, rTargetHolders, rPropertyHolders, rViewInformation); xSubContent = rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current()); diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk index 1def031b017b..dac038ab2950 100644 --- a/editeng/Library_editeng.mk +++ b/editeng/Library_editeng.mk @@ -108,7 +108,6 @@ $(eval $(call gb_Library_add_exception_objects,editeng,\ editeng/source/misc/txtrange \ editeng/source/misc/unolingu \ editeng/source/misc/urlfieldhelper \ - editeng/source/outliner/outleeng \ editeng/source/outliner/outlin2 \ editeng/source/outliner/outliner \ editeng/source/outliner/outlobj \ diff --git a/editeng/inc/outleeng.hxx b/editeng/inc/outleeng.hxx deleted file mode 100644 index ea0aac27056a..000000000000 --- a/editeng/inc/outleeng.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#pragma once - -#include -#include - -class OutlinerEditEng : public EditEngine -{ - Outliner* pOwner; - -protected: - - // derived from EditEngine. Allows Outliner objects to provide - // bullet access to the EditEngine. - virtual const SvxNumberFormat* GetNumberFormat( sal_Int32 nPara ) const override; - -public: - OutlinerEditEng( Outliner* pOwner, SfxItemPool* pPool ); - virtual ~OutlinerEditEng() override; - - virtual void ProcessFirstLineOfParagraph(sal_Int32 nPara, const Point& rStartPos, OutputDevice& rOutDev, StripPortionsHelper& rStripPortionsHelper) override; - - virtual void ParagraphInserted( sal_Int32 nNewParagraph ) override; - virtual void ParagraphDeleted( sal_Int32 nDeletedParagraph ) override; - virtual void ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph ) override; - - virtual void StyleSheetChanged( SfxStyleSheet* pStyle ) override; - virtual void ParaAttribsChanged( sal_Int32 nPara ) override; - virtual bool SpellNextDocument() override; - virtual OUString GetUndoComment( sal_uInt16 nUndoId ) const override; - - // for text conversion - virtual bool ConvertNextDocument() override; - - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional& rTxtColor, std::optional& rFldColor, std::optional& rFldLineStyle ) override; - - virtual tools::Rectangle GetBulletArea( sal_Int32 nPara ) override; - - sal_Int16 GetDepth( sal_Int32 nPara ) const; - - /// @returns state of the SdrCompatibilityFlag - std::optional GetCompatFlag(SdrCompatibilityFlag eFlag) const; - - virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outlundo.hxx b/editeng/inc/outlundo.hxx similarity index 100% rename from editeng/source/outliner/outlundo.hxx rename to editeng/inc/outlundo.hxx diff --git a/editeng/source/outliner/paralist.hxx b/editeng/inc/paralist.hxx similarity index 99% rename from editeng/source/outliner/paralist.hxx rename to editeng/inc/paralist.hxx index 7d0d2426f82a..c7d7764c9a09 100644 --- a/editeng/source/outliner/paralist.hxx +++ b/editeng/inc/paralist.hxx @@ -79,3 +79,4 @@ private: }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/editeng/qa/editeng/editeng.cxx b/editeng/qa/editeng/editeng.cxx index d2348d986c16..19fadcb9bbca 100644 --- a/editeng/qa/editeng/editeng.cxx +++ b/editeng/qa/editeng/editeng.cxx @@ -11,8 +11,10 @@ #include #include +#include #include #include +#include #include #include @@ -213,6 +215,35 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf119192RTFFontAttributesInParagraphScope) bool bContains = (aCnt.find("{mytest}") != std::string::npos); CPPUNIT_ASSERT(bContains); } + +CPPUNIT_TEST_FIXTURE(Test, testRTFBullet) +{ + // Given a document with a paragraph that is a bulleted item: + EditEngine aEditEngine(mpItemPool.get()); + OUString aText = u"mytest"_ustr; + aEditEngine.SetText(aText); + SfxItemSet aItems(aEditEngine.GetParaAttribs(0)); + aItems.Put(SfxInt16Item(EE_PARA_OUTLLEVEL, 0)); + SvxNumRule aRule(SvxNumRuleFlags::BULLET_REL_SIZE, 10, false); + SvxNumberFormat aFmt(SVX_NUM_CHAR_SPECIAL); + aFmt.SetBulletChar(0x2022); // bullet + aRule.SetLevel(0, aFmt); + aItems.Put(SvxNumBulletItem(std::move(aRule), EE_PARA_NUMBULLET)); + aEditEngine.SetParaAttribs(0, aItems); + + // When copying to the clipboard as RTF: + uno::Reference xData + = aEditEngine.CreateTransferable(ESelection(0, 0, 0, aText.getLength())); + + // Then make sure the RTF carries the bullet so a non-editeng reader sees it: + auto pData = dynamic_cast(xData.get()); + SvMemoryStream& rStream = pData->GetRTFStream(); + std::string aCnt{ static_cast(rStream.GetData()), + static_cast(rStream.GetSize()) }; + // Without the accompanying fix in place, this failed, the export wrote + // only editeng's own \level0 and \pnlvlblt. + CPPUNIT_ASSERT(aCnt.find("\\pnlvlblt") != std::string::npos); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index cf979e68f190..326037ddba73 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,9 @@ #include #include #include +#include +#include +#include using namespace com::sun::star; @@ -73,127 +77,14 @@ public: test::BootstrapFixture::tearDown(); } -#if HAVE_MORE_FONTS - /// Test text portions position when percentage line spacing is set - void testLineSpacing(); -#endif - - void testConstruction(); - - /// Test UNO service class that implements text field items. - void testUnoTextFields(); - - /// Test Copy/Paste with hyperlinks in text using Legacy Format - void testHyperlinkCopyPaste(); - - /// Test Copy/Paste using Legacy Format - void testCopyPaste(); - - /// Test Paste using HTML - void testHTMLPaste(); - - /// Test Paste using an HTML fragment - void testHTMLFragmentPaste(); - - /// Test Paste using an RTF - void testRTFPaste(); - - /// Test Paste preference HTML/ - void testRTFHTMLPaste(); - - /// Test Copy/Paste with selective selection over multiple paragraphs - void testMultiParaSelCopyPaste(); - - /// Test Copy/Paste with Tabs - void testTabsCopyPaste(); - - /// Test hyperlinks - void testHyperlinkSearch(); - - /// Test Copy/Paste with Bold/Italic text using Legacy Format - void testBoldItalicCopyPaste(); - - /// Test Copy/Paste with Underline text using Legacy Format - void testUnderlineCopyPaste(); - - /// Test Copy/Paste with multiple paragraphs - void testMultiParaCopyPaste(); - - /// Test Copy/Paste with multiple paragraphs having Bold/Italic text - void testParaBoldItalicCopyPaste(); - - void testParaStartCopyPaste(); - - void testSectionAttributes(); - - void testLargeParaCopyPaste(); - - void testTransliterate(); - - void testTdf147196TitleCaseMultilineTransliteration(); - - void testTdf148148CaseWhitespaceOnlyTransliteration(); - - void testSingleLine(); - void testMoveParagraph(); - void testCreateLines(); - void testTdf154248MultilineFieldWrapping(); - void testTdf151748StaleKashidaArray(); - void testTdf162803StaleKashidaArray(); - void testTdf157037PasteTextAutoDirection(); - void testFontVariationsItem(); - void testFontVariationsScript(); - void testEscapementNotPreservedOnParaBreak(); - void testAutoDirNotPreservedOnParaBreak(); - void testFontTypographicConversion(); - DECL_STATIC_LINK(Test, CalcFieldValueHdl, EditFieldInfo*, void); - CPPUNIT_TEST_SUITE(Test); -#if HAVE_MORE_FONTS - CPPUNIT_TEST(testLineSpacing); -#endif - CPPUNIT_TEST(testConstruction); - CPPUNIT_TEST(testUnoTextFields); - CPPUNIT_TEST(testHyperlinkCopyPaste); - CPPUNIT_TEST(testCopyPaste); - CPPUNIT_TEST(testHTMLPaste); - CPPUNIT_TEST(testHTMLFragmentPaste); - CPPUNIT_TEST(testRTFPaste); - CPPUNIT_TEST(testRTFHTMLPaste); - CPPUNIT_TEST(testMultiParaSelCopyPaste); - CPPUNIT_TEST(testTabsCopyPaste); - CPPUNIT_TEST(testHyperlinkSearch); - CPPUNIT_TEST(testBoldItalicCopyPaste); - CPPUNIT_TEST(testUnderlineCopyPaste); - CPPUNIT_TEST(testMultiParaCopyPaste); - CPPUNIT_TEST(testParaBoldItalicCopyPaste); - CPPUNIT_TEST(testParaStartCopyPaste); - CPPUNIT_TEST(testSectionAttributes); - CPPUNIT_TEST(testLargeParaCopyPaste); - CPPUNIT_TEST(testTransliterate); - CPPUNIT_TEST(testTdf147196TitleCaseMultilineTransliteration); - CPPUNIT_TEST(testTdf148148CaseWhitespaceOnlyTransliteration); - CPPUNIT_TEST(testSingleLine); - CPPUNIT_TEST(testMoveParagraph); - CPPUNIT_TEST(testCreateLines); - CPPUNIT_TEST(testTdf154248MultilineFieldWrapping); - CPPUNIT_TEST(testTdf151748StaleKashidaArray); - CPPUNIT_TEST(testTdf162803StaleKashidaArray); - CPPUNIT_TEST(testTdf157037PasteTextAutoDirection); - CPPUNIT_TEST(testFontVariationsItem); - CPPUNIT_TEST(testFontVariationsScript); - CPPUNIT_TEST(testEscapementNotPreservedOnParaBreak); - CPPUNIT_TEST(testAutoDirNotPreservedOnParaBreak); - CPPUNIT_TEST(testFontTypographicConversion); - CPPUNIT_TEST_SUITE_END(); - -private: +protected: rtl::Reference mpItemPool; }; #if HAVE_MORE_FONTS -void Test::testLineSpacing() +CPPUNIT_TEST_FIXTURE(Test, testLineSpacing) { // Create EditEngine's instance EditEngine aEditEngine(mpItemPool.get()); @@ -270,7 +161,7 @@ void Test::testLineSpacing() } #endif -void Test::testConstruction() +CPPUNIT_TEST_FIXTURE(Test, testConstruction) { EditEngine aEngine(mpItemPool.get()); @@ -286,7 +177,7 @@ bool includes(const uno::Sequence& rSeq, std::u16string_view rVal) return false; } -void Test::testUnoTextFields() +CPPUNIT_TEST_FIXTURE(Test, testUnoTextFields) { { // DATE @@ -441,14 +332,14 @@ IMPL_STATIC_LINK(Test, CalcFieldValueHdl, EditFieldInfo*, pInfo, void) } } -void Test::testHyperlinkCopyPaste() +CPPUNIT_TEST_FIXTURE(Test, testHyperlinkCopyPaste) { // Create Outliner instance Outliner aOutliner(mpItemPool.get(), OutlinerMode::TextObject); aOutliner.SetCalcFieldValueHdl(LINK(nullptr, Test, CalcFieldValueHdl)); // Create EditEngine's instance - EditEngine& aEditEngine = const_cast(aOutliner.GetEditEngine()); + EditEngine& aEditEngine = aOutliner.GetEditEngine(); // Get EditDoc for current EditEngine's instance EditDoc& rDoc = aEditEngine.GetEditDoc(); @@ -571,7 +462,7 @@ void Test::testHyperlinkCopyPaste() CPPUNIT_ASSERT_EQUAL(aRepres1, pACPURLField3->GetRepresentation()); } -void Test::testCopyPaste() +CPPUNIT_TEST_FIXTURE(Test, testCopyPaste) { // Create EditEngine's instance EditEngine aEditEngine(mpItemPool.get()); @@ -667,7 +558,7 @@ sal_Bool TestTransferable::isDataFlavorSupported(const datatransfer::DataFlavor& return false; } -void Test::testHTMLPaste() +CPPUNIT_TEST_FIXTURE(Test, testHTMLPaste) { // Given an empty editeng document: EditEngine aEditEngine(mpItemPool.get()); @@ -688,7 +579,7 @@ void Test::testHTMLPaste() CPPUNIT_ASSERT_EQUAL(u"test"_ustr, rDoc.GetParaAsString(static_cast(0))); } -void Test::testHTMLFragmentPaste() +CPPUNIT_TEST_FIXTURE(Test, testHTMLFragmentPaste) { // Given an empty editeng document: EditEngine aEditEngine(mpItemPool.get()); @@ -709,7 +600,7 @@ void Test::testHTMLFragmentPaste() CPPUNIT_ASSERT_EQUAL(u"abc"_ustr, rDoc.GetParaAsString(static_cast(0))); } -void Test::testRTFPaste() +CPPUNIT_TEST_FIXTURE(Test, testRTFPaste) { // Given an empty editeng document: EditEngine aEditEngine(mpItemPool.get()); @@ -731,7 +622,7 @@ void Test::testRTFPaste() rDoc.GetParaAsString(static_cast(0))); } -void Test::testRTFHTMLPaste() +CPPUNIT_TEST_FIXTURE(Test, testRTFHTMLPaste) { // Given an empty editeng document: EditEngine aEditEngine(mpItemPool.get()); @@ -763,7 +654,7 @@ void Test::testRTFHTMLPaste() // i.e. HTML is preferred over HTML. CPPUNIT_ASSERT_EQUAL(u"abc"_ustr, rDoc.GetParaAsString(static_cast(0))); } -void Test::testMultiParaSelCopyPaste() +CPPUNIT_TEST_FIXTURE(Test, testMultiParaSelCopyPaste) { // Create EditEngine's instance EditEngine aEditEngine(mpItemPool.get()); @@ -809,7 +700,7 @@ void Test::testMultiParaSelCopyPaste() CPPUNIT_ASSERT_EQUAL( u"This is second"_ustr, rDoc.GetParaAsString(sal_Int32(3)) ); } -void Test::testTabsCopyPaste() +CPPUNIT_TEST_FIXTURE(Test, testTabsCopyPaste) { // Create EditEngine's instance EditEngine aEditEngine(mpItemPool.get()); @@ -881,7 +772,7 @@ public: // Odd accounting for hyperlink position & size etc. // https://bugzilla.novell.com/show_bug.cgi?id=467459 -void Test::testHyperlinkSearch() +CPPUNIT_TEST_FIXTURE(Test, testHyperlinkSearch) { UrlEditEngine aEngine(mpItemPool.get()); EditDoc& rDoc = aEngine.GetEditDoc(); @@ -961,7 +852,7 @@ bool hasItalic(const editeng::Section& rSecAttr) }); } -void Test::testBoldItalicCopyPaste() +CPPUNIT_TEST_FIXTURE(Test, testBoldItalicCopyPaste) { // Create EditEngine's instance EditEngine aEditEngine(mpItemPool.get()); @@ -1144,7 +1035,7 @@ bool hasUnderline(const editeng::Section& rSecAttr) }); } -void Test::testUnderlineCopyPaste() +CPPUNIT_TEST_FIXTURE(Test, testUnderlineCopyPaste) { // Create EditEngine's instance EditEngine aEditEngine(mpItemPool.get()); @@ -1239,7 +1130,7 @@ void Test::testUnderlineCopyPaste() CPPUNIT_ASSERT_MESSAGE("This section must be underlined.", hasUnderline(aAttrs2[3])); } -void Test::testMultiParaCopyPaste() +CPPUNIT_TEST_FIXTURE(Test, testMultiParaCopyPaste) { // Create EditEngine's instance EditEngine aEditEngine(mpItemPool.get()); @@ -1282,7 +1173,7 @@ void Test::testMultiParaCopyPaste() CPPUNIT_ASSERT_EQUAL(aSecondPara, rDoc.GetParaAsString(sal_Int32(3))); } -void Test::testParaBoldItalicCopyPaste() +CPPUNIT_TEST_FIXTURE(Test, testParaBoldItalicCopyPaste) { // Create EditEngine's instance EditEngine aEditEngine(mpItemPool.get()); @@ -1554,7 +1445,7 @@ void Test::testParaBoldItalicCopyPaste() CPPUNIT_ASSERT_MESSAGE("This section must be bold.", hasBold(aAttrs3[14])); } -void Test::testParaStartCopyPaste() +CPPUNIT_TEST_FIXTURE(Test, testParaStartCopyPaste) { // Create EditEngine's instance EditEngine aEditEngine(mpItemPool.get()); @@ -1600,7 +1491,7 @@ void Test::testParaStartCopyPaste() CPPUNIT_ASSERT_EQUAL( aThirdPara, rDoc.GetParaAsString(sal_Int32(3)) ); } -void Test::testSectionAttributes() +CPPUNIT_TEST_FIXTURE(Test, testSectionAttributes) { EditEngine aEngine(mpItemPool.get()); @@ -1742,7 +1633,7 @@ void Test::testSectionAttributes() } } -void Test::testLargeParaCopyPaste() +CPPUNIT_TEST_FIXTURE(Test, testLargeParaCopyPaste) { // Create EditEngine's instance EditEngine aEditEngine(mpItemPool.get()); @@ -1823,7 +1714,7 @@ OUString lcl_translitTest(EditEngine& aEditEngine, const OUString& text, const E return aEditEngine.GetText(); } -void Test::testTransliterate() +CPPUNIT_TEST_FIXTURE(Test, testTransliterate) { // Create EditEngine's instance EditEngine editEng(mpItemPool.get()); @@ -1942,7 +1833,7 @@ void Test::testTransliterate() } -void Test::testTdf147196TitleCaseMultilineTransliteration() +CPPUNIT_TEST_FIXTURE(Test, testTdf147196TitleCaseMultilineTransliteration) { EditEngine editEng( mpItemPool.get() ); editEng.SetText(u"2.2 Publication of information - CAA\nSection 4.2 of a CA\'s Certificate Policy and/or Certification Practice Statement SHALL state the CA\'s policy or practice on processing CAA Records for Fully Qualified Domain Names; that policy shall be consistent with these Requirements. \n\nIt shall clearly specify the set of Issuer Domain Names that the CA recognises in CAA \"issue\" or \"issuewild\" records as permitting it to issue. The CA SHALL log all actions taken, if any, consistent with its processing practice."_ustr); @@ -1950,7 +1841,7 @@ void Test::testTdf147196TitleCaseMultilineTransliteration() CPPUNIT_ASSERT_EQUAL(u"2.2 Publication Of Information - Caa\nSection 4.2 Of A Ca\'s Certificate Policy And/Or Certification Practice Statement Shall State The Ca\'s Policy Or Practice On Processing Caa Records For Fully Qualified Domain Names; That Policy Shall Be Consistent With These Requirements. \n\nIt Shall Clearly Specify The Set Of Issuer Domain Names That The Ca Recognises In Caa \"Issue\" Or \"Issuewild\" Records As Permitting It To Issue. The Ca Shall Log All Actions Taken, If Any, Consistent With Its Processing Practice."_ustr, editEng.GetText()); } -void Test::testTdf148148CaseWhitespaceOnlyTransliteration() +CPPUNIT_TEST_FIXTURE(Test, testTdf148148CaseWhitespaceOnlyTransliteration) { using TF = TransliterationFlags; EditEngine editEng(mpItemPool.get()); @@ -2033,7 +1924,7 @@ void Test::testTdf148148CaseWhitespaceOnlyTransliteration() } -void Test::testSingleLine() +CPPUNIT_TEST_FIXTURE(Test, testSingleLine) { EditEngine aEditEngine(mpItemPool.get()); @@ -2045,7 +1936,7 @@ void Test::testSingleLine() CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aEditEngine.GetLineCount(0)); } -void Test::testMoveParagraph() +CPPUNIT_TEST_FIXTURE(Test, testMoveParagraph) { EditEngine aEditEngine(mpItemPool.get()); aEditEngine.SetPaperSize(Size(5000, 5000)); @@ -2134,7 +2025,7 @@ void Test::testMoveParagraph() CPPUNIT_ASSERT_EQUAL(u"Paragraph 5"_ustr, aEditEngine.GetText(4)); } -void Test::testCreateLines() +CPPUNIT_TEST_FIXTURE(Test, testCreateLines) { ScopedVclPtrInstance pVirtualDevice(DeviceFormat::WITHOUT_ALPHA); @@ -2205,7 +2096,7 @@ void Test::testCreateLines() // CPPUNIT_ASSERT_MESSAGE("INTENTIONALLY FALSE", false); } -void Test::testTdf154248MultilineFieldWrapping() +CPPUNIT_TEST_FIXTURE(Test, testTdf154248MultilineFieldWrapping) { // If field wrapping changes, this test may need to be updated @@ -2214,7 +2105,7 @@ void Test::testTdf154248MultilineFieldWrapping() aOutliner.SetCalcFieldValueHdl(LINK(nullptr, Test, CalcFieldValueHdl)); // Create EditEngine's instance - EditEngine& aEditEngine = const_cast(aOutliner.GetEditEngine()); + EditEngine& aEditEngine = aOutliner.GetEditEngine(); aEditEngine.SetPaperSize(Size(2000, 2000)); aEditEngine.SetText(u"ABC DEF ABC DEFGH"_ustr); // Positions Ref ....*4............ @@ -2264,7 +2155,7 @@ void Test::testTdf154248MultilineFieldWrapping() } // tdf#151748: Verify that editeng produces an empty kashida array if the line does not have room -void Test::testTdf151748StaleKashidaArray() +CPPUNIT_TEST_FIXTURE(Test, testTdf151748StaleKashidaArray) { ScopedVclPtrInstance pVirtualDevice(DeviceFormat::WITHOUT_ALPHA); @@ -2326,7 +2217,7 @@ void Test::testTdf151748StaleKashidaArray() } // tdf#162803: Verify that editeng clears stale kashida data during layout -void Test::testTdf162803StaleKashidaArray() +CPPUNIT_TEST_FIXTURE(Test, testTdf162803StaleKashidaArray) { ScopedVclPtrInstance pVirtualDevice(DeviceFormat::WITHOUT_ALPHA); @@ -2443,7 +2334,7 @@ public: } }; -void Test::testTdf157037PasteTextAutoDirection() +CPPUNIT_TEST_FIXTURE(Test, testTdf157037PasteTextAutoDirection) { // Given an empty editeng document: EditEngine aEditEngine(mpItemPool.get()); @@ -2470,7 +2361,7 @@ void Test::testTdf157037PasteTextAutoDirection() CPPUNIT_ASSERT(!aEditEngine.IsRightToLeft(4)); } -void Test::testFontVariationsScript() +CPPUNIT_TEST_FIXTURE(Test, testFontVariationsScript) { CPPUNIT_ASSERT(IsScriptItemValid(EE_CHAR_FONTVARIATIONS, i18n::ScriptType::LATIN)); CPPUNIT_ASSERT(!IsScriptItemValid(EE_CHAR_FONTVARIATIONS, i18n::ScriptType::ASIAN)); @@ -2490,7 +2381,7 @@ void Test::testFontVariationsScript() GetScriptItemId(EE_CHAR_FONTVARIATIONS, SvtScriptType::COMPLEX)); } -void Test::testFontVariationsItem() +CPPUNIT_TEST_FIXTURE(Test, testFontVariationsItem) { // Test default construction (empty variations) SvxFontVariationsItem aItem1(EE_CHAR_FONTVARIATIONS); @@ -2528,7 +2419,7 @@ void Test::testFontVariationsItem() CPPUNIT_ASSERT(aItem4.operator==(aItem2)); } -void Test::testEscapementNotPreservedOnParaBreak() +CPPUNIT_TEST_FIXTURE(Test, testEscapementNotPreservedOnParaBreak) { EditEngine aEditEngine(mpItemPool.get()); EditDoc& rDoc = aEditEngine.GetEditDoc(); @@ -2572,7 +2463,7 @@ void Test::testEscapementNotPreservedOnParaBreak() CPPUNIT_ASSERT_MESSAGE("Escapement attribute should NOT be included.", !pEscAttr); } -void Test::testAutoDirNotPreservedOnParaBreak() +CPPUNIT_TEST_FIXTURE(Test, testAutoDirNotPreservedOnParaBreak) { EditEngine aEditEngine(mpItemPool.get()); EditDoc& rDoc = aEditEngine.GetEditDoc(); @@ -2605,9 +2496,9 @@ void Test::testAutoDirNotPreservedOnParaBreak() CPPUNIT_ASSERT(!pNode2->GetContentAttribs().HasItem(EE_PARA_AUTOWRITINGDIR)); } -void Test::testFontTypographicConversion() -{ #if HAVE_MORE_FONTS +CPPUNIT_TEST_FIXTURE(Test, testFontTypographicConversion) +{ EditEngine aEditEngine(mpItemPool.get()); SfxItemSet aSet(aEditEngine.GetEmptyItemSet()); @@ -2620,10 +2511,88 @@ void Test::testFontTypographicConversion() const SvxFontItem& rStored = aStored.Get(EE_CHAR_FONTINFO); CPPUNIT_ASSERT_EQUAL(u"DejaVu Sans"_ustr, rStored.GetFamilyName()); CPPUNIT_ASSERT_EQUAL(u"Condensed"_ustr, rStored.GetStyleName()); +} #endif + +CPPUNIT_TEST_FIXTURE(Test, testOutlinerRemoveTrailingParagraphs) +{ + Outliner aOutliner(mpItemPool.get(), OutlinerMode::OutlineObject); + aOutliner.SetText(u"a\nb\nc"_ustr, aOutliner.GetParagraph(0)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aOutliner.GetParagraphCount()); + + // The last removal leaves no paragraph at the removed position. + aOutliner.Remove(aOutliner.GetParagraph(1), 2); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aOutliner.GetParagraphCount()); + CPPUNIT_ASSERT_EQUAL(u"a"_ustr, aOutliner.GetText(aOutliner.GetParagraph(0))); +} + +CPPUNIT_TEST_FIXTURE(Test, testOutlinerAddTextNumbering) +{ + Outliner aSource(mpItemPool.get(), OutlinerMode::OutlineObject); + aSource.SetText(u"x\ny"_ustr, aSource.GetParagraph(0)); + aSource.SetNumberingStartValue(1, 5); + std::optional oParaObj = aSource.CreateParaObject(); + CPPUNIT_ASSERT(oParaObj); + + Outliner aOutliner(mpItemPool.get(), OutlinerMode::OutlineObject); + aOutliner.SetText(u"a"_ustr, aOutliner.GetParagraph(0)); + aOutliner.AddText(*oParaObj); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aOutliner.GetParagraphCount()); + + // The start value belongs to the appended "y", not to the paragraph at its source index. + CPPUNIT_ASSERT_EQUAL(sal_Int16(-1), aOutliner.GetNumberingStartValue(1)); + CPPUNIT_ASSERT_EQUAL(sal_Int16(5), aOutliner.GetNumberingStartValue(2)); +} + +CPPUNIT_TEST_FIXTURE(Test, testOutlinerLastParagraphIsChild) +{ + Outliner aOutliner(mpItemPool.get(), OutlinerMode::OutlineObject); + aOutliner.SetText(u"a\nb\nc"_ustr, aOutliner.GetParagraph(0)); + aOutliner.SetDepth(aOutliner.GetParagraph(0), 0); + aOutliner.SetDepth(aOutliner.GetParagraph(1), 0); + aOutliner.SetDepth(aOutliner.GetParagraph(2), 1); + + // "c", the last paragraph, is a child of "b". + CPPUNIT_ASSERT(aOutliner.HasChildren(aOutliner.GetParagraph(1))); + CPPUNIT_ASSERT(aOutliner.IsExpanded(aOutliner.GetParagraph(1))); + CPPUNIT_ASSERT(!aOutliner.HasChildren(aOutliner.GetParagraph(0))); +} + +CPPUNIT_TEST_FIXTURE(Test, testOutlinerUndoParaFlag) +{ + Outliner aOutliner(mpItemPool.get(), OutlinerMode::OutlineView); + ScopedVclPtrInstance xWindow(nullptr, WB_APP | WB_STDWORK); + OutlinerView aView(aOutliner, xWindow.get()); + aOutliner.InsertView(&aView); + comphelper::ScopeGuard aGuard([&aOutliner, &aView] { aOutliner.RemoveView(&aView); }); + aOutliner.SetText(u"a"_ustr, aOutliner.GetParagraph(0)); + aOutliner.EnableUndo(true); + + aOutliner.SetParaFlag(aOutliner.GetParagraph(0), ParaFlag::ISPAGE); + CPPUNIT_ASSERT(Outliner::HasParaFlag(aOutliner.GetParagraph(0), ParaFlag::ISPAGE)); + + // Undo clears the flag again. + CPPUNIT_ASSERT(aOutliner.GetUndoManager().Undo()); + CPPUNIT_ASSERT(!Outliner::HasParaFlag(aOutliner.GetParagraph(0), ParaFlag::ISPAGE)); +} + +CPPUNIT_TEST_FIXTURE(Test, testOutlinerReadDepth) +{ + Outliner aOutliner(mpItemPool.get(), OutlinerMode::OutlineView); + SvMemoryStream aStream; + aStream.WriteOString("a\n\tb"); + aStream.Seek(0); + aOutliner.Read(aStream, OUString(), EETextFormat::Text); + // The text is read into the empty paragraph in front, which stays. + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aOutliner.GetParagraphCount()); + CPPUNIT_ASSERT_EQUAL(u"a"_ustr, aOutliner.GetText(aOutliner.GetParagraph(0))); + CPPUNIT_ASSERT_EQUAL(u"b"_ustr, aOutliner.GetText(aOutliner.GetParagraph(1))); + + // Each paragraph takes the depth of its outline level, not the depth set before reading. + CPPUNIT_ASSERT_EQUAL(sal_Int16(-1), aOutliner.GetDepth(0)); + CPPUNIT_ASSERT_EQUAL(sal_Int16(-1), aOutliner.GetDepth(1)); } -CPPUNIT_TEST_SUITE_REGISTRATION(Test); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 16a76a302004..002b68103477 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -3425,12 +3425,12 @@ sal_Int32 EditDoc::GetPos(const ContentNode* pContentNode) const const ContentNode* EditDoc::GetObject(sal_Int32 nPos) const { - return 0 <= nPos && o3tl::make_unsigned(nPos) < maContents.size() ? maContents[nPos].get() : nullptr; + return maContents[nPos].get(); } ContentNode* EditDoc::GetObject(sal_Int32 nPos) { - return 0 <= nPos && o3tl::make_unsigned(nPos) < maContents.size() ? maContents[nPos].get() : nullptr; + return maContents[nPos].get(); } void EditDoc::Insert(sal_Int32 nPos, std::unique_ptr pNode) @@ -3448,11 +3448,6 @@ void EditDoc::Insert(sal_Int32 nPos, std::unique_ptr pNode) void EditDoc::Remove(sal_Int32 nPos) { - if (nPos < 0 || o3tl::make_unsigned(nPos) >= maContents.size()) - { - SAL_WARN( "editeng", "EditDoc::Remove - out of bounds pos " << nPos); - return; - } #if ENABLE_YRS YrsRemovePara(m_pYrsSupplier, m_CommentId, *this, nPos); #endif @@ -3461,12 +3456,6 @@ void EditDoc::Remove(sal_Int32 nPos) std::unique_ptr EditDoc::Release(sal_Int32 nPos) { - if (nPos < 0 || o3tl::make_unsigned(nPos) >= maContents.size()) - { - SAL_WARN( "editeng", "EditDoc::Release - out of bounds pos " << nPos); - return nullptr; - } - #if ENABLE_YRS YrsRemovePara(m_pYrsSupplier, m_CommentId, *this, nPos); #endif diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 0abffe21478a..428010540d05 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -66,6 +66,9 @@ #include #endif +#include +#include + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::linguistic2; @@ -81,6 +84,11 @@ EditEngine::EditEngine(SfxItemPool* pItemPool) { } +EditEngine::EditEngine( Outliner* pEngOwner, SfxItemPool* pItemPool ) + : mpImpEditEngine(new ImpEditEngine(this, pItemPool, pEngOwner)) +{ +} + EditEngine::~EditEngine() = default; void EditEngine::EnableUndo( bool bEnable ) @@ -989,9 +997,33 @@ void EditEngine::SetText(sal_Int32 nPara, const OUString& rTxt) void EditEngine::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) { + Outliner* pOwner = getImpl().GetOwner(); + + if (pOwner) + { + Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); + if( !pPara ) + return; + + if ( !IsInUndo() && IsUndoEnabled() ) + pOwner->UndoActionStart( OLUNDO_ATTR ); + } + getImpl().SetParaAttribs(nPara, rSet); if (getImpl().IsUpdateLayout()) getImpl().FormatAndLayout(); + + if (pOwner) + { + pOwner->ImplCheckNumBulletItem( nPara ); + // #i100014# + // It is not a good idea to subtract 1 from a count and cast the result + // to sal_uInt16 without check, if the count is 0. + pOwner->ImplCheckParagraphs( nPara, pOwner->pParaList->GetParagraphCount() ); + + if ( !IsInUndo() && IsUndoEnabled() ) + pOwner->UndoActionEnd(); + } } const SfxItemSet& EditEngine::GetParaAttribs( sal_Int32 nPara ) const @@ -1159,10 +1191,10 @@ Point EditEngine::GetDocPosTopLeft( sal_Int32 nParagraph ) return getImpl().GetDocPosTopLeft(nParagraph); } -const SvxNumberFormat* EditEngine::GetNumberFormat( sal_Int32 ) const +const SvxNumberFormat* EditEngine::GetNumberFormat( sal_Int32 nPara ) const { - // derived objects may override this function to give access to - // bullet information (see Outliner) + if (Outliner* pOwner = getImpl().GetOwner()) + return pOwner->GetNumberFormat( nPara ); return nullptr; } @@ -1337,6 +1369,8 @@ LanguageType EditEngine::GetDefaultLanguage() const bool EditEngine::SpellNextDocument() { + if (Outliner* pOwner = getImpl().GetOwner()) + return pOwner->SpellNextDocument(); return false; } @@ -1375,6 +1409,8 @@ bool EditEngine::HasConvertibleTextPortion( LanguageType nLang ) bool EditEngine::ConvertNextDocument() { + if (Outliner* pOwner = getImpl().GetOwner()) + return pOwner->ConvertNextDocument(); return false; } @@ -1558,12 +1594,26 @@ EditEngine::CreateTransferable(const ESelection& rSelection) // ====================== Virtual Methods ======================== -void EditEngine::ProcessFirstLineOfParagraph(sal_Int32, const Point&, OutputDevice&, StripPortionsHelper&) +void EditEngine::ProcessFirstLineOfParagraph(sal_Int32 nPara, const Point& rStartPos, OutputDevice& rOutDev, + StripPortionsHelper& rStripPortionsHelper) { + if (Outliner* pOwner = getImpl().GetOwner()) + { + if( GetControlWord() & EEControlBits::OUTLINER ) + { + PaintFirstLineInfo aInfo(nPara, rStartPos, &rOutDev, rStripPortionsHelper); + pOwner->maPaintFirstLineHdl.Call( &aInfo ); + } + + pOwner->StripBullet(nPara, rStartPos, rOutDev, rStripPortionsHelper); + } } void EditEngine::ParagraphInserted( sal_Int32 nPara ) { + if (Outliner* pOwner = getImpl().GetOwner()) + pOwner->ParagraphInserted( nPara ); + if ( GetNotifyHdl().IsSet() ) { EENotify aNotify( EE_NOTIFY_PARAGRAPHINSERTED ); @@ -1574,6 +1624,9 @@ void EditEngine::ParagraphInserted( sal_Int32 nPara ) void EditEngine::ParagraphDeleted( sal_Int32 nPara ) { + if (Outliner* pOwner = getImpl().GetOwner()) + pOwner->ParagraphDeleted( nPara ); + if ( GetNotifyHdl().IsSet() ) { EENotify aNotify( EE_NOTIFY_PARAGRAPHREMOVED ); @@ -1582,16 +1635,29 @@ void EditEngine::ParagraphDeleted( sal_Int32 nPara ) } } -void EditEngine::ParagraphConnected( sal_Int32 /*nLeftParagraph*/, sal_Int32 /*nRightParagraph*/ ) +void EditEngine::ParagraphConnected( sal_Int32 /*nLeftParagraph*/, sal_Int32 nRightParagraph ) { + if (Outliner* pOwner = getImpl().GetOwner()) + if(pOwner->IsUndoEnabled() && !pOwner->GetEditEngine().IsInUndo() ) + { + Paragraph* pPara = pOwner->GetParagraph( nRightParagraph ); + if( pPara && Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) ) + { + pOwner->InsertUndo( std::make_unique( pOwner, nRightParagraph, ParaFlag::ISPAGE, ParaFlag::NONE ) ); + } + } } -void EditEngine::ParaAttribsChanged( sal_Int32 /* nParagraph */ ) +void EditEngine::ParaAttribsChanged( sal_Int32 nPara ) { + if (Outliner* pOwner = getImpl().GetOwner()) + pOwner->ParaAttribsChanged( nPara ); } -void EditEngine::StyleSheetChanged( SfxStyleSheet* /* pStyle */ ) +void EditEngine::StyleSheetChanged( SfxStyleSheet* pStyle ) { + if (Outliner* pOwner = getImpl().GetOwner()) + pOwner->StyleSheetChanged( pStyle ); } void EditEngine::ParagraphHeightChanged( sal_Int32 nPara ) @@ -1609,6 +1675,25 @@ void EditEngine::ParagraphHeightChanged( sal_Int32 nPara ) OUString EditEngine::GetUndoComment( sal_uInt16 nId ) const { + if (getImpl().GetOwner() != nullptr) + switch( nId ) + { + case OLUNDO_DEPTH: + return EditResId(RID_OUTLUNDO_DEPTH); + + case OLUNDO_EXPAND: + return EditResId(RID_OUTLUNDO_EXPAND); + + case OLUNDO_COLLAPSE: + return EditResId(RID_OUTLUNDO_COLLAPSE); + + case OLUNDO_ATTR: + return EditResId(RID_OUTLUNDO_ATTR); + + case OLUNDO_INSERT: + return EditResId(RID_OUTLUNDO_INSERT); + } + OUString aComment; switch ( nId ) { @@ -1656,13 +1741,35 @@ OUString EditEngine::GetUndoComment( sal_uInt16 nId ) const return aComment; } -tools::Rectangle EditEngine::GetBulletArea( sal_Int32 ) +tools::Rectangle EditEngine::GetBulletArea( sal_Int32 nPara ) { + if (Outliner* pOwner = getImpl().GetOwner()) + { + tools::Rectangle aBulletArea { Point(), Point() }; + if ( nPara < pOwner->pParaList->GetParagraphCount() ) + { + if ( pOwner->ImplHasNumberFormat( nPara ) ) + aBulletArea = pOwner->ImpCalcBulletArea( nPara, false, false ); + } + return aBulletArea; + } return tools::Rectangle( Point(), Point() ); } -OUString EditEngine::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, std::optional&, std::optional&, std::optional& ) +std::optional EditEngine::GetCompatFlag(SdrCompatibilityFlag eFlag) const { + if (Outliner* pOwner = getImpl().GetOwner()) + return pOwner->GetCompatFlag(eFlag); + return {}; +} + +OUString EditEngine::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, + std::optional& rpTxtColor, + std::optional& rpFldColor, + std::optional& rpFldLineStyle) +{ + if (Outliner* pOwner = getImpl().GetOwner()) + return pOwner->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle ); return OUString(' '); } @@ -1964,4 +2071,14 @@ EFieldInfo& EFieldInfo::operator= ( const EFieldInfo& rFldInfo ) return *this; } +sal_Int16 EditEngine::GetNumberingDepth(sal_Int32 nPara) const +{ + return getImpl().GetOwner()->GetDepth(nPara); +} + +Outliner* EditEngine::GetOwner() +{ + return getImpl().GetOwner(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 212ac18725b4..f807423768b2 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -87,14 +87,14 @@ const XParaPortion& XParaPortionList::operator [](size_t i) const return *maList[i]; } -EditEngineParagraph::EditEngineParagraph( SfxItemPool& rPool ) : +EditTextObjectParagraph::EditTextObjectParagraph( SfxItemPool& rPool ) : eFamily(SfxStyleFamily::Para), aParaAttribs(SfxItemSet::makeFixedSfxItemSet(rPool)) { } // the real Copy constructor is nonsense, since I have to work with another Pool! -EditEngineParagraph::EditEngineParagraph( const EditEngineParagraph& rCopyFrom, SfxItemPool& rPoolToUse ) : +EditTextObjectParagraph::EditTextObjectParagraph( const EditTextObjectParagraph& rCopyFrom, SfxItemPool& rPoolToUse ) : maText(rCopyFrom.maText), aStyle(rCopyFrom.aStyle), eFamily(rCopyFrom.eFamily), @@ -115,35 +115,35 @@ EditEngineParagraph::EditEngineParagraph( const EditEngineParagraph& rCopyFrom, mpWrongs.reset(rCopyFrom.GetWrongList()->Clone()); } -EditEngineParagraph::~EditEngineParagraph() +EditTextObjectParagraph::~EditTextObjectParagraph() { maCharAttribs.clear(); } -void EditEngineParagraph::NormalizeString( svl::SharedStringPool& rPool ) +void EditTextObjectParagraph::NormalizeString( svl::SharedStringPool& rPool ) { maText = rPool.intern(OUString(maText.getData())); } -OUString EditEngineParagraph::GetText() const +OUString EditTextObjectParagraph::GetText() const { rtl_uString* p = const_cast(maText.getData()); return OUString(p); } -sal_Int32 EditEngineParagraph::GetTextLen() const +sal_Int32 EditTextObjectParagraph::GetTextLen() const { const rtl_uString* p = maText.getData(); return p->length; } -void EditEngineParagraph::SetText( const OUString& rStr ) +void EditTextObjectParagraph::SetText( const OUString& rStr ) { maText = svl::SharedString(rStr.pData, nullptr); } -void EditEngineParagraph::dumpAsXml(xmlTextWriterPtr pWriter) const +void EditTextObjectParagraph::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ContentInfo")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("style"), BAD_CAST(aStyle.toUtf8().getStr())); @@ -167,18 +167,18 @@ void EditEngineParagraph::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterEndElement(pWriter); } -const WrongList* EditEngineParagraph::GetWrongList() const +const WrongList* EditTextObjectParagraph::GetWrongList() const { return mpWrongs.get(); } -void EditEngineParagraph::SetWrongList( WrongList* p ) +void EditTextObjectParagraph::SetWrongList( WrongList* p ) { mpWrongs.reset(p); } // #i102062# -bool EditEngineParagraph::isWrongListEqual(const EditEngineParagraph& rCompare) const +bool EditTextObjectParagraph::isWrongListEqual(const EditTextObjectParagraph& rCompare) const { if(GetWrongList() == rCompare.GetWrongList()) return true; @@ -190,7 +190,7 @@ bool EditEngineParagraph::isWrongListEqual(const EditEngineParagraph& rCompare) } #if DEBUG_EDIT_ENGINE -void EditEngineParagraph::Dump() const +void EditTextObjectParagraph::Dump() const { cout << "--" << endl; cout << "text: '" << OUString(const_cast(maText.getData())) << "'" << endl; @@ -205,7 +205,7 @@ void EditEngineParagraph::Dump() const } #endif -bool EditEngineParagraph::Equals(const EditEngineParagraph& rCompare, bool bComparePool) const +bool EditTextObjectParagraph::Equals(const EditTextObjectParagraph& rCompare, bool bComparePool) const { return maText == rCompare.maText && aStyle == rCompare.aStyle && eFamily == rCompare.eFamily && aParaAttribs.Equals(rCompare.aParaAttribs, bComparePool) @@ -294,7 +294,7 @@ EditTextObject::EditTextObject( const EditTextObject& r ) maParagraphs.reserve(r.maParagraphs.size()); for (auto const& content : r.maParagraphs) - maParagraphs.push_back(std::unique_ptr(new EditEngineParagraph(*content, *mpPool))); + maParagraphs.push_back(std::unique_ptr(new EditTextObjectParagraph(*content, *mpPool))); } EditTextObject::EditTextObject( EditTextObject&& ) noexcept = default; @@ -319,7 +319,7 @@ void EditTextObject::NormalizeString( svl::SharedStringPool& rPool ) { for (auto const& content : maParagraphs) { - EditEngineParagraph& rInfo = *content; + EditTextObjectParagraph& rInfo = *content; rInfo.NormalizeString(rPool); } } @@ -330,7 +330,7 @@ std::vector EditTextObject::GetSharedStrings() const aSSs.reserve(maParagraphs.size()); for (auto const& content : maParagraphs) { - const EditEngineParagraph& rInfo = *content; + const EditTextObjectParagraph& rInfo = *content; aSSs.push_back(rInfo.GetSharedString()); } return aSSs; @@ -376,9 +376,9 @@ TextRotation EditTextObject::GetRotation() const return meRotation; } -EditEngineParagraph* EditTextObject::CreateAndInsertParagraph() +EditTextObjectParagraph* EditTextObject::CreateAndInsertParagraph() { - maParagraphs.push_back(std::unique_ptr(new EditEngineParagraph(*mpPool))); + maParagraphs.push_back(std::unique_ptr(new EditTextObjectParagraph(*mpPool))); return maParagraphs.back().get(); } @@ -471,7 +471,7 @@ bool EditTextObject::HasOnlineSpellErrors() const void EditTextObject::GetCharAttribs( sal_Int32 nPara, std::vector& rLst ) const { rLst.clear(); - const EditEngineParagraph& rC = *maParagraphs[nPara]; + const EditTextObjectParagraph& rC = *maParagraphs[nPara]; for (const XEditAttribute & rAttr : rC.maCharAttribs) { EECharAttrib aEEAttr(rAttr.GetStart(), rAttr.GetEnd(), rAttr.GetItem()); @@ -488,7 +488,7 @@ const SvxFieldItem* EditTextObject::GetField() const { if (maParagraphs.size() == 1) { - const EditEngineParagraph& rC = *maParagraphs[0]; + const EditTextObjectParagraph& rC = *maParagraphs[0]; if (rC.GetText().getLength() == 1) { size_t nAttribs = rC.maCharAttribs.size(); @@ -505,7 +505,7 @@ const SvxFieldItem* EditTextObject::GetField() const const SvxFieldData* EditTextObject::GetFieldData(sal_Int32 nPara, size_t nPos, sal_Int32 nType) const { - const EditEngineParagraph& rC = *maParagraphs[nPara]; + const EditTextObjectParagraph& rC = *maParagraphs[nPara]; if (nPos >= rC.maCharAttribs.size()) // URL position is out-of-bound. return nullptr; @@ -538,7 +538,7 @@ bool EditTextObject::HasField( sal_Int32 nType ) const size_t nParagraphs = maParagraphs.size(); for (size_t nPara = 0; nPara < nParagraphs; ++nPara) { - const EditEngineParagraph& rC = *maParagraphs[nPara]; + const EditTextObjectParagraph& rC = *maParagraphs[nPara]; size_t nAttrs = rC.maCharAttribs.size(); for (size_t nAttr = 0; nAttr < nAttrs; ++nAttr) { @@ -560,7 +560,7 @@ bool EditTextObject::HasField( sal_Int32 nType ) const const SfxItemSet& EditTextObject::GetParaAttribs(sal_Int32 nPara) const { - const EditEngineParagraph& rC = *maParagraphs[nPara]; + const EditTextObjectParagraph& rC = *maParagraphs[nPara]; return rC.GetParaAttribs(); } @@ -570,7 +570,7 @@ bool EditTextObject::RemoveCharAttribs( sal_uInt16 _nWhich ) for ( size_t nPara = maParagraphs.size(); nPara; ) { - EditEngineParagraph& rC = *maParagraphs[--nPara]; + EditTextObjectParagraph& rC = *maParagraphs[--nPara]; for (size_t nAttr = rC.maCharAttribs.size(); nAttr; ) { @@ -625,7 +625,7 @@ void EditTextObject::GetAllSections( std::vector& rAttrs ) con for (size_t nPara = 0; nPara < maParagraphs.size(); ++nPara) { aBorders.clear(); - const EditEngineParagraph& rC = *maParagraphs[nPara]; + const EditTextObjectParagraph& rC = *maParagraphs[nPara]; aBorders.push_back(0); aBorders.push_back(rC.GetText().getLength()); for (const XEditAttribute & rAttr : rC.maCharAttribs) @@ -671,7 +671,7 @@ void EditTextObject::GetAllSections( std::vector& rAttrs ) con std::vector::iterator itAttr = aAttrs.begin(); for (sal_Int32 nPara = 0; nPara < static_cast(maParagraphs.size()); ++nPara) { - const EditEngineParagraph& rC = *maParagraphs[nPara]; + const EditTextObjectParagraph& rC = *maParagraphs[nPara]; itAttr = std::find_if(itAttr, aAttrs.end(), FindByParagraph(nPara)); if (itAttr == aAttrs.end()) @@ -721,14 +721,14 @@ void EditTextObject::GetAllSections( std::vector& rAttrs ) con void EditTextObject::GetStyleSheet(sal_Int32 nPara, OUString& rName, SfxStyleFamily& rFamily) const { - const EditEngineParagraph& rC = *maParagraphs[nPara]; + const EditTextObjectParagraph& rC = *maParagraphs[nPara]; rName = rC.GetStyle(); rFamily = rC.GetFamily(); } void EditTextObject::SetStyleSheet(sal_Int32 nPara, const OUString& rName, const SfxStyleFamily& rFamily) { - EditEngineParagraph& rC = *maParagraphs[nPara]; + EditTextObjectParagraph& rC = *maParagraphs[nPara]; rC.SetStyle(rName); rC.SetFamily(rFamily); } @@ -742,7 +742,7 @@ bool EditTextObject::ImpChangeStyleSheets( for (size_t nPara = 0; nPara < nParagraphs; ++nPara) { - EditEngineParagraph& rC = *maParagraphs[nPara]; + EditTextObjectParagraph& rC = *maParagraphs[nPara]; if ( rC.GetFamily() == eOldFamily ) { if ( rC.GetStyle() == rOldName ) diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index 351bd7547ec1..50d5e1ab515f 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -112,7 +112,7 @@ public: double getSpacingScaleY() const { return mfSpacingScaleY; } }; -class EditEngineParagraph +class EditTextObjectParagraph { friend class EditTextObject; @@ -129,13 +129,13 @@ private: sal_Int16 mnNumberingStartValue { -1 }; bool mbNumberingRestart { false }; - EditEngineParagraph( SfxItemPool& rPool ); - EditEngineParagraph( const EditEngineParagraph& rCopyFrom, SfxItemPool& rPoolToUse ); + EditTextObjectParagraph( SfxItemPool& rPool ); + EditTextObjectParagraph( const EditTextObjectParagraph& rCopyFrom, SfxItemPool& rPoolToUse ); public: - ~EditEngineParagraph(); - EditEngineParagraph(const EditEngineParagraph&) = delete; - EditEngineParagraph& operator=(const EditEngineParagraph&) = delete; + ~EditTextObjectParagraph(); + EditTextObjectParagraph(const EditTextObjectParagraph&) = delete; + EditTextObjectParagraph& operator=(const EditTextObjectParagraph&) = delete; void NormalizeString( svl::SharedStringPool& rPool ); const svl::SharedString& GetSharedString() const { return maText;} @@ -159,10 +159,10 @@ public: const WrongList* GetWrongList() const; void SetWrongList( WrongList* p ); - bool Equals( const EditEngineParagraph& rCompare, bool bComparePool ) const; + bool Equals( const EditTextObjectParagraph& rCompare, bool bComparePool ) const; // #i102062# - bool isWrongListEqual(const EditEngineParagraph& rCompare) const; + bool isWrongListEqual(const EditTextObjectParagraph& rCompare) const; sal_Int16 GetNumberingDepth() const { return mnNumberingDepth; } void SetNumberingDepth(sal_Int16 nDepth) { mnNumberingDepth = nDepth; } diff --git a/editeng/source/editeng/fieldupdater.cxx b/editeng/source/editeng/fieldupdater.cxx index 35164b2af220..81447cc855f2 100644 --- a/editeng/source/editeng/fieldupdater.cxx +++ b/editeng/source/editeng/fieldupdater.cxx @@ -44,10 +44,10 @@ public: void updateTableFields(int nTab) { SfxItemPool* pPool = mrObj.GetPool(); - EditTextObject::EditEngineParagraphs& rContents = mrObj.GetParagraphs(); - for (std::unique_ptr & i : rContents) + EditTextObject::EditTextObjectParagraphs& rContents = mrObj.GetParagraphs(); + for (std::unique_ptr & i : rContents) { - EditEngineParagraph& rContent = *i; + EditTextObjectParagraph& rContent = *i; for (XEditAttribute & rAttr : rContent.GetCharAttribs()) { const SfxPoolItem* pItem = rAttr.GetItem(); @@ -71,10 +71,10 @@ public: void UpdatePageRelativeURLs(const std::function& rItemCallback) { - EditTextObject::EditEngineParagraphs& rContents = mrObj.GetParagraphs(); - for (std::unique_ptr & i : rContents) + EditTextObject::EditTextObjectParagraphs& rContents = mrObj.GetParagraphs(); + for (std::unique_ptr & i : rContents) { - EditEngineParagraph& rContent = *i; + EditTextObjectParagraph& rContent = *i; for (XEditAttribute & rAttr : rContent.GetCharAttribs()) { const SfxPoolItem* pItem = rAttr.GetItem(); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 5880c10579bc..1c84bc84ddec 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -626,6 +626,9 @@ private: Timer maStatusTimer; Size maLOKSpecialPaperSize; + // only valid when used from an Outliner + Outliner* mpOwner; + Link maStatusHdlLink; Link maNotifyHdl; Link maHtmlImportHdl; @@ -875,7 +878,7 @@ private: /// Obtains a view shell ID from the active EditView. ViewShellId CreateViewShellId(); - ImpEditEngine(EditEngine* pEditEngine, SfxItemPool* pPool); + ImpEditEngine(EditEngine* pEditEngine, SfxItemPool* pPool, Outliner* pEngOwner = nullptr); void InitDoc(bool bKeepParaAttribs); EditDoc& GetEditDoc() { return maEditDoc; } const EditDoc& GetEditDoc() const { return maEditDoc; } @@ -1371,6 +1374,8 @@ public: static bool IsSimpleCharInput( const KeyEvent& rKeyEvent ); void RemoveParagraph( sal_Int32 nPara ); + Outliner* GetOwner() { return mpOwner; } + #ifdef DBG_UTIL void DumpData(bool bInfoBox); #endif diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 9a68fa50df87..cf49fe3fac22 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -77,7 +77,6 @@ #include #include #include -#include using namespace ::com::sun::star; @@ -94,7 +93,7 @@ static sal_uInt16 lcl_CalcExtraSpace( const SvxLineSpacingItem& rLSItem ) constexpr tools::Long constMaxPaperSize = 0x7FFFFFFF; -ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : +ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool, Outliner* pEngOwner ) : pSharedVCL(EditDLL::Get().GetSharedVclResources()), maPaperSize(constMaxPaperSize, constMaxPaperSize), maMinAutoPaperSize(0, 0), @@ -114,6 +113,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : mnCurTextHeight(0), maOnlineSpellTimer("editeng::ImpEditEngine aOnlineSpellTimer"), maStatusTimer("editeng::ImpEditEngine aStatusTimer"), + mpOwner(pEngOwner), mbKernAsianPunctuation(false), mbAddExtLeading(false), mbIsFormatting(false), @@ -1525,10 +1525,10 @@ EditPaM ImpEditEngine::WordLeft( const EditPaM& rPaM ) if ( nCurrentPos == 0 ) { // Previous paragraph... - sal_Int32 nCurPara = maEditDoc.GetPos( aNewPaM.GetNode() ); - ContentNode* pPrevNode = maEditDoc.GetObject( --nCurPara ); - if ( pPrevNode ) + sal_Int32 nPrevPara = maEditDoc.GetPos( aNewPaM.GetNode() ) - 1; + if (nPrevPara >= 0) { + ContentNode* pPrevNode = maEditDoc.GetObject( nPrevPara ); aNewPaM.SetNode( pPrevNode ); aNewPaM.SetIndex( pPrevNode->Len() ); } @@ -1575,10 +1575,10 @@ EditPaM ImpEditEngine::WordRight( const EditPaM& rPaM, sal_Int16 nWordType ) if ( aNewPaM.GetIndex() >= nMax ) { // Next paragraph ... - sal_Int32 nCurPara = maEditDoc.GetPos( aNewPaM.GetNode() ); - ContentNode* pNextNode = maEditDoc.GetObject( ++nCurPara ); - if ( pNextNode ) + sal_Int32 nNextPara = maEditDoc.GetPos( aNewPaM.GetNode() ) + 1; + if (nNextPara < maEditDoc.Count()) { + ContentNode* pNextNode = maEditDoc.GetObject( nNextPara ); aNewPaM.SetNode( pNextNode ); aNewPaM.SetIndex( 0 ); } @@ -2572,7 +2572,7 @@ void ImpEditEngine::ImpRemoveParagraph( sal_Int32 nPara ) { assert(maEditDoc.GetObject(nPara)); - ContentNode* pNextNode = maEditDoc.GetObject( nPara+1 ); + ContentNode* pNextNode = nPara+1 < maEditDoc.Count() ? maEditDoc.GetObject( nPara+1 ) : nullptr; std::unique_ptr pNode = maEditDoc.Release(nPara); maDeletedNodes.push_back(std::make_unique(pNode.get(), nPara)); @@ -4120,7 +4120,7 @@ EditSelection ImpEditEngine::ConvertSelection( EditSelection aNewSelection; // Start... - ContentNode* pNode = maEditDoc.GetObject( nStartPara ); + ContentNode* pNode = nStartPara >= maEditDoc.Count() ? nullptr : maEditDoc.GetObject( nStartPara ); sal_Int32 nIndex = nStartPos; if ( !pNode ) { @@ -4134,7 +4134,7 @@ EditSelection ImpEditEngine::ConvertSelection( aNewSelection.Min().SetIndex( nIndex ); // End... - pNode = maEditDoc.GetObject( nEndPara ); + pNode = nEndPara >= maEditDoc.Count() ? nullptr : maEditDoc.GetObject( nEndPara ); nIndex = nEndPos; if ( !pNode ) { @@ -4750,9 +4750,8 @@ bool ImpEditEngine::isInEmptyClusterAtTheEnd(const ParaPortion& rPortion, bool b { if (nCurrent == nPortion) { - OutlinerEditEng* pOutlEditEng{ dynamic_cast(mpEditEngine)}; - if (!bIsScaling && pOutlEditEng) - return pOutlEditEng->GetDepth(nCurrent) < 0; + if (!bIsScaling && mpEditEngine->GetOwner() != nullptr) + return mpEditEngine->GetNumberingDepth(nCurrent) < 0; else return true; } diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index c3806fe306eb..3efe4431afcb 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -3810,11 +3809,9 @@ void ImpEditEngine::StripAllPortions( OutputDevice& rOutDev, tools::Rectangle aC { // tdf#148966 don't paint the line break following a // multiline field based on a compat flag - OutlinerEditEng* pOutlEditEng{ dynamic_cast(mpEditEngine)}; int nStartNextLine = rParaPortion.GetLines()[nLine + 1].GetStartPortion(); const TextPortion& rNextTextPortion = rParaPortion.GetTextPortions()[nStartNextLine]; - if (pOutlEditEng - && pOutlEditEng->GetCompatFlag(SdrCompatibilityFlag::IgnoreBreakAfterMultilineField) + if (mpEditEngine->GetCompatFlag(SdrCompatibilityFlag::IgnoreBreakAfterMultilineField) .value_or(false)) { if (rNextTextPortion.GetKind() == PortionKind::LINEBREAK) diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 83f29cc656c8..bba1ae42b34c 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "eertfpar.hxx" @@ -644,6 +645,32 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel, bool bCl if ( bAttr ) rOutput.WriteChar( ' ' ); // Separator + const SfxInt16Item& rOutlLevelItem = GetParaAttrib(nNode, EE_PARA_OUTLLEVEL); + sal_Int16 nOutlLevel = rOutlLevelItem.GetValue(); + if (nOutlLevel >= 0) + { + // The paragraph has an outline level, check if that is a bullet. + const SvxNumBulletItem& rNumBullet = GetParaAttrib(nNode, EE_PARA_NUMBULLET); + const SvxNumberFormat* pFmt = rNumBullet.GetNumRule().Get(nOutlLevel); + if (pFmt && pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL) + { + sal_Unicode cBullet = static_cast(pFmt->GetBulletChar()); + OUString aBullet(&cBullet, 1); + rOutput.WriteChar('{').WriteOString(OOO_STRING_SVTOOLS_RTF_PNTEXT).WriteChar(' '); + RTFOutFuncs::Out_String(rOutput, aBullet, eDestEnc); + rOutput.WriteOString("\\tab}"); + rOutput.WriteChar('{') + .WriteOString(OOO_STRING_SVTOOLS_RTF_IGNORE) + .WriteOString(OOO_STRING_SVTOOLS_RTF_PN) + .WriteOString(OOO_STRING_SVTOOLS_RTF_PNLVLBLT) + .WriteChar('{') + .WriteOString(OOO_STRING_SVTOOLS_RTF_PNTXTB) + .WriteChar(' '); + RTFOutFuncs::Out_String(rOutput, aBullet, eDestEnc); + rOutput.WriteOString("}}"); + } + } + ItemList aAttribItems; ParaPortion* pParaPortion = FindParaPortion( pNode ); DBG_ASSERT( pParaPortion, "Portion not found: WriteRTF" ); @@ -1227,7 +1254,7 @@ EditTextObject ImpEditEngine::CreateTextObject( EditSelection aSel, SfxItemPool* nEndPos = aSel.Max().GetIndex(); - EditEngineParagraph *pC = aTxtObj.CreateAndInsertParagraph(); + EditTextObjectParagraph *pC = aTxtObj.CreateAndInsertParagraph(); // The paragraph attributes ... pC->GetParaAttribs().Set( pNode->GetContentAttribs().GetItems() ); @@ -1399,7 +1426,7 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject for (sal_Int32 n = 0; n < nContents; ++n, ++nPara) { - const EditEngineParagraph* pC = rTextObject.GetParagraphs()[n].get(); + const EditTextObjectParagraph* pC = rTextObject.GetParagraphs()[n].get(); bool bNewContent = aPaM.GetNode()->Len() == 0; const sal_Int32 nStartPos = aPaM.GetIndex(); diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx deleted file mode 100644 index 457bb0b0d139..000000000000 --- a/editeng/source/outliner/outleeng.cxx +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include -#include - -#include -#include -#include "paralist.hxx" -#include -#include -#include -#include "outlundo.hxx" - -OutlinerEditEng::OutlinerEditEng( Outliner* pEngOwner, SfxItemPool* pPool ) - : EditEngine( pPool ) -{ - pOwner = pEngOwner; -} - -OutlinerEditEng::~OutlinerEditEng() -{ -} - -void OutlinerEditEng::ProcessFirstLineOfParagraph(sal_Int32 nPara, const Point& rStartPos, OutputDevice& rOutDev, StripPortionsHelper& rStripPortionsHelper) -{ - if( GetControlWord() & EEControlBits::OUTLINER ) - { - PaintFirstLineInfo aInfo(nPara, rStartPos, &rOutDev, rStripPortionsHelper); - pOwner->maPaintFirstLineHdl.Call( &aInfo ); - } - - pOwner->StripBullet(nPara, rStartPos, rOutDev, rStripPortionsHelper); -} - -const SvxNumberFormat* OutlinerEditEng::GetNumberFormat( sal_Int32 nPara ) const -{ - const SvxNumberFormat* pFmt = nullptr; - if (pOwner) - pFmt = pOwner->GetNumberFormat( nPara ); - return pFmt; -} - - -tools::Rectangle OutlinerEditEng::GetBulletArea( sal_Int32 nPara ) -{ - tools::Rectangle aBulletArea { Point(), Point() }; - if ( nPara < pOwner->pParaList->GetParagraphCount() ) - { - if ( pOwner->ImplHasNumberFormat( nPara ) ) - aBulletArea = pOwner->ImpCalcBulletArea( nPara, false, false ); - } - return aBulletArea; -} - -std::optional OutlinerEditEng::GetCompatFlag(SdrCompatibilityFlag eFlag) const -{ - if(pOwner) - { - return pOwner->GetCompatFlag(eFlag); - } - return {}; -} - -void OutlinerEditEng::ParagraphInserted( sal_Int32 nNewParagraph ) -{ - pOwner->ParagraphInserted( nNewParagraph ); - - EditEngine::ParagraphInserted( nNewParagraph ); -} - -void OutlinerEditEng::ParagraphDeleted( sal_Int32 nDeletedParagraph ) -{ - pOwner->ParagraphDeleted( nDeletedParagraph ); - - EditEngine::ParagraphDeleted( nDeletedParagraph ); -} - -void OutlinerEditEng::ParagraphConnected( sal_Int32 /*nLeftParagraph*/, sal_Int32 nRightParagraph ) -{ - if( pOwner && pOwner->IsUndoEnabled() && !pOwner->GetEditEngine().IsInUndo() ) - { - Paragraph* pPara = pOwner->GetParagraph( nRightParagraph ); - if( pPara && Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) ) - { - pOwner->InsertUndo( std::make_unique( pOwner, nRightParagraph, ParaFlag::ISPAGE, ParaFlag::NONE ) ); - } - } -} - - -void OutlinerEditEng::StyleSheetChanged( SfxStyleSheet* pStyle ) -{ - pOwner->StyleSheetChanged( pStyle ); -} - -void OutlinerEditEng::ParaAttribsChanged( sal_Int32 nPara ) -{ - pOwner->ParaAttribsChanged( nPara ); -} - -bool OutlinerEditEng::SpellNextDocument() -{ - return pOwner->SpellNextDocument(); -} - -bool OutlinerEditEng::ConvertNextDocument() -{ - return pOwner->ConvertNextDocument(); -} - -OUString OutlinerEditEng::GetUndoComment( sal_uInt16 nUndoId ) const -{ - switch( nUndoId ) - { - case OLUNDO_DEPTH: - return EditResId(RID_OUTLUNDO_DEPTH); - - case OLUNDO_EXPAND: - return EditResId(RID_OUTLUNDO_EXPAND); - - case OLUNDO_COLLAPSE: - return EditResId(RID_OUTLUNDO_COLLAPSE); - - case OLUNDO_ATTR: - return EditResId(RID_OUTLUNDO_ATTR); - - case OLUNDO_INSERT: - return EditResId(RID_OUTLUNDO_INSERT); - - default: - return EditEngine::GetUndoComment( nUndoId ); - } -} - -OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional& rpTxtColor, std::optional& rpFldColor, std::optional& rpFldLineStyle ) -{ - return pOwner->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle ); -} - -void OutlinerEditEng::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) -{ - Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - if( !pPara ) - return; - - if ( !IsInUndo() && IsUndoEnabled() ) - pOwner->UndoActionStart( OLUNDO_ATTR ); - - EditEngine::SetParaAttribs( nPara, rSet ); - - pOwner->ImplCheckNumBulletItem( nPara ); - // #i100014# - // It is not a good idea to subtract 1 from a count and cast the result - // to sal_uInt16 without check, if the count is 0. - pOwner->ImplCheckParagraphs( nPara, pOwner->pParaList->GetParagraphCount() ); - - if ( !IsInUndo() && IsUndoEnabled() ) - pOwner->UndoActionEnd(); -} - -sal_Int16 OutlinerEditEng::GetDepth(sal_Int32 nPara) const -{ - return pOwner->GetDepth(nPara); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index c2cbca480b16..8023e77b9741 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -29,8 +29,7 @@ #include #include -#include "paralist.hxx" -#include +#include #include @@ -497,11 +496,6 @@ bool Outliner::ShouldCreateBigTextObject() const return pEditEngine->ShouldCreateBigTextObject(); } -const EditEngine& Outliner::GetEditEngine() const -{ - return *pEditEngine; -} - void Outliner::SetVertical(bool bVertical) { pEditEngine->SetVertical(bVertical); diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 9d216af0ff3f..314a507d8655 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -27,10 +27,9 @@ #include #include -#include "paralist.hxx" +#include #include -#include -#include "outlundo.hxx" +#include #include #include #include @@ -1169,7 +1168,7 @@ bool Outliner::ImpCanDeleteSelectedPages( OutlinerView* pCurView ) } Outliner::Outliner(SfxItemPool* pPool, OutlinerMode nMode) - : pEditEngine(new OutlinerEditEng(this, pPool)) + : pEditEngine(new EditEngine(this, pPool)) , pParaList(new ParagraphList) , mnFirstSelPage(0) , nDepthChangedHdlPrevDepth(0) diff --git a/editeng/source/outliner/outlundo.cxx b/editeng/source/outliner/outlundo.cxx index 86e63ac1e8b9..1189dea6b66f 100644 --- a/editeng/source/outliner/outlundo.cxx +++ b/editeng/source/outliner/outlundo.cxx @@ -20,7 +20,7 @@ #include #include -#include "outlundo.hxx" +#include OutlinerUndoBase::OutlinerUndoBase( sal_uInt16 _nId, Outliner* pOutliner ) diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 56a4528e9d5b..66c5c19b1f9a 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -31,9 +31,8 @@ #include #include -#include -#include "paralist.hxx" -#include "outlundo.hxx" +#include +#include #include #include #include @@ -52,7 +51,7 @@ using namespace ::com::sun::star; OutlinerView::OutlinerView(Outliner& rOut, vcl::Window* pWin) : rOwner(rOut) - , pEditView(new EditView(rOut.getOutlinerEditEng(), pWin)) + , pEditView(new EditView(rOut.GetEditEngine(), pWin)) { } diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx index e175939ea7c9..687764b36cd4 100644 --- a/editeng/source/outliner/overflowingtxt.cxx +++ b/editeng/source/outliner/overflowingtxt.cxx @@ -46,7 +46,7 @@ std::optional TextChainingUtils::JuxtaposeParaObject( (pOutl->GetParagraphCount() == 1 && !pNextPObj->GetTextObject().HasText(0)); - EditEngine &rEditEngine = const_cast(pOutl->GetEditEngine()); + EditEngine &rEditEngine = pOutl->GetEditEngine(); // XXX: this code should be moved in Outliner directly // creating Outliner::InsertText(...transferable...) @@ -76,7 +76,7 @@ std::optional TextChainingUtils::DeeplyMergeParaObject( pOutl->SetText(*pNextPObj); } - EditEngine &rEditEngine = const_cast(pOutl->GetEditEngine()); + EditEngine &rEditEngine = pOutl->GetEditEngine(); // XXX: this code should be moved in Outliner directly // creating Outliner::InsertText(...transferable...) @@ -91,9 +91,9 @@ std::optional TextChainingUtils::DeeplyMergeParaObject( return pOutl->CreateParaObject(); } -css::uno::Reference< css::datatransfer::XTransferable > TextChainingUtils::CreateTransferableFromText(Outliner const *pOutl) +css::uno::Reference< css::datatransfer::XTransferable > TextChainingUtils::CreateTransferableFromText(Outliner *pOutl) { - EditEngine& rEditEngine = const_cast(pOutl->GetEditEngine()); + EditEngine& rEditEngine = pOutl->GetEditEngine(); sal_Int32 nLastPara = pOutl->GetParagraphCount()-1; ESelection aWholeTextSel(0, 0, nLastPara, rEditEngine.GetTextLen(nLastPara)); @@ -201,7 +201,7 @@ bool OFlowChainedText::IsLastParaInterrupted() const -UFlowChainedText::UFlowChainedText(Outliner const *pOutl, bool bIsDeepMerge) +UFlowChainedText::UFlowChainedText(Outliner *pOutl, bool bIsDeepMerge) { mxUnderflowingTxt = TextChainingUtils::CreateTransferableFromText(pOutl); mbIsDeepMerge = bIsDeepMerge; diff --git a/editeng/source/outliner/paralist.cxx b/editeng/source/outliner/paralist.cxx index 9ced9f808386..a356fe367b7e 100644 --- a/editeng/source/outliner/paralist.cxx +++ b/editeng/source/outliner/paralist.cxx @@ -18,7 +18,7 @@ */ -#include "paralist.hxx" +#include #include #include diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index e95fb7132500..a7f3a371b9fb 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -61,8 +61,8 @@ OUString SvxOutlinerForwarder::GetText( const ESelection& rSel ) const { //! GetText (ESelection) should probably also be in the Outliner // in the time being use as the hack for the EditEngine: - EditEngine* pEditEngine = const_cast(&rOutliner.GetEditEngine()); - return pEditEngine->GetText( rSel ); + EditEngine& rEditEngine = rOutliner.GetEditEngine(); + return rEditEngine.GetText( rSel ); } static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib, EditEngine& rEditEngine ) @@ -109,7 +109,7 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineA //! Does it not exist on the Outliner? //! and why is the GetAttribs on the EditEngine not a const? - EditEngine& rEditEngine = const_cast(rOutliner.GetEditEngine()); + EditEngine& rEditEngine = rOutliner.GetEditEngine(); SfxItemSet aSet( ImplOutlinerForwarderGetAttribs( rSel, nOnlyHardAttrib, rEditEngine ) ); @@ -146,7 +146,7 @@ SfxItemSet SvxOutlinerForwarder::GetParaAttribs( sal_Int32 nPara ) const moParaAttribsCache.emplace( rOutliner.GetParaAttribs( nPara ) ); mnParaAttribsCache = nPara; - EditEngine& rEditEngine = const_cast(rOutliner.GetEditEngine()); + EditEngine& rEditEngine = rOutliner.GetEditEngine(); SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( nPara ); if( pStyle ) @@ -181,7 +181,7 @@ SfxItemPool* SvxOutlinerForwarder::GetPool() const void SvxOutlinerForwarder::GetPortions( sal_Int32 nPara, std::vector& rList ) const { - const_cast(rOutliner.GetEditEngine()).GetPortions( nPara, rList ); + rOutliner.GetEditEngine().GetPortions( nPara, rList ); } OUString SvxOutlinerForwarder::GetStyleSheet(sal_Int32 nPara) const @@ -522,13 +522,13 @@ void SvxOutlinerForwarder::SetParaIsNumberingRestart( sal_Int32 nPara, bool bPa const SfxItemSet * SvxOutlinerForwarder::GetEmptyItemSetPtr() { - EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() ); + EditEngine& rEditEngine = rOutliner.GetEditEngine(); return &rEditEngine.GetEmptyItemSet(); } void SvxOutlinerForwarder::AppendParagraph() { - EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() ); + EditEngine& rEditEngine = rOutliner.GetEditEngine(); rEditEngine.InsertParagraph( rEditEngine.GetParagraphCount(), OUString() ); } @@ -536,7 +536,7 @@ sal_Int32 SvxOutlinerForwarder::AppendTextPortion( sal_Int32 nPara, const OUStri { sal_Int32 nLen = 0; - EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() ); + EditEngine& rEditEngine = rOutliner.GetEditEngine(); sal_Int32 nParaCount = rEditEngine.GetParagraphCount(); DBG_ASSERT( 0 <= nPara && nPara < nParaCount, "paragraph index out of bounds" ); if (0 <= nPara && nPara < nParaCount) diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 2b1d08b08d18..76eebd5bea7f 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -156,7 +156,7 @@ DocumentHolder::DocumentHolder( uno::Reference< uno::XComponentContext > xContex m_bReadOnly( false ), m_bWaitForClose( false ), m_bAllowClosing( false ), - m_bDesktopTerminated( false ), + m_bTerminateListenerRegistered( false ), m_nNoBorderResizeReact( 0 ), m_nNoResizeReact( 0 ) { @@ -165,6 +165,7 @@ DocumentHolder::DocumentHolder( uno::Reference< uno::XComponentContext > xContex try { xDesktop->addTerminateListener( this ); + m_bTerminateListenerRegistered = true; } catch ( const uno::Exception& ) { @@ -198,8 +199,7 @@ DocumentHolder::~DocumentHolder() m_xInterceptor.clear(); } - if ( !m_bDesktopTerminated ) - FreeOffice(); + FreeOffice(); } @@ -233,6 +233,10 @@ void DocumentHolder::CloseFrame() void DocumentHolder::FreeOffice() { + // tdf#125846 - deregister listener only once since a second removal would check all listeners + if (!m_bTerminateListenerRegistered) + return; + m_bTerminateListenerRegistered = false; try { uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( m_xContext ); xDesktop->removeTerminateListener( this ); @@ -1152,8 +1156,8 @@ void SAL_CALL DocumentHolder::notifyTermination( const lang::EventObject& aSourc { OSL_ENSURE( !m_xComponent.is(), "Just a disaster..." ); + m_bTerminateListenerRegistered = false; uno::Reference< frame::XDesktop > xDesktop( aSource.Source, uno::UNO_QUERY ); - m_bDesktopTerminated = true; if ( xDesktop.is() ) xDesktop->removeTerminateListener( static_cast(this) ); } diff --git a/embeddedobj/source/inc/docholder.hxx b/embeddedobj/source/inc/docholder.hxx index 2c221cc411c6..21e915d09e32 100644 --- a/embeddedobj/source/inc/docholder.hxx +++ b/embeddedobj/source/inc/docholder.hxx @@ -77,7 +77,7 @@ private: bool m_bWaitForClose; bool m_bAllowClosing; - bool m_bDesktopTerminated; + bool m_bTerminateListenerRegistered; sal_Int32 m_nNoBorderResizeReact; sal_Int32 m_nNoResizeReact; diff --git a/external/expat/0001-fix-XML_GE-is-not-defined-evaluates-to-0-Werror-unde.patch b/external/expat/0001-fix-XML_GE-is-not-defined-evaluates-to-0-Werror-unde.patch new file mode 100644 index 000000000000..5ac374aec5b6 --- /dev/null +++ b/external/expat/0001-fix-XML_GE-is-not-defined-evaluates-to-0-Werror-unde.patch @@ -0,0 +1,25 @@ +From 3e3d9091bc3db29901a1507466bf0479ff38de9a Mon Sep 17 00:00:00 2001 +From: Xisco Fauli +Date: Tue, 6 Oct 2026 10:50:50 +0200 +Subject: [PATCH] fix XML_GE is not defined, evaluates to 0 [-Werror=undef] + +--- + expat/lib/expat.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/expat/lib/expat.h b/expat/lib/expat.h +index 1b2852dd..fea2fd99 100644 +--- a/expat/lib/expat.h ++++ b/expat/lib/expat.h +@@ -1084,7 +1084,7 @@ enum XML_Parser_Property { + # if defined(XML_TESTING) + XML_PROP_INVALID = 0, + # endif +-# if XML_GE == 1 ++# if defined(XML_GE) && XML_GE == 1 + XML_PROP_ALLOC_TRACKER_ACTIVATION_THRESHOLD = 1, // of type `uint64_t` + XML_PROP_ALLOC_TRACKER_MAXIMUM_AMPLIFICATION = 2, // of type `double` + XML_PROP_BILLION_LAUGHS_ACTIVATION_THRESHOLD = 3, // of type `uint64_t` +-- +2.47.3 + diff --git a/external/expat/StaticLibrary_expat.mk b/external/expat/StaticLibrary_expat.mk index 6ca4fc84bf7f..b3b8fbb5d1ed 100644 --- a/external/expat/StaticLibrary_expat.mk +++ b/external/expat/StaticLibrary_expat.mk @@ -57,6 +57,7 @@ $(eval $(call gb_StaticLibrary_add_generated_cobjects,expat,\ endif $(eval $(call gb_StaticLibrary_add_generated_cobjects,expat,\ + UnpackedTarball/expat/lib/xcs \ UnpackedTarball/expat/lib/xmlparse \ UnpackedTarball/expat/lib/xmlrole \ UnpackedTarball/expat/lib/xmltok \ diff --git a/external/expat/UnpackedTarball_expat.mk b/external/expat/UnpackedTarball_expat.mk index e9e4f75046f2..721b9ac6e031 100644 --- a/external/expat/UnpackedTarball_expat.mk +++ b/external/expat/UnpackedTarball_expat.mk @@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,expat,2)) $(eval $(call gb_UnpackedTarball_add_patches,expat,\ external/expat/expat-winapi.patch \ + external/expat/0001-fix-XML_GE-is-not-defined-evaluates-to-0-Werror-unde.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/expat/expat-winapi.patch b/external/expat/expat-winapi.patch index ea664c3db76c..a789c7057c50 100644 --- a/external/expat/expat-winapi.patch +++ b/external/expat/expat-winapi.patch @@ -13,8 +13,8 @@ --- misc/expat-2.5.0/lib/xmlparse.c 2022-10-26 00:09:08.000000000 +0900 +++ misc/build/expat-2.5.0/lib/xmlparse.c 2022-10-30 23:09:01.843006341 +0900 -@@ -98,6 +98,10 @@ - #include +@@ -112,6 +112,10 @@ + #include /* wcsncmp */ #ifdef _WIN32 +# undef HAVE_ARC4RANDOM diff --git a/external/fontconfig/UnpackedTarball_fontconfig.mk b/external/fontconfig/UnpackedTarball_fontconfig.mk index a43a3db7f840..fdc476da3937 100644 --- a/external/fontconfig/UnpackedTarball_fontconfig.mk +++ b/external/fontconfig/UnpackedTarball_fontconfig.mk @@ -16,6 +16,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,fontconfig,0)) $(eval $(call gb_UnpackedTarball_add_patches,fontconfig,\ external/fontconfig/fontconfig-2.12.1.patch.1 \ external/fontconfig/nowarnnoconfig.patch.1 \ + external/fontconfig/apple-xlocale.patch.1 \ )) ifneq ($(OS),MACOSX) diff --git a/external/fontconfig/apple-xlocale.patch.1 b/external/fontconfig/apple-xlocale.patch.1 new file mode 100644 index 000000000000..af5744cb9326 --- /dev/null +++ b/external/fontconfig/apple-xlocale.patch.1 @@ -0,0 +1,23 @@ +--- fontconfig/src/fcint.h.foo 2026-09-30 11:01:43 ++++ fontconfig/src/fcint.h 2026-09-30 11:10:23 +@@ -44,6 +44,9 @@ + #ifdef HAVE_UNISTD_H + # include + #endif ++#if defined(HAVE_XLOCALE_H) || defined(__APPLE__) ++#include ++#endif + #include + #include + +--- fontconfig/src/fcstr.c.foo 2026-09-30 11:05:33 ++++ fontconfig/src/fcstr.c 2026-09-30 11:10:17 +@@ -28,7 +28,7 @@ + #include + #include + #include +-#ifdef HAVE_XLOCALE_H ++#if defined(HAVE_XLOCALE_H) || defined(__APPLE__) + #include + #endif + diff --git a/external/hsqldb/UnpackedTarball_hsqldb.mk b/external/hsqldb/UnpackedTarball_hsqldb.mk index c532b9cc2266..97db5ed50aad 100644 --- a/external/hsqldb/UnpackedTarball_hsqldb.mk +++ b/external/hsqldb/UnpackedTarball_hsqldb.mk @@ -33,6 +33,8 @@ $(eval $(call gb_UnpackedTarball_add_patches,hsqldb,\ external/hsqldb/patches/abstract.patch \ external/hsqldb/patches/applet.patch.0 \ external/hsqldb/patches/hsqldb-jar-timestamps.patch.1 \ + external/hsqldb/patches/lockfile.patch.1 \ + external/hsqldb/patches/allow-full-path-system-property.patch.1 \ )) # vim: set noet sw=4 ts=4: diff --git a/external/hsqldb/patches/allow-full-path-system-property.patch.1 b/external/hsqldb/patches/allow-full-path-system-property.patch.1 new file mode 100644 index 000000000000..631999bcf615 --- /dev/null +++ b/external/hsqldb/patches/allow-full-path-system-property.patch.1 @@ -0,0 +1,27 @@ +From 80a589cc94dd3c67d7cbf978ca4c4328b84eb856 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Tue, 29 Sep 2026 15:41:04 +0000 +Subject: [PATCH] read textdb.allow_full_path only as a Java system property + +HSQLDB 2.x reads it that way since 2.1.0, see svn r3769 +https://github.com/ryenus/hsqldb/commit/909e46eb5aea11a38aad3d1f57f5a656eba8132e +--- + src/org/hsqldb/persist/Log.java | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/org/hsqldb/persist/Log.java b/src/org/hsqldb/persist/Log.java +index 284d9f4..18c698b 100644 +--- a/src/org/hsqldb/persist/Log.java ++++ b/src/org/hsqldb/persist/Log.java +@@ -763,7 +763,7 @@ public class Log { + + closeTextCache(table); + +- if (!properties.isPropertyTrue( ++ if (!Boolean.getBoolean( + HsqlDatabaseProperties.textdb_allow_full_path)) { + if (source.indexOf("..") != -1) { + throw (Trace.error(Trace.ACCESS_IS_DENIED, source)); +-- +2.55.0 + diff --git a/external/hsqldb/patches/lockfile.patch.1 b/external/hsqldb/patches/lockfile.patch.1 new file mode 100644 index 000000000000..a079ac9cf9f5 --- /dev/null +++ b/external/hsqldb/patches/lockfile.patch.1 @@ -0,0 +1,30 @@ +From 648ff3be795c39d9d5f8bccb55253fd674ffe91d Mon Sep 17 00:00:00 2001 +From: fredt +Date: Mon, 31 Aug 2009 17:27:31 +0000 +Subject: [PATCH] code updates leading to 1.8.1 release + +git-svn-id: https://svn.code.sf.net/p/hsqldb/svn/base-one/trunk@3155 7c7dc5f5-a22d-0410-a3af-b41755a11667 +--- + src/org/hsqldb/persist/LockFile.java | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/org/hsqldb/persist/LockFile.java b/src/org/hsqldb/persist/LockFile.java +index ece83bb..6045bed 100755 +--- a/src/org/hsqldb/persist/LockFile.java ++++ b/src/org/hsqldb/persist/LockFile.java +@@ -795,9 +795,9 @@ public class LockFile { + try { + if (withCreateNewFile) { + try { +- file.createNewFile(); +- +- return; ++ if (file.createNewFile()) { ++ return; ++ } + } catch (IOException ioe) {} + } + +-- +2.55.0 + diff --git a/external/openldap/UnpackedTarball_openldap.mk b/external/openldap/UnpackedTarball_openldap.mk index 661d509187f9..3488732b9e6d 100644 --- a/external/openldap/UnpackedTarball_openldap.mk +++ b/external/openldap/UnpackedTarball_openldap.mk @@ -24,6 +24,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,openldap,\ $(eval $(call gb_UnpackedTarball_add_patches,openldap,\ external/openldap/openldap-2.4.44.patch.1 \ + external/openldap/openldap-Xcode-16-case-block.patch.1 \ )) # vim: set noet sw=4 ts=4: diff --git a/external/openldap/openldap-Xcode-16-case-block.patch.1 b/external/openldap/openldap-Xcode-16-case-block.patch.1 new file mode 100644 index 000000000000..d74900146224 --- /dev/null +++ b/external/openldap/openldap-Xcode-16-case-block.patch.1 @@ -0,0 +1,46 @@ +Xcode doesn't accept decarations directly after case +diff -ur openldap.org/libraries/libldap/tls_o.c openldap/libraries/libldap/tls_o.c +--- openldap.org/libraries/libldap/tls_o.c 2026-09-30 18:59:22 ++++ openldap/libraries/libldap/tls_o.c 2026-09-30 19:01:10 +@@ -544,6 +544,7 @@ + while ((info = OSSL_STORE_load( sctx ))) { + switch (OSSL_STORE_INFO_get_type( info )) { + case OSSL_STORE_INFO_CERT: ++ { + X509 *cert = OSSL_STORE_INFO_get0_CERT( info ); + X509_STORE *store = SSL_CTX_get_cert_store( ctx ); + if ( !X509_STORE_add_cert( store, cert ) ) { +@@ -565,6 +566,7 @@ + } + } + break; ++ } + default: + /* ignore other types */ + break; +@@ -754,6 +756,7 @@ + } + break; + case OSSL_STORE_INFO_CERT: ++ { + X509 *cert = OSSL_STORE_INFO_get0_CERT(info); + int is_ca = X509_check_ca( cert ); + if ( !is_ca && !SSL_CTX_use_certificate( ctx, cert )) { +@@ -773,7 +776,9 @@ + return -1; + } + break; ++ } + case OSSL_STORE_INFO_CRL: ++ { + X509_STORE *x509_s = SSL_CTX_get_cert_store( ctx ); + if ( !X509_STORE_add_crl( x509_s, + OSSL_STORE_INFO_get0_CRL(info) )) { +@@ -785,6 +790,7 @@ + return -1; + } + break; ++ } + default: + /* ignore other types */ + break; diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk index 0906bbe7c944..c15ae0bb6f75 100644 --- a/external/pdfium/Library_pdfium.mk +++ b/external/pdfium/Library_pdfium.mk @@ -66,6 +66,10 @@ $(eval $(call gb_Library_add_defs,pdfium,\ -DUSE_SYSTEM_FAST_FLOAT \ )) endif +# Always define: our pdfium tarball doesn't ship third_party/dragonbox/src/ itself. +$(eval $(call gb_Library_add_defs,pdfium,\ + -DUSE_SYSTEM_DRAGONBOX \ +)) $(eval $(call gb_Library_set_generated_cxx_suffix,pdfium,cpp)) @@ -299,7 +303,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_table \ UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_stringarchivestream \ UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_occontext \ - UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_contentstream_write_utils \ UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_font_util \ UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_fontsubsetter \ UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_annotcontext \ @@ -389,6 +392,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxcodec/jbig2/jbig2_segment \ UnpackedTarball/pdfium/core/fxcodec/jbig2/jbig2_symbol_dict \ UnpackedTarball/pdfium/core/fxcodec/jbig2/jbig2_trd_proc \ + UnpackedTarball/pdfium/core/fxcodec/image_predictors \ + UnpackedTarball/pdfium/core/fxcodec/jpeg/libjpeg_scanline_decoder \ )) $(eval $(call gb_Library_add_generated_cobjects,pdfium,\ @@ -453,6 +458,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxcrt/cfx_read_only_container_stream \ UnpackedTarball/pdfium/core/fxcrt/bytestring_pool \ UnpackedTarball/pdfium/core/fxcrt/cfx_bidi_resolver \ + UnpackedTarball/pdfium/core/fxcrt/stream_write_utils \ )) ifneq ($(OS),WNT) @@ -586,6 +592,12 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ )) endif +ifneq ($(SYSTEM_ABSEIL),TRUE) +$(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ + UnpackedTarball/pdfium/third_party/abseil-cpp/absl/base/throw_delegate \ +)) +endif + $(eval $(call gb_Library_use_externals,pdfium,\ libjpeg \ lcms2 \ @@ -593,6 +605,7 @@ $(eval $(call gb_Library_use_externals,pdfium,\ icu_headers \ icuuc \ harfbuzz \ + dragonbox \ )) ifneq (,$(filter LINUX ANDROID,$(OS))) diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index c06f9b6b244b..b4da705c60e8 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -21,10 +21,7 @@ pdfium_patches += charcodetoglyphindex.patch.1 pdfium_patches += getfontdictobjnum.patch.1 pdfium_patches += system-fast_float.diff -# https://pdfium-review.googlesource.com/c/pdfium/+/154490 -pdfium_patches += system-icu.patch.1 -# https://pdfium-review.googlesource.com/c/pdfium/+/154690 -pdfium_patches += fix-windows-build.patch.1 +pdfium_patches += system-dragonbox.diff ifeq ($(OS),WNT) pdfium_patches += pdfium-vs2019-arm64_no-__umulh.patch.1 @@ -32,10 +29,6 @@ endif # TODO, attempt upstream pdfium_patches += ofz451333752.patch -# https://pdfium-review.googlesource.com/c/pdfium/+/154910 -pdfium_patches += extractpatterns-stroke.patch.1 -# https://pdfium-review.googlesource.com/c/pdfium/+/157490 -pdfium_patches += extractpatterns-fill.patch.1 pdfium_patches += charbboxinflation.patch.1 # Hide bundled FreeType symbols pdfium_patches += freetype-hidden-visibility.patch @@ -57,7 +50,8 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\ mv third_party/bigint/BigUnsignedInABase.cc third_party/bigint/BigUnsignedInABase.cpp && \ mv core/fxcrt/debug/alias.cc core/fxcrt/debug/alias.cpp && \ mv core/fxcrt/win/win_util.cc core/fxcrt/win/win_util.cpp && \ - mv third_party/libopenjpeg/opj_malloc.cc third_party/libopenjpeg/opj_malloc.cpp \ + mv third_party/libopenjpeg/opj_malloc.cc third_party/libopenjpeg/opj_malloc.cpp && \ + mv third_party/abseil-cpp/absl/base/throw_delegate.cc third_party/abseil-cpp/absl/base/throw_delegate.cpp \ )) # vim: set noet sw=4 ts=4: diff --git a/external/pdfium/charbboxinflation.patch.1 b/external/pdfium/charbboxinflation.patch.1 index e70b44b58bbf..3d59cfd5c0db 100644 --- a/external/pdfium/charbboxinflation.patch.1 +++ b/external/pdfium/charbboxinflation.patch.1 @@ -18,7 +18,7 @@ diff -ru pdfium.orig/core/fxge/cfx_face.cpp pdfium/core/fxge/cfx_face.cpp int FTPosToCBoxInt(FT_Pos pos) { // Boundary values to avoid integer overflow when multiplied by 1000. static constexpr FT_Pos kMinCBox = -2147483; -@@ -1289,11 +1289,6 @@ +@@ -1209,11 +1209,6 @@ int err = LoadGlyph(glyph_index, /*scale=*/false); if (err == 0) { rect = GetGlyphBBox(glyph_index); @@ -27,6 +27,6 @@ diff -ru pdfium.orig/core/fxge/cfx_face.cpp pdfium/core/fxge/cfx_face.cpp - } else { - rect.top = std::numeric_limits::max(); - } - #if defined(PDF_ENABLE_SKIA_TYPEFACE_CHECKS) - #if defined(PDF_ENABLE_FONTATIONS) - if (skrifa_font_ && skrifa_font_->font->is_ok()) { + } + } + return rect; diff --git a/external/pdfium/extractpatterns-fill.patch.1 b/external/pdfium/extractpatterns-fill.patch.1 deleted file mode 100644 index 421c078c287e..000000000000 --- a/external/pdfium/extractpatterns-fill.patch.1 +++ /dev/null @@ -1,179 +0,0 @@ -From 3e9b2c24c3c35c17ad887f6b415e04163d97ae3c Mon Sep 17 00:00:00 2001 -Date: Thu, 17 Sep 2026 15:52:06 -0700 -Subject: [PATCH] Add FPDFPageObj_GetRenderedFillPattern() API - -This is similar to http://pdfium-review.googlesource.com/c/154910, but -that one was for stroke patterns and this is for fill patterns. - -Change-Id: I9929e232472fdd974009c64bcb1109d69a813d0a -Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/157490 -Commit-Queue: Lei Zhang -Reviewed-by: Tom Sepez -Reviewed-by: Lei Zhang ---- - fpdfsdk/fpdf_edit_embeddertest.cpp | 64 ++++++++++++++ - fpdfsdk/fpdf_editpage.cpp | 79 +++++++++++------- - fpdfsdk/fpdf_view_c_api_test.c | 1 + - public/fpdf_edit.h | 16 ++++ - .../resources/embedder_tests/pattern_fill.png | Bin 0 -> 107 bytes - .../embedder_tests/pattern_fill_uncolored.png | Bin 0 -> 107 bytes - testing/resources/pattern_fill.in | 56 +++++++++++++ - testing/resources/pattern_fill.pdf | 68 +++++++++++++++ - testing/resources/pattern_fill_uncolored.in | 58 +++++++++++++ - testing/resources/pattern_fill_uncolored.pdf | 70 ++++++++++++++++ - 10 files changed, 384 insertions(+), 28 deletions(-) - create mode 100644 testing/resources/embedder_tests/pattern_fill.png - create mode 100644 testing/resources/embedder_tests/pattern_fill_uncolored.png - create mode 100644 testing/resources/pattern_fill.in - create mode 100644 testing/resources/pattern_fill.pdf - create mode 100644 testing/resources/pattern_fill_uncolored.in - create mode 100644 testing/resources/pattern_fill_uncolored.pdf - -diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp -index 9b9474ed7..033572048 100644 ---- a/fpdfsdk/fpdf_editpage.cpp -+++ b/fpdfsdk/fpdf_editpage.cpp -@@ -199,7 +199,8 @@ ByteString FormatPDFDate(time_t current_time, const tm& local_time) { - - FPDF_BITMAP RenderTilingPatternToBitmap(CPDF_Pattern* pattern, - CPDF_Document* doc, -- CPDF_PageObject* page_obj) { -+ CPDF_PageObject* page_obj, -+ bool use_stroke_color) { - CPDF_TilingPattern* tiling_pattern = pattern->AsTilingPattern(); - if (!tiling_pattern) { - return nullptr; -@@ -228,10 +229,13 @@ FPDF_BITMAP RenderTilingPatternToBitmap(CPDF_Pattern* pattern, - return FPDFBitmapFromCFXDIBitmap(cell_bitmap.Leak()); - } - -- // An uncolored pattern gets its color from the stroke color operands. -- const FX_COLORREF stroke_colorref = -- page_obj->color_state().GetStrokeColorRef(); -- if (stroke_colorref == 0xFFFFFFFF) { -+ // An uncolored pattern gets its color from the stroke/fill color operands. -+ const CPDF_ColorState& color_state = page_obj->color_state(); -+ const FX_COLORREF colorref = -+ use_stroke_color ? color_state.GetStrokeColorRef() -+ : color_state.GetFillColorRef(); -+ // 0xFFFFFFFF is the unusable color, see FX_COLORREF. -+ if (colorref == 0xFFFFFFFF) { - return nullptr; - } - -@@ -240,11 +244,14 @@ FPDF_BITMAP RenderTilingPatternToBitmap(CPDF_Pattern* pattern, - FXDIB_Format::kBgra)) { - return nullptr; - } -- const int stroke_alpha = -- static_cast(page_obj->general_state().GetStrokeAlpha() * 255); -+ const CPDF_GeneralState& general_state = page_obj->general_state(); -+ const float float_alpha = use_stroke_color -+ ? general_state.GetStrokeAlpha() -+ : general_state.GetFillAlpha(); -+ const int alpha = static_cast(float_alpha * 255); - if (!result_bitmap->CompositeMask( - /*dest_left=*/0, /*dest_top=*/0, rect.Width(), rect.Height(), -- cell_bitmap, AlphaAndColorRefToArgb(stroke_alpha, stroke_colorref), -+ cell_bitmap, AlphaAndColorRefToArgb(alpha, colorref), - /*src_left=*/0, /*src_top=*/0, BlendMode::kNormal)) { - return nullptr; - } -@@ -255,6 +262,36 @@ FPDF_BITMAP RenderTilingPatternToBitmap(CPDF_Pattern* pattern, - return FPDFBitmapFromCFXDIBitmap(result_bitmap.Leak()); - } - -+FPDF_BITMAP GetRenderedPattern(FPDF_DOCUMENT document, -+ FPDF_PAGEOBJECT page_object, -+ bool use_stroke_color) { -+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document); -+ if (!doc) { -+ return nullptr; -+ } -+ -+ CPDF_PageObject* object = CPDFPageObjectFromFPDFPageObject(page_object); -+ if (!object) { -+ return nullptr; -+ } -+ -+ const CPDF_ColorState& color_state = object->color_state(); -+ const CPDF_Color* color = use_stroke_color -+ ? color_state.GetStrokeColor() -+ : color_state.GetFillColor(); -+ if (!color || !color->IsPattern()) { -+ return nullptr; -+ } -+ -+ RetainPtr pattern = color->GetPattern(); -+ if (!pattern) { -+ return nullptr; -+ } -+ -+ return RenderTilingPatternToBitmap(pattern.Get(), doc, object, -+ use_stroke_color); -+} -+ - } // namespace - - FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument() { -@@ -1261,27 +1298,13 @@ FPDFPageObj_SetDashArray(FPDF_PAGEOBJECT page_object, - FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV - FPDFPageObj_GetRenderedStrokePattern(FPDF_DOCUMENT document, - FPDF_PAGEOBJECT page_object) { -- CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document); -- if (!doc) { -- return nullptr; -- } -- -- CPDF_PageObject* object = CPDFPageObjectFromFPDFPageObject(page_object); -- if (!object) { -- return nullptr; -- } -- -- const CPDF_Color* stroke = object->color_state().GetStrokeColor(); -- if (!stroke || !stroke->IsPattern()) { -- return nullptr; -- } -- -- RetainPtr pattern = stroke->GetPattern(); -- if (!pattern) { -- return nullptr; -- } -+ return GetRenderedPattern(document, page_object, /*use_stroke_color=*/true); -+} - -- return RenderTilingPatternToBitmap(pattern.Get(), doc, object); -+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV -+FPDFPageObj_GetRenderedFillPattern(FPDF_DOCUMENT document, -+ FPDF_PAGEOBJECT page_object) { -+ return GetRenderedPattern(document, page_object, /*use_stroke_color=*/false); - } - - FPDF_EXPORT int FPDF_CALLCONV -diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h -index c7fca05a1..77fa19c81 100644 ---- a/public/fpdf_edit.h -+++ b/public/fpdf_edit.h -@@ -1206,6 +1206,22 @@ FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV - FPDFPageObj_GetRenderedStrokePattern(FPDF_DOCUMENT document, - FPDF_PAGEOBJECT page_object); - -+// Experimental API. -+// Get a bitmap rasterization of the fill pattern of |page_object|. -+// To render correctly, the caller must provide the |document| associated with -+// |page_object|. The returned bitmap will be owned by the caller, and -+// FPDFBitmap_Destroy() must be called on the returned bitmap when it is no -+// longer needed. -+// -+// document - handle to the document containing |page_object|. -+// page_object - handle to a page object. -+// -+// Returns the bitmap, or NULL if the fill is not a tiling pattern or on -+// failure. -+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV -+FPDFPageObj_GetRenderedFillPattern(FPDF_DOCUMENT document, -+ FPDF_PAGEOBJECT page_object); -+ - // Get number of segments inside |path|. - // - // path - handle to a path. diff --git a/external/pdfium/extractpatterns-stroke.patch.1 b/external/pdfium/extractpatterns-stroke.patch.1 deleted file mode 100644 index c8a8146e1f83..000000000000 --- a/external/pdfium/extractpatterns-stroke.patch.1 +++ /dev/null @@ -1,262 +0,0 @@ -From 7bf42f401237d9096d44f7508beca8690031a98d Mon Sep 17 00:00:00 2001 -Date: Tue, 8 Sep 2026 16:54:21 -0700 -Subject: [PATCH] Add FPDFPageObj_GetRenderedStrokePattern() API - -This allows getting the rendered bitmap of a stroke pattern of a page -object. - -Change-Id: I4603be175bfe8721d4e11500afcc2be8c2c9f760 -Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/154910 -Reviewed-by: Lei Zhang -Reviewed-by: Tom Sepez -Commit-Queue: Lei Zhang ---- - core/fpdfapi/render/cpdf_rendertiling.cpp | 21 +++-- - core/fpdfapi/render/cpdf_rendertiling.h | 14 +++ - fpdfsdk/fpdf_edit_embeddertest.cpp | 64 +++++++++++++ - fpdfsdk/fpdf_editpage.cpp | 88 ++++++++++++++++++ - fpdfsdk/fpdf_view_c_api_test.c | 1 + - public/fpdf_edit.h | 16 ++++ - .../embedder_tests/pattern_stroke.png | Bin 0 -> 86 bytes - .../pattern_stroke_uncolored.png | Bin 0 -> 86 bytes - testing/resources/pattern_stroke.in | 59 ++++++++++++ - testing/resources/pattern_stroke.pdf | 71 ++++++++++++++ - testing/resources/pattern_stroke_uncolored.in | 61 ++++++++++++ - .../resources/pattern_stroke_uncolored.pdf | 73 +++++++++++++++ - 12 files changed, 458 insertions(+), 10 deletions(-) - create mode 100644 testing/resources/embedder_tests/pattern_stroke.png - create mode 100644 testing/resources/embedder_tests/pattern_stroke_uncolored.png - create mode 100644 testing/resources/pattern_stroke.in - create mode 100644 testing/resources/pattern_stroke.pdf - create mode 100644 testing/resources/pattern_stroke_uncolored.in - create mode 100644 testing/resources/pattern_stroke_uncolored.pdf - -diff --git a/core/fpdfapi/render/cpdf_rendertiling.cpp b/core/fpdfapi/render/cpdf_rendertiling.cpp -index f407f2403..77027354b 100644 ---- a/core/fpdfapi/render/cpdf_rendertiling.cpp -+++ b/core/fpdfapi/render/cpdf_rendertiling.cpp -@@ -26,7 +26,17 @@ - - namespace { - --RetainPtr DrawPatternBitmap( -+std::optional CheckedFloatToInt(float value) { -+ if (!pdfium::IsValueInRangeForNumericType(value)) { -+ return std::nullopt; -+ } -+ return static_cast(value); -+} -+ -+} // namespace -+ -+// static -+RetainPtr CPDF_RenderTiling::DrawPatternBitmap( - CPDF_Document* doc, - CPDF_PageImageCache* pCache, - CPDF_TilingPattern* pPattern, -@@ -72,15 +82,6 @@ RetainPtr DrawPatternBitmap( - return pBitmap; - } - --std::optional CheckedFloatToInt(float value) { -- if (!pdfium::IsValueInRangeForNumericType(value)) { -- return std::nullopt; -- } -- return static_cast(value); --} -- --} // namespace -- - // static - RetainPtr CPDF_RenderTiling::Draw( - CPDF_RenderStatus* pRenderStatus, -diff --git a/core/fpdfapi/render/cpdf_rendertiling.h b/core/fpdfapi/render/cpdf_rendertiling.h -index 34fb56bf4..2a124461c 100644 ---- a/core/fpdfapi/render/cpdf_rendertiling.h -+++ b/core/fpdfapi/render/cpdf_rendertiling.h -@@ -7,11 +7,14 @@ - #ifndef CORE_FPDFAPI_RENDER_CPDF_RENDERTILING_H_ - #define CORE_FPDFAPI_RENDER_CPDF_RENDERTILING_H_ - -+#include "core/fpdfapi/render/cpdf_renderoptions.h" - #include "core/fxcrt/retain_ptr.h" - - class CFX_DIBitmap; - class CFX_Matrix; -+class CPDF_Document; - class CPDF_Form; -+class CPDF_PageImageCache; - class CPDF_PageObject; - class CPDF_RenderStatus; - class CPDF_TilingPattern; -@@ -27,6 +30,17 @@ class CPDF_RenderTiling { - const FX_RECT& clip_box, - bool bStroke); - -+ // Renders a single cell of pPattern into a width x height bitmap. -+ static RetainPtr DrawPatternBitmap( -+ CPDF_Document* doc, -+ CPDF_PageImageCache* pCache, -+ CPDF_TilingPattern* pPattern, -+ CPDF_Form* pPatternForm, -+ const CFX_Matrix& mtObject2Device, -+ int width, -+ int height, -+ const CPDF_RenderOptions::Options& draw_options); -+ - CPDF_RenderTiling() = delete; - CPDF_RenderTiling(const CPDF_RenderTiling&) = delete; - CPDF_RenderTiling& operator=(const CPDF_RenderTiling&) = delete; -diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp -index 758aae859..9b9474ed7 100644 ---- a/fpdfsdk/fpdf_editpage.cpp -+++ b/fpdfsdk/fpdf_editpage.cpp -@@ -25,12 +25,15 @@ - #include "core/fpdfapi/page/cpdf_pathobject.h" - #include "core/fpdfapi/page/cpdf_shadingobject.h" - #include "core/fpdfapi/page/cpdf_textobject.h" -+#include "core/fpdfapi/page/cpdf_tilingpattern.h" - #include "core/fpdfapi/parser/cpdf_array.h" - #include "core/fpdfapi/parser/cpdf_dictionary.h" - #include "core/fpdfapi/parser/cpdf_document.h" - #include "core/fpdfapi/parser/cpdf_number.h" - #include "core/fpdfapi/parser/cpdf_string.h" - #include "core/fpdfapi/render/cpdf_docrenderdata.h" -+#include "core/fpdfapi/render/cpdf_renderoptions.h" -+#include "core/fpdfapi/render/cpdf_rendertiling.h" - #include "core/fpdfdoc/cpdf_annot.h" - #include "core/fpdfdoc/cpdf_annotlist.h" - #include "core/fxcrt/compiler_specific.h" -@@ -42,6 +45,7 @@ - #include "core/fxcrt/span_util.h" - #include "core/fxcrt/stl_util.h" - #include "core/fxcrt/unowned_ptr.h" -+#include "core/fxge/dib/cfx_dibitmap.h" - #include "fpdfsdk/cpdfsdk_helpers.h" - #include "public/fpdf_formfill.h" - -@@ -193,6 +197,64 @@ ByteString FormatPDFDate(time_t current_time, const tm& local_time) { - return date; - } - -+FPDF_BITMAP RenderTilingPatternToBitmap(CPDF_Pattern* pattern, -+ CPDF_Document* doc, -+ CPDF_PageObject* page_obj) { -+ CPDF_TilingPattern* tiling_pattern = pattern->AsTilingPattern(); -+ if (!tiling_pattern) { -+ return nullptr; -+ } -+ const std::unique_ptr pattern_form = -+ tiling_pattern->Load(page_obj); -+ if (!pattern_form) { -+ return nullptr; -+ } -+ const FX_RECT rect = tiling_pattern->bbox().GetOuterRect(); -+ if (rect.IsEmpty() || !rect.Valid()) { -+ return nullptr; -+ } -+ -+ RetainPtr cell_bitmap = CPDF_RenderTiling::DrawPatternBitmap( -+ doc, /*pCache=*/nullptr, tiling_pattern, pattern_form.get(), CFX_Matrix(), -+ rect.Width(), rect.Height(), CPDF_RenderOptions::Options()); -+ if (!cell_bitmap) { -+ return nullptr; -+ } -+ -+ if (tiling_pattern->colored()) { -+ ValidateBitmapPremultiplyState(cell_bitmap); -+ -+ // Caller takes ownership. -+ return FPDFBitmapFromCFXDIBitmap(cell_bitmap.Leak()); -+ } -+ -+ // An uncolored pattern gets its color from the stroke color operands. -+ const FX_COLORREF stroke_colorref = -+ page_obj->color_state().GetStrokeColorRef(); -+ if (stroke_colorref == 0xFFFFFFFF) { -+ return nullptr; -+ } -+ -+ auto result_bitmap = pdfium::MakeRetain(); -+ if (!result_bitmap->Create(rect.Width(), rect.Height(), -+ FXDIB_Format::kBgra)) { -+ return nullptr; -+ } -+ const int stroke_alpha = -+ static_cast(page_obj->general_state().GetStrokeAlpha() * 255); -+ if (!result_bitmap->CompositeMask( -+ /*dest_left=*/0, /*dest_top=*/0, rect.Width(), rect.Height(), -+ cell_bitmap, AlphaAndColorRefToArgb(stroke_alpha, stroke_colorref), -+ /*src_left=*/0, /*src_top=*/0, BlendMode::kNormal)) { -+ return nullptr; -+ } -+ -+ ValidateBitmapPremultiplyState(result_bitmap); -+ -+ // Caller takes ownership. -+ return FPDFBitmapFromCFXDIBitmap(result_bitmap.Leak()); -+} -+ - } // namespace - - FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument() { -@@ -1196,6 +1258,32 @@ FPDFPageObj_SetDashArray(FPDF_PAGEOBJECT page_object, - return true; - } - -+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV -+FPDFPageObj_GetRenderedStrokePattern(FPDF_DOCUMENT document, -+ FPDF_PAGEOBJECT page_object) { -+ CPDF_Document* doc = CPDFDocumentFromFPDFDocument(document); -+ if (!doc) { -+ return nullptr; -+ } -+ -+ CPDF_PageObject* object = CPDFPageObjectFromFPDFPageObject(page_object); -+ if (!object) { -+ return nullptr; -+ } -+ -+ const CPDF_Color* stroke = object->color_state().GetStrokeColor(); -+ if (!stroke || !stroke->IsPattern()) { -+ return nullptr; -+ } -+ -+ RetainPtr pattern = stroke->GetPattern(); -+ if (!pattern) { -+ return nullptr; -+ } -+ -+ return RenderTilingPatternToBitmap(pattern.Get(), doc, object); -+} -+ - FPDF_EXPORT int FPDF_CALLCONV - FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object) { - const auto* pObjectList = CPDFPageObjHolderFromFPDFFormObject(form_object); -diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h -index 8fac863f6..34be3867d 100644 ---- a/public/fpdf_edit.h -+++ b/public/fpdf_edit.h -@@ -1190,6 +1190,22 @@ FPDFPageObj_SetDashArray(FPDF_PAGEOBJECT page_object, - size_t dash_count, - float phase); - -+// Experimental API. -+// Get a bitmap rasterization of the stroke pattern of |page_object|. -+// To render correctly, the caller must provide the |document| associated with -+// |page_object|. The returned bitmap will be owned by the caller, and -+// FPDFBitmap_Destroy() must be called on the returned bitmap when it is no -+// longer needed. -+// -+// document - handle to the document containing |page_object|. -+// page_object - handle to a page object. -+// -+// Returns the bitmap, or NULL if the stroke is not a tiling pattern or on -+// failure. -+FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV -+FPDFPageObj_GetRenderedStrokePattern(FPDF_DOCUMENT document, -+ FPDF_PAGEOBJECT page_object); -+ - // Get number of segments inside |path|. - // - // path - handle to a path. diff --git a/external/pdfium/fix-windows-build.patch.1 b/external/pdfium/fix-windows-build.patch.1 deleted file mode 100644 index abc5a72ee453..000000000000 --- a/external/pdfium/fix-windows-build.patch.1 +++ /dev/null @@ -1,44 +0,0 @@ -From 3abda657c073f89dc6b39bbad8f7dfe2fbf17fd4 Mon Sep 17 00:00:00 2001 -Date: Mon, 10 Aug 2026 11:59:46 -0700 -Subject: [PATCH] fxge: fix missing windows include in cfx_renderdevice.h - -This resulted in a build failure here: -In file included from .../pdfium/core/fxge/cfx_drawutils.cpp:13: -.../core/fxge/cfx_renderdevice.h(74,7): error: unknown type name 'HDC' - 74 | HDC hdc, - | ^ - -It seems this started after commit -fc790866bf26d977b2ea3a0c3938bb52895309ea (Consolidate CFX_RenderDevice -and remove CPDF_WindowsRenderDevice, 2026-06-29): the Windows-DC code -was moved from cpdf_windowsrenderdevice.h to cfx_renderdevice.h but the -windows.h include wasn't moved. - -Given that it looks like every other pdfium header that uses HDC -includes directly (core/fxge/win32/cpsoutput.h etc.), just -add the missing include here as well, conditionally. - -Change-Id: Ie9920b2031148f7781862502905d999ce045b014 -Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/154690 -Reviewed-by: Tom Sepez -Reviewed-by: Lei Zhang -Commit-Queue: Lei Zhang ---- - core/fxge/cfx_renderdevice.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h -index 8f427ce01..4114b9884 100644 ---- a/core/fxge/cfx_renderdevice.h -+++ b/core/fxge/cfx_renderdevice.h -@@ -19,6 +19,10 @@ - #include "core/fxge/dib/fx_dib.h" - #include "core/fxge/renderdevicedriver_iface.h" - -+#if BUILDFLAG(IS_WIN) -+#include -+#endif -+ - class CFX_DIBBase; - class CFX_DIBitmap; - class CFX_Font; diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx b/external/pdfium/inc/pch/precompiled_pdfium.hxx index 9b4a2399f282..6816e62fd060 100644 --- a/external/pdfium/inc/pch/precompiled_pdfium.hxx +++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2026-08-03 16:22:37 using: + Generated on 2026-09-24 17:32:45 using: ./bin/update_pch external/pdfium pdfium --cutoff=1 --exclude:system --include:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -32,9 +32,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -94,7 +91,6 @@ #include #include #include -#include #include #include #include @@ -245,6 +241,7 @@ #include #include #include +#include #include #include #include @@ -263,6 +260,7 @@ #include #include #include +#include #include #include #include @@ -284,6 +282,7 @@ #include #include #include +#include #include #include #include @@ -335,6 +334,8 @@ #include #include #include +#include +#include #include #include #include @@ -366,6 +367,7 @@ #include #include #include +#include #include #include #include @@ -490,7 +492,6 @@ #include #include #include -#include #include #include #include diff --git a/external/pdfium/system-abseil.diff b/external/pdfium/system-abseil.diff index 7306b3dace03..d87a55f810ce 100644 --- a/external/pdfium/system-abseil.diff +++ b/external/pdfium/system-abseil.diff @@ -1,22 +1,22 @@ ---- core/fpdfapi/page/cpdf_sampledfunc.cpp 2023-12-15 23:27:10.955659091 +0100 -+++ core/fpdfapi/page/cpdf_sampledfunc.cpp 2023-12-15 23:27:43.420136476 +0100 -@@ -17,8 +17,11 @@ - #include "core/fxcrt/compiler_specific.h" +diff -urN before/core/fpdfapi/page/cpdf_sampledfunc.cpp after/core/fpdfapi/page/cpdf_sampledfunc.cpp +--- core/fpdfapi/page/cpdf_sampledfunc.cpp 2026-09-24 15:11:27.153556875 +0000 ++++ core/fpdfapi/page/cpdf_sampledfunc.cpp 2026-09-24 15:11:41.206965278 +0000 +@@ -18,7 +18,11 @@ + #include "core/fxcrt/fx_ceil_div.h" #include "core/fxcrt/fx_memory_wrappers.h" #include "core/fxcrt/fx_safe_types.h" +#ifdef USE_SYSTEM_ABSEIL +#include +#else #include "third_party/abseil-cpp/absl/container/inlined_vector.h" -- +#endif + namespace { - // See PDF Reference 1.7, page 170, table 3.36. -diff -urN pdfium-old/core/fpdfdoc/cpdf_nametree.cpp pdfium/core/fpdfdoc/cpdf_nametree.cpp ---- core/fpdfdoc/cpdf_nametree.cpp 2025-10-13 21:48:18.759905514 +0200 -+++ core/fpdfdoc/cpdf_nametree.cpp 2025-10-13 22:00:01.912909396 +0200 -@@ -18,7 +18,11 @@ +diff -urN before/core/fpdfdoc/cpdf_nametree.cpp after/core/fpdfdoc/cpdf_nametree.cpp +--- core/fpdfdoc/cpdf_nametree.cpp 2026-09-24 15:11:27.137556410 +0000 ++++ core/fpdfdoc/cpdf_nametree.cpp 2026-09-24 15:11:41.169964202 +0000 +@@ -19,7 +19,11 @@ #include "core/fxcrt/check.h" #include "core/fxcrt/ptr_util.h" #include "core/fxcrt/stl_util.h" @@ -28,3 +28,33 @@ diff -urN pdfium-old/core/fpdfdoc/cpdf_nametree.cpp pdfium/core/fpdfdoc/cpdf_nam namespace { +diff -urN before/core/fpdfdoc/cpvt_variabletext.cpp after/core/fpdfdoc/cpvt_variabletext.cpp +--- core/fpdfdoc/cpvt_variabletext.cpp 2026-09-24 15:11:27.145556642 +0000 ++++ core/fpdfdoc/cpvt_variabletext.cpp 2026-09-24 15:11:41.189964784 +0000 +@@ -21,7 +21,11 @@ + #include "core/fxcrt/fx_safe_types.h" + #include "core/fxcrt/span.h" + #include "core/fxcrt/stl_util.h" ++#ifdef USE_SYSTEM_ABSEIL ++#include ++#else + #include "third_party/abseil-cpp/absl/cleanup/cleanup.h" ++#endif + + namespace { + +diff -urN before/core/fxge/cfx_face.cpp after/core/fxge/cfx_face.cpp +--- core/fxge/cfx_face.cpp 2026-09-24 15:11:27.161557107 +0000 ++++ core/fxge/cfx_face.cpp 2026-09-24 15:11:41.224965801 +0000 +@@ -46,7 +46,11 @@ + + #if defined(PDF_ENABLE_FONTATIONS) + #include "core/fxge/skrifa/src/main.rs.h" ++#ifdef USE_SYSTEM_ABSEIL ++#include ++#else + #include "third_party/abseil-cpp/absl/cleanup/cleanup.h" ++#endif + #include "third_party/rust/cxx/v1/cxx.h" + #endif + diff --git a/external/pdfium/system-dragonbox.diff b/external/pdfium/system-dragonbox.diff new file mode 100644 index 000000000000..2e8562976d80 --- /dev/null +++ b/external/pdfium/system-dragonbox.diff @@ -0,0 +1,15 @@ +diff -urN db_before/core/fxcrt/stream_write_utils.cpp db_after/core/fxcrt/stream_write_utils.cpp +--- core/fxcrt/stream_write_utils.cpp 2026-09-24 15:17:47.881621130 +0000 ++++ core/fxcrt/stream_write_utils.cpp 2026-09-24 15:17:47.911622002 +0000 +@@ -10,7 +10,11 @@ + #include + + #include "core/fxcrt/span.h" ++#ifdef USE_SYSTEM_DRAGONBOX ++#include ++#else + #include "third_party/dragonbox/src/include/dragonbox/dragonbox.h" ++#endif + + namespace { + diff --git a/external/pdfium/system-icu.patch.1 b/external/pdfium/system-icu.patch.1 deleted file mode 100644 index 13d3ea858632..000000000000 --- a/external/pdfium/system-icu.patch.1 +++ /dev/null @@ -1,33 +0,0 @@ -From 9b6f23989c5da39bff4ce36df96d62f9cabeebbf Mon Sep 17 00:00:00 2001 -Date: Fri, 7 Aug 2026 14:36:14 -0700 -Subject: [PATCH] fxcrt: fix building against system ICU in cfx_bidi_resolver - -This was the only location which forgot to check for this define, -core/fxcrt/fx_extension.h:18 already did the same. - -Change-Id: I6efdd8c5a3322b146f9ccabcabd2ac2506912d85 -Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/154490 -Commit-Queue: Andy Phan -Reviewed-by: Lei Zhang -Reviewed-by: Andy Phan ---- - core/fxcrt/cfx_bidi_resolver.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/core/fxcrt/cfx_bidi_resolver.cpp b/core/fxcrt/cfx_bidi_resolver.cpp -index 50e302e35..efa585f38 100644 ---- a/core/fxcrt/cfx_bidi_resolver.cpp -+++ b/core/fxcrt/cfx_bidi_resolver.cpp -@@ -10,7 +10,12 @@ - #include "core/fxcrt/check_op.h" - #include "core/fxcrt/fx_safe_types.h" - #include "core/fxcrt/ptr_util.h" -+ -+#if defined(USE_SYSTEM_ICUUC) -+#include -+#else - #include "third_party/icu/source/common/unicode/ubidi.h" -+#endif - - void CFX_BidiResolver::UBiDiDeleter::operator()(UBiDi* bidi) const { - ubidi_close(bidi); diff --git a/external/python3/ubsan.patch.0 b/external/python3/ubsan.patch.0 index 0ae1e4abf281..07fc51205024 100644 --- a/external/python3/ubsan.patch.0 +++ b/external/python3/ubsan.patch.0 @@ -61,7 +61,7 @@ PyObject *key, *value; --- Parser/lexer/buffer.c +++ Parser/lexer/buffer.c -@@ -27,8 +27,8 @@ +@@ -29,8 +29,8 @@ for (index = tok->tok_mode_stack_index; index >= 0; --index) { mode = &(tok->tok_mode_stack[index]); @@ -69,6 +69,6 @@ - mode->f_string_multi_line_start = mode->f_string_multi_line_start_offset < 0 ? NULL : tok->buf + mode->f_string_multi_line_start_offset; + mode->f_string_start = mode->f_string_start_offset < 0 ? NULL : (char *) (((intptr_t) tok->buf) + mode->f_string_start_offset); + mode->f_string_multi_line_start = mode->f_string_multi_line_start_offset < 0 ? NULL : (char *) (((intptr_t) tok->buf) + mode->f_string_multi_line_start_offset); + mode->last_expr_start = mode->last_expr_start_offset < 0 + ? NULL : tok->buf + mode->last_expr_start_offset; } - } - diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js index fa42b89b2f8e..c94b07ecce48 100644 --- a/filter/source/svg/presentation_engine.js +++ b/filter/source/svg/presentation_engine.js @@ -16217,7 +16217,17 @@ HyperlinkElement.prototype.handleClick = function( ) var aWindowObject = document.defaultView; if( aWindowObject ) { - aWindowObject.open( this.sURL, this.sId ); + var sProtocol = ''; + try + { + sProtocol = new URL( this.sURL, document.baseURI ).protocol; + } + catch( e ) + { + log( 'error: HyperlinkElement.handleClick: invalid url.' ); + } + if( sProtocol === 'http:' || sProtocol === 'https:' || sProtocol === 'mailto:' ) + aWindowObject.open( this.sURL, this.sId ); } else { diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 0c7a631127ad..9d9a6dccbd58 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -1309,7 +1310,15 @@ bool SVGTextWriter::nextTextPortion() #if OSL_DEBUG_LEVEL > 0 sInfo += "url: " + mrExport.GetRelativeReference( sURL ); #endif - msUrl = mrExport.GetRelativeReference( sURL ); + // A link to a place in the presentation starts with '#'. + INetURLObject aINetURLObject(sURL); + if (sURL.startsWith("#") + || (!aINetURLObject.HasError() + && !aINetURLObject.IsExoticProtocol() + && aINetURLObject.GetProtocol() != INetProtocol::Javascript)) + msUrl = mrExport.GetRelativeReference( sURL ); + else + msUrl.clear(); if( !msUrl.isEmpty() ) { implRegisterInterface( xPortionTextRange ); diff --git a/formula/CppunitTest_formula_ooxml.mk b/formula/CppunitTest_formula_ooxml.mk index 5c082b9a47e5..3a479683b1ef 100644 --- a/formula/CppunitTest_formula_ooxml.mk +++ b/formula/CppunitTest_formula_ooxml.mk @@ -1,8 +1,6 @@ # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*- # -# Copyright the LibreOffice contributors. -# -# SPDX-License-Identifier: MPL-2.0 +# This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/formula/inc/OOXMLRewriter.hxx b/formula/inc/OOXMLRewriter.hxx index bd82e97f7d8b..f9a3d2c66119 100644 --- a/formula/inc/OOXMLRewriter.hxx +++ b/formula/inc/OOXMLRewriter.hxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/formula/qa/unit/OOXMLRewriterTest.cxx b/formula/qa/unit/OOXMLRewriterTest.cxx index 47af68931752..c30017938192 100644 --- a/formula/qa/unit/OOXMLRewriterTest.cxx +++ b/formula/qa/unit/OOXMLRewriterTest.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 5ab0b2304429..e249924768e7 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -2535,7 +2535,7 @@ void FormulaCompiler::CallLine() pArgArray[nArgCount - 1] = mpCode - 1; // Add rest of the arguments } if (bDoIICompute) - HandleIIOpCode(&*pOpToken, pArgArray, + HandleIIOpCode(pOpToken.get(), pArgArray, std::min(nArgCount, static_cast(FORMULA_MAXPARAMSII))); } bool bDone = false; @@ -2554,7 +2554,7 @@ void FormulaCompiler::CallLine() nArgCount++; // Jumps are just normal functions for the FunctionAutoPilot tree view if (!mbJumpCommandReorder && pOpToken->GetType() == svJump) - pOpToken = new FormulaFAPToken( pOpToken->GetOpCode(), nArgCount, &*pOpToken ); + pOpToken = new FormulaFAPToken( pOpToken->GetOpCode(), nArgCount, pOpToken.get() ); else { // instead of using ocCall, built-in functions use their own OpCodes, if they are called directly diff --git a/formula/source/core/api/OOXMLRewriter.cxx b/formula/source/core/api/OOXMLRewriter.cxx index db448b8a8331..b181ef6824df 100644 --- a/formula/source/core/api/OOXMLRewriter.cxx +++ b/formula/source/core/api/OOXMLRewriter.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/helpcontent2 b/helpcontent2 index d221eef92a08..b2429f8c0fff 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit d221eef92a08fab4fd1bfc58a5963caad94107a9 +Subproject commit b2429f8c0fffdef7bd37b8c750bfce3909838701 diff --git a/include/basic/basicmanagerrepository.hxx b/include/basic/basicmanagerrepository.hxx index 13620e509ba3..2d78a291cba3 100644 --- a/include/basic/basicmanagerrepository.hxx +++ b/include/basic/basicmanagerrepository.hxx @@ -94,6 +94,13 @@ namespace basic const css::uno::Reference< css::frame::XModel >& _rxDocumentModel ); + /** returns the BasicManager of the given document model, or if it has + not been created yet + */ + static BasicManager* getExistingDocumentBasicManager( + const css::uno::Reference< css::frame::XModel >& _rxDocumentModel + ); + /** returns the application-wide BasicManager @attention diff --git a/include/comphelper/propcontainerimplhelper.hxx b/include/comphelper/propcontainerimplhelper.hxx index f654e49b4418..1cea6e664122 100644 --- a/include/comphelper/propcontainerimplhelper.hxx +++ b/include/comphelper/propcontainerimplhelper.hxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/include/comphelper/propimplhelper.hxx b/include/comphelper/propimplhelper.hxx index c1deba69eef2..fb882578d20f 100644 --- a/include/comphelper/propimplhelper.hxx +++ b/include/comphelper/propimplhelper.hxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/include/comphelper/unique_unlock.hxx b/include/comphelper/unique_unlock.hxx index c8cb06728997..51c25ca64258 100644 --- a/include/comphelper/unique_unlock.hxx +++ b/include/comphelper/unique_unlock.hxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/include/docmodel/theme/FormatScheme.hxx b/include/docmodel/theme/FormatScheme.hxx index eb1eea3fbdca..4c72311de929 100644 --- a/include/docmodel/theme/FormatScheme.hxx +++ b/include/docmodel/theme/FormatScheme.hxx @@ -84,6 +84,8 @@ struct DOCMODEL_DLLPUBLIC RelativeRectangle sal_Int32 mnTop = 0; sal_Int32 mnRight = 0; sal_Int32 mnBottom = 0; + + bool isZero() const { return mnLeft == 0 && mnTop == 0 && mnRight == 0 && mnBottom == 0; } }; class DOCMODEL_DLLPUBLIC GradientFill : public Fill diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 5b48537e18b0..938a5478a7f1 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -113,6 +113,8 @@ class LinkParamNone; class DrawPortionInfo; class DrawBulletInfo; class StripPortionsHelper; +enum class SdrCompatibilityFlag; +class Outliner; /** values for: SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ); @@ -196,6 +198,7 @@ private: SAL_DLLPRIVATE void SetInSelectionMode(bool b); public: + EditEngine(Outliner* pEngOwner, SfxItemPool* pItemPool); EditEngine(SfxItemPool* pItemPool); virtual ~EditEngine(); @@ -626,6 +629,16 @@ public: void SetLOKSpecialPaperSize(const Size& rSize); const Size& GetLOKSpecialPaperSize() const; + + // Only useful when this is Outliner capable. + sal_Int16 GetNumberingDepth( sal_Int32 nPara ) const; + + // Only useful when this is Outliner capable. + /// @returns state of the SdrCompatibilityFlag + std::optional GetCompatFlag(SdrCompatibilityFlag eFlag) const; + + // Only useful when this is Outliner capable. + Outliner* GetOwner(); }; #endif // INCLUDED_EDITENG_EDITENG_HXX diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx index 7d40f5a9ad09..c341020cd425 100644 --- a/include/editeng/editobj.hxx +++ b/include/editeng/editobj.hxx @@ -40,7 +40,7 @@ class SvxFieldData; enum class OutlinerMode; struct EECharAttrib; typedef struct _xmlTextWriter* xmlTextWriterPtr; -class EditEngineParagraph; +class EditTextObjectParagraph; class XParaPortionList; namespace editeng { @@ -55,10 +55,15 @@ class SharedStringPool; enum class TextRotation { NONE, TOPTOBOTTOM, BOTTOMTOTOP }; +/** + This object is used to copy document/text info in and out of EditEngine. + It is not used internally to editeng as storage mechanism, just a means + of extracting and inserting data. +*/ class EDITENG_DLLPUBLIC EditTextObject final { public: - typedef std::vector > EditEngineParagraphs; + typedef std::vector > EditTextObjectParagraphs; EditTextObject(SfxItemPool* pPool, MapUnit eDefaultMetric, bool bVertical, TextRotation eRotation, SvtScriptType eScriptType); @@ -153,9 +158,9 @@ public: // #i102062# bool isWrongListEqual(const EditTextObject& rCompare) const; - EditEngineParagraph* CreateAndInsertParagraph(); - EditEngineParagraphs& GetParagraphs() { return maParagraphs;} - const EditEngineParagraphs& GetParagraphs() const { return maParagraphs;} + EditTextObjectParagraph* CreateAndInsertParagraph(); + EditTextObjectParagraphs& GetParagraphs() { return maParagraphs;} + const EditTextObjectParagraphs& GetParagraphs() const { return maParagraphs;} bool HasMetric() const { return meMetric != MapUnit::LASTENUMDUMMY; } MapUnit GetMetric() const { return meMetric; } @@ -169,7 +174,7 @@ private: bool ImpChangeStyleSheets( std::u16string_view rOldName, SfxStyleFamily eOldFamily, const OUString& rNewName, SfxStyleFamily eNewFamily ); - EditEngineParagraphs maParagraphs; + EditTextObjectParagraphs maParagraphs; rtl::Reference mpPool; std::unique_ptr mpPortionInfo; OutlinerMode meUserType; diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index b9708d1ee83c..377d98858886 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -44,7 +44,7 @@ #include #include -class OutlinerEditEng; +class EditEngine; class Outliner; class EditView; class EditUndo; @@ -131,7 +131,7 @@ private: friend class ParagraphList; friend class OutlinerView; friend class OutlinerParaObject; - friend class OutlinerEditEng; + friend class EditEngine; friend class OutlinerUndoCheckPara; friend class OutlinerUndoChangeParaFlags; @@ -547,7 +547,7 @@ public: struct DepthChangeHdlParam { Outliner* pOutliner; Paragraph* pPara; ParaFlag nPrevFlags; }; private: friend class OutlinerView; - friend class OutlinerEditEng; + friend class EditEngine; friend class OutlinerParaObject; friend class OLUndoExpand; friend class OutlinerUndoChangeDepth; @@ -556,7 +556,7 @@ private: friend class TextChainingUtils; - std::unique_ptr pEditEngine; + std::unique_ptr pEditEngine; std::unique_ptr pParaList; ViewList aViewList; @@ -617,8 +617,6 @@ private: SAL_DLLPRIVATE void ImplCheckDepth( sal_Int16& rnDepth ) const; - SAL_DLLPRIVATE OutlinerEditEng& getOutlinerEditEng() { return *pEditEngine; } - protected: SAL_DLLPRIVATE void ParagraphInserted( sal_Int32 nParagraph ); SAL_DLLPRIVATE void ParagraphDeleted( sal_Int32 nParagraph ); @@ -630,7 +628,7 @@ protected: SAL_DLLPRIVATE void StripBullet( sal_Int32 nPara, const Point& rStartPos, OutputDevice& rOutDev, StripPortionsHelper& rStripPortionsHelper); - // used by OutlinerEditEng. Allows Outliner objects to provide + // used by EditEngine. Allows Outliner objects to provide // bullet access to the EditEngine. SAL_DLLPRIVATE const SvxNumberFormat* GetNumberFormat( sal_Int32 nPara ) const; @@ -895,7 +893,8 @@ public: bool ShouldCreateBigTextObject() const; - const EditEngine& GetEditEngine() const; + const EditEngine& GetEditEngine() const { return *pEditEngine; } + EditEngine& GetEditEngine() { return *pEditEngine; } // this is needed for StarOffice Api SAL_DLLPRIVATE void SetLevelDependentStyleSheet( sal_Int32 nPara ); diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx index 0d4fc38303de..6547aa1ccec5 100644 --- a/include/editeng/overflowingtxt.hxx +++ b/include/editeng/overflowingtxt.hxx @@ -41,7 +41,7 @@ class Outliner; class TextChainingUtils { public: - static css::uno::Reference< css::datatransfer::XTransferable> CreateTransferableFromText(Outliner const *); + static css::uno::Reference< css::datatransfer::XTransferable> CreateTransferableFromText(Outliner *); static std::optional JuxtaposeParaObject( css::uno::Reference< css::datatransfer::XTransferable > const & xOverflowingContent, @@ -116,7 +116,7 @@ private: class EDITENG_DLLPUBLIC UFlowChainedText { public: - UFlowChainedText(Outliner const *, bool); + UFlowChainedText(Outliner *, bool); std::optional CreateMergedUnderflowParaObject(Outliner *, OutlinerParaObject const *); private: diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index c0903b2f8a6d..1ced28728fef 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -488,6 +488,9 @@ public: void WriteText( const css::uno::Reference< css::uno::XInterface >& rXIface, bool bBodyPr, bool bText = true, sal_Int32 nXmlNamespace = 0, bool bWritePropertiesAsLstStyles = false); + /** Writes a paragraph with no text, carrying the properties text put in it would get. */ + void WriteTextlessParagraph(const css::uno::Reference& rXIface); + void WriteBodyProps( const css::uno::Reference< css::uno::XInterface >& rXIface, sal_Int32 nXmlNamespace, bool bIsFontworkShape, diff --git a/include/oox/mathml/imexport.hxx b/include/oox/mathml/imexport.hxx index c77689166d75..0e6cde052a83 100644 --- a/include/oox/mathml/imexport.hxx +++ b/include/oox/mathml/imexport.hxx @@ -36,6 +36,12 @@ class OOX_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") FormulaImExportBase public: virtual void readFormulaOoxml( oox::formulaimport::XmlStream& stream ) = 0; virtual Size getFormulaSize() const = 0; // Unit is mm100 + /** The font size in half points that the OOXML markup gave for the formula. It is 0 when + the markup carried no size, and the formula then has whatever size the text around it + has. */ + virtual sal_Int32 getFormulaFontSizeInHalfPoints() const = 0; + /** Draw the formula at the given size, in half points. */ + virtual void setFormulaFontSizeInHalfPoints( sal_Int32 nFontSize ) = 0; virtual void writeFormulaOoxml(::sax_fastparser::FSHelperPtr pSerializer, oox::core::OoxmlVersion version, diff --git a/include/oox/mathml/importutils.hxx b/include/oox/mathml/importutils.hxx index 39133528e98a..9993e4f01c2d 100644 --- a/include/oox/mathml/importutils.hxx +++ b/include/oox/mathml/importutils.hxx @@ -205,6 +205,14 @@ public: Handle the current (unexpected) tag. */ void handleUnexpectedTag(); + /** + Collects an attribute from every opening tag of the given type that sits inside an + element of the given enclosing type, anywhere in the stream and however deeply nested. + The position in the stream stays where it is. + @return the attribute values, in the order the tags carrying them appear + */ + std::vector tagAttributesWithin(int nEnclosingToken, int nTagToken, + int nAttributeToken) const; protected: Tag checkTag(int token, bool optional); diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index c4c2af98e45a..1418162ec6b6 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -438,6 +438,9 @@ public: */ bool AdjustMacroMode(); + /// whether macros from this document are already allowed to run, without asking + bool IsMacroExecutionAllowed() const; + static bool UnTrustedScript(const OUString& rScriptURL); /// Check if script URL whitelist exists, and if so, if current script url is part of it diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx index 3cf68d03a4d9..e90d109142fe 100644 --- a/include/svl/itemset.hxx +++ b/include/svl/itemset.hxx @@ -96,6 +96,7 @@ class SAL_WARN_UNUSED SVL_DLLPUBLIC SfxItemSet #ifdef DBG_UTIL sal_uInt16 m_nRegisteredSfxItemIter; + bool m_bDeleted; #endif WhichRangesContainer m_aWhichRanges; ///< array of Which Ranges @@ -126,6 +127,10 @@ public: SfxItemSet( SfxItemPool& rPool, sal_uInt16 nWhichStart, sal_uInt16 nWhichEnd ) : SfxItemSet(rPool, WhichRangesContainer(nWhichStart, nWhichEnd)) {} +#ifndef NDEBUG + bool isDeleted() const { return m_bDeleted; } +#endif + template static SfxItemSet makeFixedSfxItemSet(SfxItemPool& pool) { @@ -242,6 +247,7 @@ public: void MergeValue( const SfxPoolItem& rItem); SfxItemPool* GetPool() const { return m_pPool; } + SfxItemPool& getPool() const { assert(!isDeleted() && "Destructed instance used (!)"); return *m_pPool; } const WhichRangesContainer & GetRanges() const { return m_aWhichRanges; } void SetRanges( const WhichRangesContainer& ); void SetRanges( WhichRangesContainer&& ); diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx index 871285a4b6a3..be34b0b06b2b 100644 --- a/include/svl/poolitem.hxx +++ b/include/svl/poolitem.hxx @@ -507,7 +507,6 @@ enum class SfxItemType : sal_uInt16 SwUINumRuleItemType, SwWrtShellItemType, XColorItemType, - XFillAttrSetItemType, XFillBackgroundItemType, XFillBitmapItemType, XFillBmpPosItemType, @@ -540,7 +539,6 @@ enum class SfxItemType : sal_uInt16 XFormTextStartItemType, XFormTextStyleItemType, XGradientStepCountItemType, - XLineAttrSetItemType, XLineCapItemType, XLineColorItemType, XLineDashItemType, diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index 52495e1f4d68..a629d79a954d 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -209,8 +209,6 @@ inline Color sameDistColor( Color /*rMain*/, Color rDefault ) return rDefault; } -class ValueSet; - class SVT_DLLPUBLIC SvtLineListBox final : public WeldToolbarPopup { public: @@ -346,7 +344,7 @@ private: DECL_DLLPRIVATE_LINK(SettingsChangedHdl, VclSimpleEvent&, void); DECL_DLLPRIVATE_LINK(UpdateHdl, Timer*, void); - void LoadMRUEntries( const OUString& aFontMRUEntriesFile ); + static std::vector LoadMRUEntries(const OUString& aFontMRUEntriesFile); void SaveMRUEntries( const OUString& aFontMRUEntriesFile ) const; OutputDevice& CachePreview(size_t nIndex, Point* pTopLeft, diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx index 28f9fef099f7..9928b5e84ee0 100644 --- a/include/svtools/tabbar.hxx +++ b/include/svtools/tabbar.hxx @@ -367,8 +367,6 @@ private: DECL_DLLPRIVATE_LINK(ImplClickHdl, weld::Button&, void); DECL_DLLPRIVATE_LINK(ImplAddClickHandler, weld::Button&, void); DECL_DLLPRIVATE_LINK(ImplListClickHandler, weld::Button&, void); - DECL_DLLPRIVATE_LINK(MousePressHdl, const MouseEvent&, bool); - DECL_DLLPRIVATE_LINK(ContextMenuHdl, const CommandEvent&, void); ImplTabBarItem* seek( size_t i ); ImplTabBarItem* prev(); diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 9081fab3ae6a..4d209ea41fc1 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -74,8 +74,6 @@ WB_DOUBLEBORDER Items will be bordered twice. Additionally WB_ITEMBORDER effect. It is needed if there are items with a white background, since otherwise the 3D effect wouldn't be recognizable. -WB_NAMEFIELD There is a namefield, where the name of an item will be - shown. WB_VSCROLL A scrollbar will be always shown. The visible number of lines have to be specified with SetLineCount() if this flag is set. @@ -164,7 +162,6 @@ to be set (before Show) with SetStyle(). #define WB_ITEMBORDER (WinBits(0x00010000)) #define WB_DOUBLEBORDER (WinBits(0x00020000)) -#define WB_NAMEFIELD (WinBits(0x00040000)) #define WB_FLATVALUESET (WinBits(0x02000000)) #define WB_NO_DIRECTSELECT (WinBits(0x04000000)) #define WB_MENUSTYLEVALUESET (WinBits(0x08000000)) @@ -182,7 +179,6 @@ private: tools::Rectangle maItemListRect; tools::Long mnItemWidth; tools::Long mnItemHeight; - tools::Long mnTextOffset; tools::Long mnVisLines; tools::Long mnLines; tools::Long mnUserItemWidth; @@ -216,16 +212,14 @@ private: friend class ValueSetAcc; SVT_DLLPRIVATE void ImplDeleteItems(); - SVT_DLLPRIVATE void ImplFormatItem(vcl::RenderContext const& rRenderContext, - ValueSetItem& rItem, tools::Rectangle aRect); - SVT_DLLPRIVATE void ImplDrawItemText(vcl::RenderContext& rRenderContext, const OUString& rStr); + SVT_DLLPRIVATE void ImplFormatItem(ValueSetItem& rItem, tools::Rectangle aRect); // nItemId is the item to draw selected, but if nothing is selected something else may be drawn as selected instead, the item to draw // selected is returned SVT_DLLPRIVATE ValueSetItem* ImplGetDrawSelectItem(sal_uInt16 nItemId, const bool bFocus, tools::Rectangle& rRect); - SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext, - const tools::Rectangle& rRect, const ValueSetItem* pItem, - const bool bFocus, const bool bDrawSel, - const bool bSelected, const bool bHover); + SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext, + const tools::Rectangle& rRect, const bool bFocus, + const bool bDrawSel, const bool bSelected, + const bool bHover); SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext); SVT_DLLPRIVATE void ImplHighlightItem(sal_uInt16 nItemId); SVT_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext); @@ -283,9 +277,9 @@ public: /// Insert @rImage item. void InsertItem(sal_uInt16 nItemId, const Image& rImage); - /// Insert @rImage item with @rStr as either a legend or tooltip depending on @bShowLegend. + /// Insert @rImage item with @rStr as tooltip. void InsertItem(sal_uInt16 nItemId, const Image& rImage, - const OUString& rStr, size_t nPos = VALUESET_APPEND, bool bShowLegend = false); + const OUString& rStr, size_t nPos = VALUESET_APPEND); /// Insert an @rColor item with @rStr tooltip. void InsertItem(sal_uInt16 nItemId, const Color& rColor, const OUString& rStr); @@ -336,12 +330,9 @@ public: return mbNoSelection; } - void SetItemImage( sal_uInt16 nItemId, const Image& rImage ); Image GetItemImage( sal_uInt16 nItemId ) const; void SetItemColor( sal_uInt16 nItemId, const Color& rColor ); Color GetItemColor( sal_uInt16 nItemId ) const; - void SetItemData( sal_uInt16 nItemId, void* pData ); - void* GetItemData( sal_uInt16 nItemId ) const; void SetItemText( sal_uInt16 nItemId, const OUString& rStr ); const OUString & GetItemText( sal_uInt16 nItemId ) const; void SetColor( const Color& rColor ); @@ -357,7 +348,7 @@ public: void SetExtraSpacing( sal_uInt16 nNewSpacing ); void SetMargin( sal_uInt16 nNewMargin ); - void Format(vcl::RenderContext const & rRenderContext); + void Format(); void SetFormat(); Size CalcWindowSizePixel(const Size& rItemSize, diff --git a/include/svx/ColorIconView.hxx b/include/svx/ColorIconView.hxx index 7e054e0f253f..a789a813527f 100644 --- a/include/svx/ColorIconView.hxx +++ b/include/svx/ColorIconView.hxx @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -54,6 +55,9 @@ public: void set_sensitive(bool bSensitive); + void set_size_request(int nWidth, int nHeight); + Size get_size_request() const; + void set_help_id(const OUString& rName); void setColorActivatedHdl(const Link& rLink) { m_aColorActivatedHdl = rLink; } diff --git a/include/svx/EnhancedCustomShapeGeometry.hxx b/include/svx/EnhancedCustomShapeGeometry.hxx index 06679eb18002..fe734f6d1863 100644 --- a/include/svx/EnhancedCustomShapeGeometry.hxx +++ b/include/svx/EnhancedCustomShapeGeometry.hxx @@ -73,10 +73,9 @@ struct SvxMSDffHandle struct mso_CustomShape { std::span pVertices; - sal_uInt16* pElements; - sal_uInt32 nElements; + std::span pElements; std::span pCalculation; - sal_Int32* pDefData; + std::span pDefData; std::span pTextRect; sal_Int32 nCoordWidth; sal_Int32 nCoordHeight; diff --git a/include/svx/annotation/AnnotationObject.hxx b/include/svx/annotation/AnnotationObject.hxx index 79732042465f..922c3a1d5b60 100644 --- a/include/svx/annotation/AnnotationObject.hxx +++ b/include/svx/annotation/AnnotationObject.hxx @@ -38,7 +38,7 @@ public: void setup(); - rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; + rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; SdrObjKind GetObjIdentifier() const override; OUString TakeObjNameSingul() const override; diff --git a/include/svx/cube3d.hxx b/include/svx/cube3d.hxx index 3c8323197f8e..96075956819e 100644 --- a/include/svx/cube3d.hxx +++ b/include/svx/cube3d.hxx @@ -54,10 +54,11 @@ class SAL_WARN_UNUSED E3dCubeObj final : public E3dCompoundObject void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); virtual std::unique_ptr CreateObjectSpecificViewContact() override; -private: // protected destructor - due to final, make private virtual ~E3dCubeObj() override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SVXCORE_DLLPUBLIC E3dCubeObj(SdrModel& rSdrModel, const E3dDefaultAttributes& rDefault, @@ -69,8 +70,6 @@ public: virtual SdrObjKind GetObjIdentifier() const override; virtual rtl::Reference DoConvertToPolyObj(bool bBezier, bool bAddText) const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - // Set local parameters with geometry recreation void SetCubePos(const basegfx::B3DPoint& rNew); const basegfx::B3DPoint& GetCubePos() const { return m_aCubePos; } diff --git a/include/svx/fillbitmaplink.hxx b/include/svx/fillbitmaplink.hxx index 48ef03a74700..de06cb16f6f2 100644 --- a/include/svx/fillbitmaplink.hxx +++ b/include/svx/fillbitmaplink.hxx @@ -1,13 +1,12 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + #ifndef INCLUDED_SVX_FILLBITMAPLINK_HXX #define INCLUDED_SVX_FILLBITMAPLINK_HXX diff --git a/include/svx/galctrl.hxx b/include/svx/galctrl.hxx index 955ed8fa987d..917f6de652ed 100644 --- a/include/svx/galctrl.hxx +++ b/include/svx/galctrl.hxx @@ -40,7 +40,7 @@ private: std::unique_ptr mxScrolledWindow; GraphicObject m_aGraphicObj; tools::Rectangle m_aPreviewRect; - GalleryBrowser* mpParent; + GalleryBrowser& mrParent; GalleryTheme* mpTheme; bool ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::Rectangle& rResultRect ) const; @@ -53,8 +53,7 @@ private: virtual bool KeyInput( const KeyEvent& rKEvt ) override; public: - - GalleryPreview(GalleryBrowser* pParent, std::unique_ptr xScrolledWindow); + GalleryPreview(GalleryBrowser& rParent, std::unique_ptr xScrolledWindow); void SetTheme(GalleryTheme* pTheme) { mpTheme = pTheme; } virtual ~GalleryPreview() override; @@ -91,7 +90,7 @@ class GalleryIconView final : public ValueSet private: std::unique_ptr mxDragDropTargetHelper; - GalleryBrowser* mpParent; + GalleryBrowser& mrParent; GalleryTheme* mpTheme; // ValueSet @@ -105,8 +104,7 @@ private: virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; public: - - GalleryIconView(GalleryBrowser* pParent, std::unique_ptr xScrolledWindow); + GalleryIconView(GalleryBrowser& rParent, std::unique_ptr xScrolledWindow); void SetTheme(GalleryTheme* pTheme) { mpTheme = pTheme; } virtual ~GalleryIconView() override; diff --git a/include/svx/lathe3d.hxx b/include/svx/lathe3d.hxx index d442119ad430..53abedc97056 100644 --- a/include/svx/lathe3d.hxx +++ b/include/svx/lathe3d.hxx @@ -47,10 +47,11 @@ class E3dLatheObj final : public E3dCompoundObject virtual std::unique_ptr CreateObjectSpecificProperties() override; void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); -private: // protected destructor - due to final, make private virtual ~E3dLatheObj() override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SVXCORE_DLLPUBLIC E3dLatheObj( SdrModel& rSdrModel, @@ -101,8 +102,6 @@ public: virtual SdrObjKind GetObjIdentifier() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - virtual rtl::Reference DoConvertToPolyObj(bool bBezier, bool bAddText) const override; // TakeObjName...() is for the display in the UI, for example "3 frames selected". diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx index 26f7a56d1d5d..d632c0059eb1 100644 --- a/include/svx/obj3d.hxx +++ b/include/svx/obj3d.hxx @@ -61,11 +61,12 @@ public: class SVXCORE_DLLPUBLIC E3dObject : public SdrAttrObj { -private: // Allow everything for E3dObjList and E3dDragMethod friend class E3dDragMethod; - protected: + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + +protected: virtual std::unique_ptr CreateObjectSpecificProperties() override; basegfx::B3DRange maLocalBoundVol; // surrounding volume of the object (from the geometry generation) @@ -125,7 +126,6 @@ public: // TakeObjName...() is for the display in the UI, for example "3 frames selected". virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; virtual std::unique_ptr NewGeoData() const override; virtual void SaveGeoData(SdrObjGeoData& rGeo) const override; @@ -152,13 +152,14 @@ public: class SVXCORE_DLLPUBLIC E3dCompoundObject : public E3dObject { -private: // to allow sdr::properties::E3dCompoundProperties access to SetGeometryValid() friend class sdr::properties::E3dCompoundProperties; friend class sdr::properties::E3dExtrudeProperties; friend class sdr::properties::E3dLatheProperties; friend class sdr::properties::E3dSphereProperties; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + protected: virtual std::unique_ptr CreateObjectSpecificProperties() override; @@ -179,8 +180,6 @@ public: virtual SdrObjKind GetObjIdentifier() const override; virtual void RecalcSnapRect() override; - - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; }; #endif // INCLUDED_SVX_OBJ3D_HXX diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx index 02da7a56495f..86158da94d71 100644 --- a/include/svx/scene3d.hxx +++ b/include/svx/scene3d.hxx @@ -73,6 +73,8 @@ class SVXCORE_DLLPUBLIC E3dScene final : public E3dObject, public SdrObjList void SetDefaultAttributes(); void ImpCleanup3DDepthMapper(); + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: E3dScene(SdrModel& rSdrModel); E3dScene(SdrModel& rSdrModel, E3dScene const &); @@ -120,8 +122,6 @@ public: const Camera3D& GetCamera() const { return m_aCamera; } void removeAllNonSelectedObjects(); - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - virtual std::unique_ptr NewGeoData() const override; virtual void SaveGeoData(SdrObjGeoData& rGeo) const override; virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override; diff --git a/include/svx/sdr/properties/defaultproperties.hxx b/include/svx/sdr/properties/defaultproperties.hxx index 868a141b5237..d41606892426 100644 --- a/include/svx/sdr/properties/defaultproperties.hxx +++ b/include/svx/sdr/properties/defaultproperties.hxx @@ -25,8 +25,10 @@ #include #include +#include #include #include +#include #include struct _xmlTextWriter; @@ -36,6 +38,12 @@ namespace sdr::properties { class SVXCORE_DLLPUBLIC DefaultProperties : public BaseProperties { + // Make sure the pool outlives any use via moItemSet: + rtl::Reference m_itemPoolHolder; + + // Clone() operator, normally just calls the local copy constructor + SAL_DLLPRIVATE virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + protected: // the to be used ItemSet mutable std::optional moItemSet; @@ -76,9 +84,6 @@ namespace sdr::properties SAL_DLLPRIVATE void dumpAsXml(xmlTextWriterPtr pWriter) const override; - // Clone() operator, normally just calls the local copy constructor - SAL_DLLPRIVATE virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // get itemset SAL_DLLPRIVATE virtual const SfxItemSet& GetObjectItemSet() const override; diff --git a/include/svx/sdr/properties/properties.hxx b/include/svx/sdr/properties/properties.hxx index dce0c01c1e2b..4e378caae9d3 100644 --- a/include/svx/sdr/properties/properties.hxx +++ b/include/svx/sdr/properties/properties.hxx @@ -72,15 +72,16 @@ namespace sdr::properties { class SVXCORE_DLLPUBLIC BaseProperties { - private: // the owner of this Properties. Set from constructor and not // to be changed in any way. SdrObject& mrObject; + // the Clone-implementations, overloaded for each derivation + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const = 0; + protected: // internal access to SdrObject const SdrObject& GetSdrObject() const; - SdrObject& GetSdrObject(); public: @@ -90,11 +91,17 @@ namespace sdr::properties // destructor virtual ~BaseProperties(); + // create needed SfxItemSet, overloaded in all derivations as needed virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) = 0; + // Regulates Styles/Items between models when a Clone to another model + // was done. This is needed to evtl. also clone Styles and/or attributes + // to target model + virtual void postProcessAfterCloneToDifferentModel(const SdrObject& rSrcObj); + // Clone() operator, normally just calls the local copy constructor, // see above. - virtual std::unique_ptr Clone(SdrObject& rObj) const = 0; + std::unique_ptr Clone(SdrObject& rObj) const; // Get the local ItemSet. This directly returns the local ItemSet of the object. No // merging of ItemSets is done for e.g. Group objects. diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx b/include/svx/sidebar/AreaPropertyPanelBase.hxx index ea99f0850cec..6f2aed7a75b0 100644 --- a/include/svx/sidebar/AreaPropertyPanelBase.hxx +++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx @@ -144,6 +144,7 @@ protected: std::unique_ptr mxMTRAngle; std::unique_ptr mxGradientStyle; std::unique_ptr mxBmpImport; + std::unique_ptr mxTransparencyBox; std::unique_ptr mxTrGrPopup; std::unique_ptr< XFillStyleItem > mpStyleItem; diff --git a/include/svx/sidebar/LineWidthPopup.hxx b/include/svx/sidebar/LineWidthPopup.hxx index e796a73922c5..32be0a9be081 100644 --- a/include/svx/sidebar/LineWidthPopup.hxx +++ b/include/svx/sidebar/LineWidthPopup.hxx @@ -22,16 +22,13 @@ #include #include #include -#include +#include #include #include -class ValueSet; - namespace svx::sidebar { class LinePropertyPanelBase; -class LineWidthValueSet; class LineWidthPopup final : public WeldToolbarPopup { @@ -50,17 +47,18 @@ private: std::array maStrUnits; OUString m_sPt; MapUnit m_eMapUnit; - bool m_bVSFocus; + bool m_bTreeViewFocus; bool m_bCustom; tools::Long m_nCustomWidth; Image m_aIMGCus; - Image m_aIMGCusGray; std::unique_ptr m_xMFWidth; - std::unique_ptr m_xVSWidth; - std::unique_ptr m_xVSWidthWin; + std::unique_ptr m_xWidthTreeView; - DECL_LINK(VSSelectHdl, ValueSet*, void); + ScopedVclPtr CreateImage(int nIndex); + void UnselectTreeViewItems(); + + DECL_LINK(TreeViewItemActivatedHdl, const weld::TreeIter&, bool); DECL_LINK(MFModifyHdl, weld::MetricSpinButton&, void); }; diff --git a/include/svx/sphere3d.hxx b/include/svx/sphere3d.hxx index 42bd8ebbfa53..500a03ccd58e 100644 --- a/include/svx/sphere3d.hxx +++ b/include/svx/sphere3d.hxx @@ -34,7 +34,6 @@ class E3dDefaultAttributes; */ class E3dSphereObj final : public E3dCompoundObject { -private: basegfx::B3DPoint m_aCenter; basegfx::B3DVector m_aSize; @@ -42,10 +41,11 @@ private: virtual std::unique_ptr CreateObjectSpecificProperties() override; void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); -private: // protected destructor - due to final, make private virtual ~E3dSphereObj() override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SVXCORE_DLLPUBLIC E3dSphereObj( SdrModel& rSdrModel, @@ -70,8 +70,6 @@ public: virtual SdrObjKind GetObjIdentifier() const override; virtual rtl::Reference DoConvertToPolyObj(bool bBezier, bool bAddText) const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - const basegfx::B3DPoint& Center() const { return m_aCenter; } const basegfx::B3DVector& Size() const { return m_aSize; } diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc index 48f084c79954..f2dc29bfe11a 100644 --- a/include/svx/strings.hrc +++ b/include/svx/strings.hrc @@ -324,7 +324,6 @@ #define SIP_XA_LINEENDCENTER NC_("SIP_XA_LINEENDCENTER", "Center arrowend") #define SIP_XA_LINETRANSPARENCE NC_("SIP_XA_LINETRANSPARENCE", "Line transparency") #define SIP_XA_LINEJOINT NC_("SIP_XA_LINEJOINT", "Line joint") -#define SIP_XATTRSET_LINE NC_("SIP_XATTRSET_LINE", "Line attributes") #define SIP_XA_FILLSTYLE NC_("SIP_XA_FILLSTYLE", "Fill style") #define SIP_XA_FILLCOLOR NC_("SIP_XA_FILLCOLOR", "Fillcolor") #define SIP_XA_FILLGRADIENT NC_("SIP_XA_FILLGRADIENT", "Gradient") @@ -346,7 +345,6 @@ #define SIP_XA_FILLBMP_POSOFFSETY NC_("SIP_XA_FILLBMP_POSOFFSETY", "Tile position Y in %") #define SIP_XA_FILLBACKGROUND NC_("SIP_XA_FILLBACKGROUND", "Background fill") #define SIP_XA_FILLUSESLIDEBACKGROUND NC_("SIP_XA_FILLUSESLIDEBACKGROUND", "Use slide background fill") -#define SIP_XATTRSET_FILL NC_("SIP_XATTRSET_FILL", "Area attributes") #define SIP_XA_FORMTXTSTYLE NC_("SIP_XA_FORMTXTSTYLE", "Fontwork style") #define SIP_XA_FORMTXTADJUST NC_("SIP_XA_FORMTXTADJUST", "Fontwork alignment") #define SIP_XA_FORMTXTDISTANCE NC_("SIP_XA_FORMTXTDISTANCE", "Fontwork spacing") diff --git a/include/svx/svddef.hxx b/include/svx/svddef.hxx index 775d69a48a2d..ad934f229938 100644 --- a/include/svx/svddef.hxx +++ b/include/svx/svddef.hxx @@ -25,14 +25,10 @@ /*************************************************************************/ // SdrItemPool V2, 09-11-1995: -// 7 new Items for XLineAttrSetItem -// 7 new Items for XFillAttrSetItem // 8 new Items for SdrShadowSetItem // 5 new Items for SdrCaptionSetItem // 25 new Items for SdrMiscSetItem // 6 new Items for SdrNotPersist -// SdrItemPool V3, 29-02-1996 -// 17 new Items for XFillAttrSetItem (Bitmapfill) // SdrItemPool V4, 10-08-1996 // 45 new Items for Edge and Measure (Connector and Measuring object) // SdrItemPool V4+, 18-10-1996 diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx index b57f1a3f89eb..138da821537c 100644 --- a/include/svx/svdoashp.hxx +++ b/include/svx/svdoashp.hxx @@ -74,11 +74,12 @@ struct SdrCustomShapeInteraction class SVXCORE_DLLPUBLIC SdrObjCustomShape : public SdrTextObj { -private: // fObjectRotation is containing the object rotation in degrees. double m_fObjectRotation; bool mbAdjustingTextFrameWidthAndHeight; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + protected: virtual std::unique_ptr CreateObjectSpecificViewContact() override; virtual void setUnoShape(const css::uno::Reference& rxUnoShape) override; @@ -113,7 +114,6 @@ public: // returns the new text rect that corresponds to the current logic rect, the return value can be empty if nothing changed. tools::Rectangle ImpCalculateTextFrame( const bool bHgt, const bool bWdt ); -public: // #i37011# const SdrObject* GetSdrObjectFromCustomShape() const; const SdrObject* GetSdrObjectShadowFromCustomShape() const; @@ -209,7 +209,6 @@ public: virtual void TakeTextAnchorRect( tools::Rectangle& rAnchorRect ) const override; virtual void TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText, tools::Rectangle* pAnchorRect, bool bLineWidth = true ) const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 351f3ff7101e..f675fe93b10c 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -254,6 +254,9 @@ private: friend class SdrVirtObj; friend class SdrRectObj; + // Returns a copy of the object. Every inherited class must reimplement this. + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const = 0; + // OperationSmiley: Allow at each SdrObject to set a FillGeometryDefiningShape, // so that for SdrObjects where this is set, the definition of a defined FillStyle // will use this, but the local geometry will be filled. This allows to fill @@ -452,8 +455,12 @@ public: // means no change of the rotation point (only centered) and no shear allowed virtual bool HasLimitedRotation() const; - // Returns a copy of the object. Every inherited class must reimplement this. - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const = 0; + // Returns a copy of the object. Internally uses the virtual and + // overridden method implCloneSdrObject that is implemented for each + // derivation. If cloned to another SdrModel it will support calling + // postProcessAfterCloneToDifferentModel + rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const; + // helper, since Clone always return the type of the current subclass template static rtl::Reference Clone(T const & rObj, SdrModel& rTargetModel) diff --git a/include/svx/svdocapt.hxx b/include/svx/svdocapt.hxx index 4b0f593a147e..35ca8bfde6cd 100644 --- a/include/svx/svdocapt.hxx +++ b/include/svx/svdocapt.hxx @@ -40,7 +40,6 @@ public: // SdrCaptionObj class SVXCORE_DLLPUBLIC SdrCaptionObj final : public SdrRectObj { -private: // to allow sdr::properties::CaptionProperties access to ImpRecalcTail() friend class sdr::properties::CaptionProperties; friend class SdrTextObj; // for ImpRecalcTail() during AutoGrow @@ -71,6 +70,8 @@ private: // protected destructor SAL_DLLPRIVATE virtual ~SdrCaptionObj() override; + SAL_DLLPRIVATE virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SAL_DLLPRIVATE SdrCaptionObj(SdrModel& rSdrModel); @@ -84,8 +85,6 @@ public: SAL_DLLPRIVATE virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; SAL_DLLPRIVATE virtual SdrObjKind GetObjIdentifier() const override; - SAL_DLLPRIVATE virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - // for calc: special shadow only for text box void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow = true; } bool GetSpecialTextBoxShadow() const { return mbSpecialTextBoxShadow; } diff --git a/include/svx/svdocirc.hxx b/include/svx/svdocirc.hxx index 322ac1bbf383..a642eec936d8 100644 --- a/include/svx/svdocirc.hxx +++ b/include/svx/svdocirc.hxx @@ -42,7 +42,6 @@ extern SVXCORE_DLLPUBLIC SdrCircKind ToSdrCircKind(SdrObjKind); class SVXCORE_DLLPUBLIC SdrCircObj final : public SdrRectObj { -private: // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo() friend class sdr::properties::CircleProperties; @@ -64,10 +63,11 @@ private: SAL_DLLPRIVATE virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; -private: // protected destructor - due to final, make private SAL_DLLPRIVATE virtual ~SdrCircObj() override; + SAL_DLLPRIVATE virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SAL_DLLPRIVATE SdrCircObj( SdrModel& rSdrModel, @@ -99,8 +99,6 @@ public: SAL_DLLPRIVATE virtual OUString TakeObjNameSingul() const override; SAL_DLLPRIVATE virtual OUString TakeObjNamePlural() const override; - SAL_DLLPRIVATE virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - SAL_DLLPRIVATE virtual void RecalcSnapRect() override; SAL_DLLPRIVATE virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override; SAL_DLLPRIVATE virtual basegfx::B2DPolyPolygon TakeXorPoly() const override; diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx index 2c1e4684a408..6089b215301d 100644 --- a/include/svx/svdoedge.hxx +++ b/include/svx/svdoedge.hxx @@ -134,7 +134,6 @@ public: /// Utility class SdrEdgeObj class SVXCORE_DLLPUBLIC SdrEdgeObj final : public SdrTextObj { -private: // to allow sdr::properties::ConnectorProperties access to ImpSetAttrToEdgeInfo() friend class sdr::properties::ConnectorProperties; @@ -169,6 +168,8 @@ private: // to a correct state for first real layouting bool mbSuppressed : 1; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: // Interface to default connect suppression void SetSuppressDefaultConnect(bool bNew) { mbSuppressDefaultConnect = bNew; } @@ -224,7 +225,6 @@ public: SAL_DLLPRIVATE virtual void RecalcSnapRect() override; SAL_DLLPRIVATE virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; SAL_DLLPRIVATE virtual OUString TakeObjNameSingul() const override; SAL_DLLPRIVATE virtual OUString TakeObjNamePlural() const override; diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx index 20cbd6aa3c1c..d407950399c5 100644 --- a/include/svx/svdograf.hxx +++ b/include/svx/svdograf.hxx @@ -66,7 +66,6 @@ class SdrGraphicLink; */ class SVXCORE_DLLPUBLIC SdrGrafObj final : public SdrRectObj { -private: // to allow sdr::properties::GraphicProperties access to SetXPolyDirty() friend class sdr::properties::GraphicProperties; @@ -109,6 +108,8 @@ private: // protected destructor SAL_DLLPRIVATE virtual ~SdrGrafObj() override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SdrGrafObj(SdrModel& rSdrModel); // Copy constructor @@ -166,8 +167,6 @@ public: SAL_DLLPRIVATE virtual OUString TakeObjNameSingul() const override; SAL_DLLPRIVATE virtual OUString TakeObjNamePlural() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - SAL_DLLPRIVATE virtual sal_uInt32 GetHdlCount() const override; SAL_DLLPRIVATE virtual void AddToHdlList(SdrHdlList& rHdlList) const override; diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx index 08de5020cba7..61be5586b716 100644 --- a/include/svx/svdogrp.hxx +++ b/include/svx/svdogrp.hxx @@ -47,6 +47,8 @@ private: // the DiagramHelper if this SdrObjGroup host a Diagram std::shared_ptr< svx::diagram::DiagramHelper_svx > mp_DiagramHelper; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SdrObjGroup(SdrModel& rSdrModel); // Copy constructor @@ -74,8 +76,6 @@ public: virtual const tools::Rectangle& GetCurrentBoundRect() const override; virtual const tools::Rectangle& GetSnapRect() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx index 77309db6af9d..a7db2f06bdda 100644 --- a/include/svx/svdomeas.hxx +++ b/include/svx/svdomeas.hxx @@ -43,7 +43,6 @@ public: class SVXCORE_DLLPUBLIC SdrMeasureObj final : public SdrTextObj { -private: // to allow sdr::properties::MeasureProperties access to SetTextDirty() friend class sdr::properties::MeasureProperties; friend class SdrMeasureField; @@ -76,6 +75,8 @@ private: SAL_DLLPRIVATE virtual void SaveGeoData(SdrObjGeoData& rGeo) const override; SAL_DLLPRIVATE virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override; + SAL_DLLPRIVATE virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SAL_DLLPRIVATE SdrMeasureObj(SdrModel& rSdrModel); // Copy constructor @@ -89,7 +90,6 @@ public: SAL_DLLPRIVATE virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; SAL_DLLPRIVATE virtual SdrObjKind GetObjIdentifier() const override; virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; - SAL_DLLPRIVATE virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; SAL_DLLPRIVATE virtual OUString TakeObjNameSingul() const override; SAL_DLLPRIVATE virtual OUString TakeObjNamePlural() const override; diff --git a/include/svx/svdomedia.hxx b/include/svx/svdomedia.hxx index 9869758d6d74..ce9ddb5774ff 100644 --- a/include/svx/svdomedia.hxx +++ b/include/svx/svdomedia.hxx @@ -34,10 +34,11 @@ class SVXCORE_DLLPUBLIC SdrMediaObj final : public SdrRectObj friend class sdr::contact::ViewContactOfSdrMediaObj; friend class SdrMediaLink; -private: // protected destructor - due to final, make private SAL_DLLPRIVATE virtual ~SdrMediaObj() override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SAL_DLLPRIVATE SdrMediaObj(SdrModel& rSdrModel); // Copy constructor @@ -54,8 +55,6 @@ public: SAL_DLLPRIVATE virtual OUString TakeObjNameSingul() const override; SAL_DLLPRIVATE virtual OUString TakeObjNamePlural() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override; void setURL(const OUString& rURL, const OUString& rReferer); diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx index 63707fc8d6f7..f16089ede671 100644 --- a/include/svx/svdoole2.hxx +++ b/include/svx/svdoole2.hxx @@ -45,10 +45,8 @@ class SvxOle2Shape; class SVXCORE_DLLPUBLIC SdrOle2Obj : public SdrRectObj { -private: std::unique_ptr mpImpl; -private: SVX_DLLPRIVATE void Connect_Impl(SvxOle2Shape* pCreator = nullptr); SVX_DLLPRIVATE void Disconnect_Impl(); SVX_DLLPRIVATE void AddListeners_Impl(); @@ -61,6 +59,8 @@ private: SVX_DLLPRIVATE void Init(); + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + protected: virtual std::unique_ptr CreateObjectSpecificViewContact() override; virtual std::unique_ptr CreateObjectSpecificProperties() override; @@ -140,8 +140,6 @@ public: virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - virtual void NbcMove(const Size& rSize) override; virtual void NbcResize(const Point& rRef, double xFact, double yFact) override; virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override; diff --git a/include/svx/svdopage.hxx b/include/svx/svdopage.hxx index 279c75c758a6..5d0650b7fe6c 100644 --- a/include/svx/svdopage.hxx +++ b/include/svx/svdopage.hxx @@ -41,6 +41,8 @@ private: // protected destructor virtual ~SdrPageObj() override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SdrPageObj( SdrModel& rSdrModel, @@ -60,7 +62,6 @@ public: virtual SdrObjKind GetObjIdentifier() const override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; diff --git a/include/svx/svdopath.hxx b/include/svx/svdopath.hxx index 3d63acf27fe4..b440fa5dfe49 100644 --- a/include/svx/svdopath.hxx +++ b/include/svx/svdopath.hxx @@ -41,7 +41,6 @@ public: class SVXCORE_DLLPUBLIC SdrPathObj final : public SdrTextObj { -private: friend class ImpPathForDragAndCreate; virtual std::unique_ptr CreateObjectSpecificViewContact() override; @@ -59,10 +58,11 @@ private: void ImpForceLineAngle(); ImpPathForDragAndCreate& impGetDAC() const; -private: // protected destructor - due to final, make private virtual ~SdrPathObj() override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SdrPathObj( SdrModel& rSdrModel, @@ -77,7 +77,6 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual SdrObjKind GetObjIdentifier() const override; virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; diff --git a/include/svx/svdorect.hxx b/include/svx/svdorect.hxx index a50a5524daeb..9a3f7d3f0b50 100644 --- a/include/svx/svdorect.hxx +++ b/include/svx/svdorect.hxx @@ -37,18 +37,18 @@ namespace sdr::properties { /// Rectangle objects (rectangle, circle, ...) class SVXCORE_DLLPUBLIC SdrRectObj : public SdrTextObj { -private: // to allow sdr::properties::RectangleProperties access to SetXPolyDirty() friend class sdr::properties::RectangleProperties; friend class SdrTextObj; // Due to SetXPolyDirty for GrowAdjust + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + protected: virtual std::unique_ptr CreateObjectSpecificViewContact() override; virtual std::unique_ptr CreateObjectSpecificProperties() override; std::optional mpXPoly; -protected: XPolygon ImpCalcXPoly(const tools::Rectangle& rRect1, tools::Long nRad1) const; void SetXPolyDirty(); @@ -82,7 +82,6 @@ public: virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; virtual void RecalcSnapRect() override; virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override; virtual void NbcSetLogicRect(const tools::Rectangle& rRect, bool bAdaptTextMinSize = true) override; diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx index 17ebb8692a8c..bf552e92f09a 100644 --- a/include/svx/svdotable.hxx +++ b/include/svx/svdotable.hxx @@ -93,6 +93,8 @@ class SVXCORE_DLLPUBLIC SdrTableObj final : public ::SdrTextObj // protected destructor virtual ~SdrTableObj() override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SdrTableObj(SdrModel& rSdrModel); // Copy constructor @@ -203,7 +205,6 @@ public: virtual bool AdjustTextFrameWidthAndHeight() override; virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; virtual void RecalcSnapRect() override; virtual const tools::Rectangle& GetSnapRect() const override; virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override; diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index 0a7d9db01fc5..8e1da77ccaec 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -119,7 +119,6 @@ namespace sdr::properties // SdrTextObj class SVXCORE_DLLPUBLIC SdrTextObj : public SdrAttrObj, public svx::ITextProvider { -private: // Cell needs access to ImpGetDrawOutliner(); friend class sdr::table::Cell; friend class sdr::table::SdrTableRtfExporter; @@ -132,6 +131,8 @@ private: // CustomShapeproperties need to access the "mbTextFrame" member: friend class sdr::properties::CustomShapeProperties; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + protected: virtual std::unique_ptr CreateObjectSpecificProperties() override; virtual std::unique_ptr CreateObjectSpecificViewContact() override; @@ -463,7 +464,6 @@ public: virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const; virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; virtual basegfx::B2DPolyPolygon TakeXorPoly() const override; virtual basegfx::B2DPolyPolygon TakeContour() const override; virtual void RecalcSnapRect() override; diff --git a/include/svx/svdouno.hxx b/include/svx/svdouno.hxx index bebd81fa6259..c7ccd903b43f 100644 --- a/include/svx/svdouno.hxx +++ b/include/svx/svdouno.hxx @@ -48,6 +48,8 @@ class SVXCORE_DLLPUBLIC SdrUnoObj : public SdrRectObj OUString m_aUnoControlModelTypeName; OUString m_aUnoControlTypeName; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + protected: css::uno::Reference< css::awt::XControlModel > m_xUnoControlModel; // Can also be set from outside @@ -71,7 +73,6 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual SdrObjKind GetObjIdentifier() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; virtual void NbcResize(const Point& rRef, double xFact, double yFact) override; virtual void NbcSetLayer(SdrLayerID nLayer) override; diff --git a/include/svx/svdovirt.hxx b/include/svx/svdovirt.hxx index 13671663b8f9..e16352dd68c0 100644 --- a/include/svx/svdovirt.hxx +++ b/include/svx/svdovirt.hxx @@ -30,6 +30,8 @@ class SVXCORE_DLLPUBLIC SdrVirtObj : public SdrObject { SdrVirtObj(const SdrVirtObj&) = delete; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: virtual sdr::properties::BaseProperties& GetProperties() const override; @@ -81,7 +83,6 @@ public: virtual const tools::Rectangle& GetCurrentBoundRect() const override; virtual const tools::Rectangle& GetLastBoundRect() const override; virtual void RecalcBoundRect() override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; diff --git a/include/svx/xdef.hxx b/include/svx/xdef.hxx index 5cfdde78eab8..de89bb7322a3 100644 --- a/include/svx/xdef.hxx +++ b/include/svx/xdef.hxx @@ -31,7 +31,6 @@ \************************************************************************/ class SfxMetricItem; -class XFillAttrSetItem; class XFillBackgroundItem; class XFillBitmapItem; class XFillBmpPosItem; @@ -63,7 +62,6 @@ class XFormTextShadowYValItem; class XFormTextStartItem; class XFormTextStyleItem; class XGradientStepCountItem; -class XLineAttrSetItem; class XLineCapItem; class XLineColorItem; class XLineDashItem; @@ -102,49 +100,47 @@ inline constexpr TypedWhichId XATTR_LINETRANSPARENCE (XAT inline constexpr TypedWhichId XATTR_LINEJOINT (XATTR_LINE_FIRST + 11); // 1011 inline constexpr TypedWhichId XATTR_LINECAP (XATTR_LINE_FIRST + 12); // 1012 inline constexpr sal_uInt16 XATTR_LINE_LAST (XATTR_LINECAP); // 1012 -inline constexpr TypedWhichId XATTRSET_LINE (XATTR_LINE_LAST + 1); // 1013 -inline constexpr sal_uInt16 XATTR_FILL_FIRST (XATTRSET_LINE + 1); // 1014 -inline constexpr TypedWhichId XATTR_FILLSTYLE (XATTR_FILL_FIRST); // 1014 -inline constexpr TypedWhichId XATTR_FILLCOLOR (XATTR_FILL_FIRST + 1); // 1015 -inline constexpr TypedWhichId XATTR_FILLGRADIENT (XATTR_FILL_FIRST + 2); // 1016 -inline constexpr TypedWhichId XATTR_FILLHATCH (XATTR_FILL_FIRST + 3); // 1017 -inline constexpr TypedWhichId XATTR_FILLBITMAP (XATTR_FILL_FIRST + 4); // 1018 -inline constexpr TypedWhichId XATTR_FILLTRANSPARENCE (XATTR_FILL_FIRST + 5); // 1019 -inline constexpr TypedWhichId XATTR_GRADIENTSTEPCOUNT (XATTR_FILL_FIRST + 6); // 1020 -inline constexpr TypedWhichId XATTR_FILLBMP_TILE (XATTR_FILL_FIRST + 7); // 1021 -inline constexpr TypedWhichId XATTR_FILLBMP_POS (XATTR_FILL_FIRST + 8); // 1022 -inline constexpr TypedWhichId XATTR_FILLBMP_SIZEX (XATTR_FILL_FIRST + 9); // 1023 -inline constexpr TypedWhichId XATTR_FILLBMP_SIZEY (XATTR_FILL_FIRST + 10); // 1024 -inline constexpr TypedWhichId XATTR_FILLFLOATTRANSPARENCE (XATTR_FILL_FIRST + 11); // 1025 -inline constexpr TypedWhichId XATTR_SECONDARYFILLCOLOR (XATTR_FILL_FIRST + 12); // 1026 -inline constexpr TypedWhichId XATTR_FILLBMP_SIZELOG (XATTR_FILL_FIRST + 13); // 1027 -inline constexpr TypedWhichId XATTR_FILLBMP_TILEOFFSETX (XATTR_FILL_FIRST + 14); // 1028 -inline constexpr TypedWhichId XATTR_FILLBMP_TILEOFFSETY (XATTR_FILL_FIRST + 15); // 1029 -inline constexpr TypedWhichId XATTR_FILLBMP_STRETCH (XATTR_FILL_FIRST + 16); // 1030 -inline constexpr TypedWhichId XATTR_FILLBMP_POSOFFSETX (XATTR_FILL_FIRST + 17); // 1031 -inline constexpr TypedWhichId XATTR_FILLBMP_POSOFFSETY (XATTR_FILL_FIRST + 18); // 1032 -inline constexpr TypedWhichId XATTR_FILLBACKGROUND (XATTR_FILL_FIRST + 19); // 1033 -inline constexpr TypedWhichId XATTR_FILLUSESLIDEBACKGROUND (XATTR_FILL_FIRST + 20);// 1034 -inline constexpr sal_uInt16 XATTR_FILL_LAST (XATTR_FILLUSESLIDEBACKGROUND); // 1034 -inline constexpr TypedWhichId XATTRSET_FILL (XATTR_FILL_LAST + 1); // 1035 +inline constexpr sal_uInt16 XATTR_FILL_FIRST (XATTR_LINE_LAST + 1); // 1013 +inline constexpr TypedWhichId XATTR_FILLSTYLE (XATTR_FILL_FIRST); // 1013 +inline constexpr TypedWhichId XATTR_FILLCOLOR (XATTR_FILL_FIRST + 1); // 1014 +inline constexpr TypedWhichId XATTR_FILLGRADIENT (XATTR_FILL_FIRST + 2); // 1015 +inline constexpr TypedWhichId XATTR_FILLHATCH (XATTR_FILL_FIRST + 3); // 1016 +inline constexpr TypedWhichId XATTR_FILLBITMAP (XATTR_FILL_FIRST + 4); // 1017 +inline constexpr TypedWhichId XATTR_FILLTRANSPARENCE (XATTR_FILL_FIRST + 5); // 1018 +inline constexpr TypedWhichId XATTR_GRADIENTSTEPCOUNT (XATTR_FILL_FIRST + 6); // 1019 +inline constexpr TypedWhichId XATTR_FILLBMP_TILE (XATTR_FILL_FIRST + 7); // 1020 +inline constexpr TypedWhichId XATTR_FILLBMP_POS (XATTR_FILL_FIRST + 8); // 1021 +inline constexpr TypedWhichId XATTR_FILLBMP_SIZEX (XATTR_FILL_FIRST + 9); // 1022 +inline constexpr TypedWhichId XATTR_FILLBMP_SIZEY (XATTR_FILL_FIRST + 10); // 1023 +inline constexpr TypedWhichId XATTR_FILLFLOATTRANSPARENCE (XATTR_FILL_FIRST + 11); // 1024 +inline constexpr TypedWhichId XATTR_SECONDARYFILLCOLOR (XATTR_FILL_FIRST + 12); // 1025 +inline constexpr TypedWhichId XATTR_FILLBMP_SIZELOG (XATTR_FILL_FIRST + 13); // 1026 +inline constexpr TypedWhichId XATTR_FILLBMP_TILEOFFSETX (XATTR_FILL_FIRST + 14); // 1027 +inline constexpr TypedWhichId XATTR_FILLBMP_TILEOFFSETY (XATTR_FILL_FIRST + 15); // 1028 +inline constexpr TypedWhichId XATTR_FILLBMP_STRETCH (XATTR_FILL_FIRST + 16); // 1029 +inline constexpr TypedWhichId XATTR_FILLBMP_POSOFFSETX (XATTR_FILL_FIRST + 17); // 1030 +inline constexpr TypedWhichId XATTR_FILLBMP_POSOFFSETY (XATTR_FILL_FIRST + 18); // 1031 +inline constexpr TypedWhichId XATTR_FILLBACKGROUND (XATTR_FILL_FIRST + 19); // 1032 +inline constexpr TypedWhichId XATTR_FILLUSESLIDEBACKGROUND (XATTR_FILL_FIRST + 20);// 1033 +inline constexpr sal_uInt16 XATTR_FILL_LAST (XATTR_FILLUSESLIDEBACKGROUND); // 1033 -inline constexpr sal_uInt16 XATTR_TEXT_FIRST (XATTRSET_FILL + 1); // 1036 -inline constexpr TypedWhichId XATTR_FORMTXTSTYLE (XATTR_TEXT_FIRST); // 1036 -inline constexpr TypedWhichId XATTR_FORMTXTADJUST (XATTR_TEXT_FIRST + 1); // 1037 -inline constexpr TypedWhichId XATTR_FORMTXTDISTANCE (XATTR_TEXT_FIRST + 2); // 1038 -inline constexpr TypedWhichId XATTR_FORMTXTSTART (XATTR_TEXT_FIRST + 3); // 1039 -inline constexpr TypedWhichId XATTR_FORMTXTMIRROR (XATTR_TEXT_FIRST + 4); // 1040 -inline constexpr TypedWhichId XATTR_FORMTXTOUTLINE (XATTR_TEXT_FIRST + 5); // 1041 -inline constexpr TypedWhichId XATTR_FORMTXTSHADOW (XATTR_TEXT_FIRST + 6); // 1042 -inline constexpr TypedWhichId XATTR_FORMTXTSHDWCOLOR (XATTR_TEXT_FIRST + 7); // 1043 -inline constexpr TypedWhichId XATTR_FORMTXTSHDWXVAL (XATTR_TEXT_FIRST + 8); // 1044 -inline constexpr TypedWhichId XATTR_FORMTXTSHDWYVAL (XATTR_TEXT_FIRST + 9); // 1045 -inline constexpr TypedWhichId XATTR_FORMTXTHIDEFORM (XATTR_TEXT_FIRST + 10); // 1046 -inline constexpr TypedWhichId XATTR_FORMTXTSHDWTRANSP (XATTR_TEXT_FIRST + 11); // 1047 -inline constexpr sal_uInt16 XATTR_TEXT_LAST (XATTR_FORMTXTSHDWTRANSP);// 1047 +inline constexpr sal_uInt16 XATTR_TEXT_FIRST (XATTR_FILL_LAST + 1); // 1034 +inline constexpr TypedWhichId XATTR_FORMTXTSTYLE (XATTR_TEXT_FIRST); // 1034 +inline constexpr TypedWhichId XATTR_FORMTXTADJUST (XATTR_TEXT_FIRST + 1); // 1035 +inline constexpr TypedWhichId XATTR_FORMTXTDISTANCE (XATTR_TEXT_FIRST + 2); // 1036 +inline constexpr TypedWhichId XATTR_FORMTXTSTART (XATTR_TEXT_FIRST + 3); // 1037 +inline constexpr TypedWhichId XATTR_FORMTXTMIRROR (XATTR_TEXT_FIRST + 4); // 1038 +inline constexpr TypedWhichId XATTR_FORMTXTOUTLINE (XATTR_TEXT_FIRST + 5); // 1039 +inline constexpr TypedWhichId XATTR_FORMTXTSHADOW (XATTR_TEXT_FIRST + 6); // 1040 +inline constexpr TypedWhichId XATTR_FORMTXTSHDWCOLOR (XATTR_TEXT_FIRST + 7); // 1041 +inline constexpr TypedWhichId XATTR_FORMTXTSHDWXVAL (XATTR_TEXT_FIRST + 8); // 1042 +inline constexpr TypedWhichId XATTR_FORMTXTSHDWYVAL (XATTR_TEXT_FIRST + 9); // 1043 +inline constexpr TypedWhichId XATTR_FORMTXTHIDEFORM (XATTR_TEXT_FIRST + 10); // 1044 +inline constexpr TypedWhichId XATTR_FORMTXTSHDWTRANSP (XATTR_TEXT_FIRST + 11); // 1045 +inline constexpr sal_uInt16 XATTR_TEXT_LAST (XATTR_FORMTXTSHDWTRANSP);// 1045 -inline constexpr sal_uInt16 XATTR_END = XATTR_TEXT_LAST; // 1047 +inline constexpr sal_uInt16 XATTR_END = XATTR_TEXT_LAST; // 1045 #endif diff --git a/include/test/sheet/databaserange.hxx b/include/test/sheet/databaserange.hxx index 9aca2f5eb390..e0ad38f3572f 100644 --- a/include/test/sheet/databaserange.hxx +++ b/include/test/sheet/databaserange.hxx @@ -32,6 +32,7 @@ public: void testTokenIndex(); void testTotalsRow(); void testContainsHeader(); + void testTdf170842_TableStylePropertiesPlainRange(); protected: ~DatabaseRange() {} diff --git a/include/vbahelper/vbaapplicationbase.hxx b/include/vbahelper/vbaapplicationbase.hxx index f580fb3402f1..15296aaef050 100644 --- a/include/vbahelper/vbaapplicationbase.hxx +++ b/include/vbahelper/vbaapplicationbase.hxx @@ -47,7 +47,7 @@ protected: virtual ~VbaApplicationBase() override; /// @throws css::uno::RuntimeException - virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() = 0; + virtual css::frame::XModel* getCurrentDocument() = 0; public: // XHelperInterface ( parent is itself ) virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) override { return this; } diff --git a/include/vbahelper/vbadocumentbase.hxx b/include/vbahelper/vbadocumentbase.hxx index f69d6de46b40..09d987bd1a8b 100644 --- a/include/vbahelper/vbadocumentbase.hxx +++ b/include/vbahelper/vbadocumentbase.hxx @@ -47,7 +47,7 @@ class VBAHELPER_DLLPUBLIC VbaDocumentBase : public VbaDocumentBase_BASE protected: css::uno::Reference< css::uno::XInterface > mxVBProject; protected: - virtual css::uno::Reference< css::frame::XModel > getModel() const = 0; + virtual css::frame::XModel* getModel() const = 0; public: VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ); VbaDocumentBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ); diff --git a/include/vcl/ImageTree.hxx b/include/vcl/ImageTree.hxx index e183f1090b94..65cfa14b66fd 100644 --- a/include/vcl/ImageTree.hxx +++ b/include/vcl/ImageTree.hxx @@ -56,9 +56,9 @@ class ImageTree private: std::unique_ptr mpImplImageTree; -public: ImageTree(); +public: VCL_DLLPUBLIC static ImageTree & get(); VCL_DLLPUBLIC OUString getImageUrl( diff --git a/include/vcl/RawBitmap.hxx b/include/vcl/RawBitmap.hxx index 8da900a0231e..7209470e9f6f 100644 --- a/include/vcl/RawBitmap.hxx +++ b/include/vcl/RawBitmap.hxx @@ -45,7 +45,7 @@ public: { throw std::bad_alloc(); } - mpData.reset(new sal_uInt8[nDataSize]); + mpData.reset(new sal_uInt8[nDataSize]()); } void SetPixel(tools::Long nY, tools::Long nX, Color nColor) { diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx index 47e333b4f95b..deab99c59a49 100644 --- a/include/vcl/filter/PDFiumLibrary.hxx +++ b/include/vcl/filter/PDFiumLibrary.hxx @@ -226,6 +226,8 @@ public: virtual PDFPageObjectType getType() = 0; virtual OUString getText(std::unique_ptr const& pTextPage) = 0; + // what ties the object to a structure element within the page, or -1 + virtual int getMarkedContentID() = 0; virtual int getFormObjectCount() = 0; virtual std::unique_ptr getFormObject(int nIndex) = 0; diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx index 226e0318711d..ed999120b024 100644 --- a/include/vcl/filter/pdfdocument.hxx +++ b/include/vcl/filter/pdfdocument.hxx @@ -546,6 +546,8 @@ public: SAL_DLLPRIVATE size_t GetObjectOffset(size_t nIndex) const; const std::vector>& GetElements() const; std::vector GetPages(); + /// Every object of the document, those an object stream holds included. + std::vector GetObjects(); PDFObjectElement* GetCatalog(); /// Remember the end location of an EOF token. SAL_DLLPRIVATE void PushBackEOF(size_t nOffset); diff --git a/include/vcl/filter/pdfobjectcontainer.hxx b/include/vcl/filter/pdfobjectcontainer.hxx index f0e29142e771..b8daf00e402b 100644 --- a/include/vcl/filter/pdfobjectcontainer.hxx +++ b/include/vcl/filter/pdfobjectcontainer.hxx @@ -9,6 +9,9 @@ #pragma once +#include + +#include #include #include @@ -35,6 +38,11 @@ public: return writeBufferBytes(aBuffer.data(), aBuffer.size()); } + template bool writeBuffer(const rtl::OStringConcat& rConcat) + { + return writeBuffer(rtl::Concat2View(rConcat)); + } + virtual void checkAndEnableStreamEncryption(sal_Int32 nObject) = 0; virtual void disableStreamEncryption() = 0; diff --git a/include/vcl/toolkit/svlbitm.hxx b/include/vcl/toolkit/svlbitm.hxx index 14ddf1961a93..bc8fa5488d2e 100644 --- a/include/vcl/toolkit/svlbitm.hxx +++ b/include/vcl/toolkit/svlbitm.hxx @@ -93,8 +93,7 @@ public: } virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, - vcl::RenderContext& rRenderContext, - const SvViewDataEntry* pView, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, const SvTreeListEntry& rEntry) override; virtual std::unique_ptr Clone(SvLBoxItem const * pSource) const override; @@ -112,10 +111,8 @@ public: virtual SvLBoxItemType GetType() const override; virtual void InitViewData(SvTreeListBox& rView, SvTreeListEntry& rEntry, SvViewDataItem* pViewData = nullptr) override; - virtual void Paint(const Point& rPos, - SvTreeListBox& rOutDev, - vcl::RenderContext& rRenderContext, - const SvViewDataEntry* pView, + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, const SvTreeListEntry& rEntry) override; virtual std::unique_ptr Clone(SvLBoxItem const * pSource) const override; diff --git a/include/vcl/toolkit/treelistbox.hxx b/include/vcl/toolkit/treelistbox.hxx index f85979c31c9b..196412de923e 100644 --- a/include/vcl/toolkit/treelistbox.hxx +++ b/include/vcl/toolkit/treelistbox.hxx @@ -134,7 +134,10 @@ public: void Enable(bool bEnabled) { mbDisabled = !bEnabled; } bool isEnable() const { return !mbDisabled; } - virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) = 0; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, + const SvTreeListEntry& rEntry) + = 0; virtual void InitViewData(SvTreeListBox& rView, SvTreeListEntry& rEntry, // If != 0: this Pointer must be used! diff --git a/include/xmloff/SoundReference.hxx b/include/xmloff/SoundReference.hxx index 3bd673ecbb98..b508ed5fbac2 100644 --- a/include/xmloff/SoundReference.hxx +++ b/include/xmloff/SoundReference.hxx @@ -1,8 +1,6 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/jvmaccess/source/classpath.cxx b/jvmaccess/source/classpath.cxx index bb0b16bc0220..b4c6331e6113 100644 --- a/jvmaccess/source/classpath.cxx +++ b/jvmaccess/source/classpath.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -79,7 +80,21 @@ jobjectArray jvmaccess::ClassPath::translateToUrls( } css::uno::Reference< css::uri::XUriReference > uriRef( css::uri::UriReferenceFactory::create(context)->parse(url)); - if (!uriRef.is() || !uriRef->getScheme().equalsIgnoreAsciiCase("file")) + bool bLocal = uriRef.is() && uriRef->getScheme().equalsIgnoreAsciiCase("file"); + if (bLocal && uriRef->hasAuthority()) + { + OUString aAuthority(uriRef->getAuthority()); + bLocal = aAuthority.isEmpty() || aAuthority.equalsIgnoreAsciiCase("localhost"); + } + if (bLocal) + { + // Java reads a path that starts with two separators as a network share name. + OUString aPath(rtl::Uri::decode(uriRef->getPath(), rtl_UriDecodeWithCharset, + RTL_TEXTENCODING_UTF8)); + bLocal = aPath.getLength() >= 2 && aPath[0] == '/' && aPath[1] != '/' + && aPath[1] != '\\'; + } + if (!bLocal) { throw css::lang::IllegalArgumentException( "non-local Java class path entry: " + url, diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx index 875bdd308a27..be670f0bd27f 100644 --- a/l10ntools/source/xmlparse.cxx +++ b/l10ntools/source/xmlparse.cxx @@ -888,8 +888,13 @@ bool SimpleXMLParser::Execute( const OString &rFileName, XMLFile* pXMLFile ) if (!result) { m_aErrorInformation.m_eCode = XML_GetErrorCode( m_aParser ); +#if (XML_MAJOR_VERSION > 2 || (XML_MAJOR_VERSION == 2 && XML_MINOR_VERSION >= 9)) + m_aErrorInformation.m_nLine = XML_GetCurrentLineNumber64( m_aParser ); + m_aErrorInformation.m_nColumn = XML_GetCurrentColumnNumber64( m_aParser ); +#else m_aErrorInformation.m_nLine = XML_GetErrorLineNumber( m_aParser ); m_aErrorInformation.m_nColumn = XML_GetErrorColumnNumber( m_aParser ); +#endif m_aErrorInformation.m_sMessage = "ERROR: "_ostr; if ( !pXMLFile->GetName().isEmpty()) diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index b9c8e3cf7704..24b6826495e0 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1720,7 +1720,7 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo) pLOEvent->m_nPaintTileX = nRow; pLOEvent->m_nPaintTileY = nColumn; pLOEvent->m_fPaintTileZoom = priv->m_fZoom; - pLOEvent->m_pTileBuffer = &*priv->m_pTileBuffer; + pLOEvent->m_pTileBuffer = priv->m_pTileBuffer.get(); GTask* task = g_task_new(pDocView, nullptr, paintTileCallback, pLOEvent); g_task_set_task_data(task, pLOEvent, LOEvent::destroy); @@ -2482,7 +2482,7 @@ paintTileInThread (gpointer data) gint nTileSizePixelsScaled = nTileSizePixels * nScaleFactor; // check if "source" tile buffer is different from "current" tile buffer - if (pLOEvent->m_pTileBuffer != &*priv->m_pTileBuffer) + if (pLOEvent->m_pTileBuffer != priv->m_pTileBuffer.get()) { pLOEvent->m_pTileBuffer = nullptr; g_task_return_new_error(task, @@ -2533,7 +2533,7 @@ paintTileInThread (gpointer data) // requests has passed the previous check at start of this function, and has // rendered the tile already. We want to stop such rendered tiles from being // stored in new tile buffer. - if (pLOEvent->m_pTileBuffer != &*priv->m_pTileBuffer) + if (pLOEvent->m_pTileBuffer != priv->m_pTileBuffer.get()) { pLOEvent->m_pTileBuffer = nullptr; g_task_return_new_error(task, diff --git a/offapi/com/sun/star/chart/CorrelationCircleDiagram.idl b/offapi/com/sun/star/chart/CorrelationCircleDiagram.idl index 875268c26547..264f6e988b0a 100644 --- a/offapi/com/sun/star/chart/CorrelationCircleDiagram.idl +++ b/offapi/com/sun/star/chart/CorrelationCircleDiagram.idl @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/offapi/com/sun/star/configuration/InstallationIncompleteException.idl b/offapi/com/sun/star/configuration/InstallationIncompleteException.idl index 9e79a641e54b..c8dfc84d5f50 100644 --- a/offapi/com/sun/star/configuration/InstallationIncompleteException.idl +++ b/offapi/com/sun/star/configuration/InstallationIncompleteException.idl @@ -22,7 +22,7 @@ /** is thrown when creating a configuration provider fails because - the user's installation for the is missing or incomplete + the user's installation for is missing or incomplete */ published exception InstallationIncompleteException: com::sun::star::configuration::CannotLoadConfigurationException { diff --git a/offapi/com/sun/star/presentation/XSoundReference.idl b/offapi/com/sun/star/presentation/XSoundReference.idl index fd9644cf2221..9e7513197930 100644 --- a/offapi/com/sun/star/presentation/XSoundReference.idl +++ b/offapi/com/sun/star/presentation/XSoundReference.idl @@ -1,8 +1,6 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/oox/inc/drawingml/textbodycontext.hxx b/oox/inc/drawingml/textbodycontext.hxx index debed75bccb6..33f35978ed95 100644 --- a/oox/inc/drawingml/textbodycontext.hxx +++ b/oox/inc/drawingml/textbodycontext.hxx @@ -20,9 +20,8 @@ #ifndef INCLUDED_OOX_DRAWINGML_TEXTBODYCONTEXT_HXX #define INCLUDED_OOX_DRAWINGML_TEXTBODYCONTEXT_HXX -#include - #include +#include #include #include @@ -39,7 +38,7 @@ public: private: TextBody& mrTextBody; ShapePtr mpShapePtr; - uint16_t mListNumberingMask; + ListNumberingState maListNumberingState; }; // CT_RegularTextRun diff --git a/oox/inc/drawingml/textparagraphproperties.hxx b/oox/inc/drawingml/textparagraphproperties.hxx index c233fda17b47..744cb91a05f2 100644 --- a/oox/inc/drawingml/textparagraphproperties.hxx +++ b/oox/inc/drawingml/textparagraphproperties.hxx @@ -82,6 +82,7 @@ public: sal_Int16 getLevel( ) const { return mnLevel; } PropertyMap& getTextParagraphPropertyMap() { return maTextParagraphPropertyMap; } BulletList& getBulletList() { return maBulletList; } + const BulletList& getBulletList() const { return maBulletList; } TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; } const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; } diff --git a/oox/inc/drawingml/textparagraphpropertiescontext.hxx b/oox/inc/drawingml/textparagraphpropertiescontext.hxx index 6a002451e49b..e2184060d5fd 100644 --- a/oox/inc/drawingml/textparagraphpropertiescontext.hxx +++ b/oox/inc/drawingml/textparagraphpropertiescontext.hxx @@ -20,41 +20,60 @@ #ifndef INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX #define INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX +#include #include -#include #include +#include #include #include namespace oox::drawingml { +// Numbered list state of a text body, shared by its paragraphs +struct ListNumberingState +{ + explicit ListNumberingState(const TextListStyle& rListStyle) + : mrListStyle(rListStyle) + { + } + + // Numbering type, prefix, suffix and start value of a numbered paragraph + struct Num + { + css::uno::Any maType, maPrefix, maSuffix, maStartAt; + bool operator==(const Num&) const = default; + }; + + // Numbering of the last numbered paragraph at each level, empty if we're not in a list + // there (n=0 is what pptx calls level 1) + std::array maLastNum; + // a:lstStyle of the text body: a paragraph without a bullet of its own takes it from there + const TextListStyle& mrListStyle; + + // A paragraph at nLevel with rBullet as its own bullet; returns true if its numbering restarts + bool markParagraph(int nLevel, const BulletList& rBullet); +}; + class TextParagraphPropertiesContext final : public ::oox::core::ContextHandler2 { public: TextParagraphPropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, const ::oox::AttributeList& rAttributes, TextParagraphProperties& rTextParagraphProperties, - uint16_t* pListNumberingMask = nullptr); + ListNumberingState* pListNumberingState = nullptr); virtual ~TextParagraphPropertiesContext() override; virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; private: - // Returns True iff we're tracking numbered lists, and we were not already in a numbered list at this level - bool markListNumbered(); - void markListUnnumbered(); - TextParagraphProperties& mrTextParagraphProperties; BulletList& mrBulletList; std::vector< css::style::TabStop > maTabList; std::shared_ptr< BlipFillProperties > mxBlipProps; - // A pointer to an integer mask where we track the list status - // If bit 'n' is 1 then we're in a numbered list at that level - // (n=0 is what pptx calls level 1) - uint16_t* mpListNumberingMask; - bool mbHaveNum; + // Where we track the list status, if we do + ListNumberingState* mpListNumberingState; }; } diff --git a/oox/qa/unit/data/tdf149918_pie_textarea.pptx b/oox/qa/unit/data/tdf149918_pie_textarea.pptx new file mode 100644 index 000000000000..5f60e7c01cc8 Binary files /dev/null and b/oox/qa/unit/data/tdf149918_pie_textarea.pptx differ diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index e1bd0654923a..add7583d9ebc 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -1145,6 +1145,26 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf170095SoftEdge3D) // - Actual : 882 CPPUNIT_ASSERT_EQUAL(static_cast(0), nSoftEdgeRad); } + +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testPieTextArea) +{ + // OOXMl presetShapeDefinitions.xml has an error in text area of shape "Pie" (as of Sept 2026). + // To be compatible with PowerPoint, we immediately use a corrected version of that file without + // waiting for a fix by ISO. + loadFromFile(u"tdf149918_pie_textarea.pptx"); + uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + auto xShape = xDrawPage->getByIndex(0).query(); + auto& rSdrCustomShape( + static_cast(*SdrObject::getSdrObjectFromXShape(xShape))); + tools::Rectangle aTextBound; + CPPUNIT_ASSERT(rSdrCustomShape.GetTextBounds(aTextBound)); + // The text frame is inscribed in the ellipse at 45deg. Without the fix in place, it was the + // whole shape, 12000x8000@(1999,1998). + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(3756, 3169, 12241, 8826), aTextBound); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/colorchoicecontext.cxx b/oox/source/drawingml/colorchoicecontext.cxx index 3122d7917f4f..91697eb5f204 100644 --- a/oox/source/drawingml/colorchoicecontext.cxx +++ b/oox/source/drawingml/colorchoicecontext.cxx @@ -249,7 +249,7 @@ void ColorValueContext::onStartElement( const AttributeList& rAttribs ) else nValue = rAttribs.getInteger(XML_val, 0); - mpComplexColor->addTransformation({eType, sal_Int16(nValue / 10)}); + mpComplexColor->addTransformation({eType, nValue / 10}); } return nullptr; diff --git a/oox/source/drawingml/customshapes/oox-drawingml-cs-presets b/oox/source/drawingml/customshapes/oox-drawingml-cs-presets index 8c6fedab2490..402e60573c70 100644 --- a/oox/source/drawingml/customshapes/oox-drawingml-cs-presets +++ b/oox/source/drawingml/customshapes/oox-drawingml-cs-presets @@ -2305,7 +2305,7 @@ false MirroredY false Path -([]com.sun.star.beans.PropertyValue) { { Name = "Coordinates", Handle = (long) 0, Value = (any) { ([]com.sun.star.drawing.EnhancedCustomShapeParameterPair) { { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 29 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 30 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "GluePoints", Handle = (long) 0, Value = (any) { ([]com.sun.star.drawing.EnhancedCustomShapeParameterPair) { { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "GluePointLeavingDirections", Handle = (long) 0, Value = (any) { ([]long) { { Dir = (long) 2 }, { Dir = (long) 4 }, { Dir = (long) 1 }, { Dir = (long) 3 } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "Segments", Handle = (long) 0, Value = (any) { ([]com.sun.star.drawing.EnhancedCustomShapeSegment) { { Command = (short) 1, Count = (short) 1 }, { Command = (short) 17, Count = (short) 1 }, { Command = (short) 2, Count = (short) 1 }, { Command = (short) 4, Count = (short) 0 }, { Command = (short) 5, Count = (short) 0 } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "TextFrames", Handle = (long) 0, Value = (any) { ([]com.sun.star.drawing.EnhancedCustomShapeTextFrame) { { TopLeft = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 23 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 24 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 25 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 26 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } +([]com.sun.star.beans.PropertyValue) { { Name = "Coordinates", Handle = (long) 0, Value = (any) { ([]com.sun.star.drawing.EnhancedCustomShapeParameterPair) { { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 29 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 30 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "GluePoints", Handle = (long) 0, Value = (any) { ([]com.sun.star.drawing.EnhancedCustomShapeParameterPair) { { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "GluePointLeavingDirections", Handle = (long) 0, Value = (any) { ([]long) { { Dir = (long) 2 }, { Dir = (long) 4 }, { Dir = (long) 1 }, { Dir = (long) 3 } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "Segments", Handle = (long) 0, Value = (any) { ([]com.sun.star.drawing.EnhancedCustomShapeSegment) { { Command = (short) 1, Count = (short) 1 }, { Command = (short) 17, Count = (short) 1 }, { Command = (short) 2, Count = (short) 1 }, { Command = (short) 4, Count = (short) 0 }, { Command = (short) 5, Count = (short) 0 } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "TextFrames", Handle = (long) 0, Value = (any) { ([]com.sun.star.drawing.EnhancedCustomShapeTextFrame) { { TopLeft = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 23 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 25 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 24 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 26 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } Type "ooxml-non-primitive" ViewBox diff --git a/oox/source/drawingml/customshapes/presetShapeDefinitions.xml b/oox/source/drawingml/customshapes/presetShapeDefinitions.xml index 7123e27ccdd6..cbd2da090861 100644 --- a/oox/source/drawingml/customshapes/presetShapeDefinitions.xml +++ b/oox/source/drawingml/customshapes/presetShapeDefinitions.xml @@ -14201,7 +14201,7 @@ - + diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx index ab4f4d69e1df..ca0c77d9d4cc 100644 --- a/oox/source/drawingml/table/tableproperties.cxx +++ b/oox/source/drawingml/table/tableproperties.cxx @@ -92,7 +92,7 @@ const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilt TableStyle* pTableStyle = nullptr; if ( mpTableStyle ) - pTableStyle = &*mpTableStyle; + pTableStyle = mpTableStyle.get(); else if ( !getStyleId().isEmpty() && rBase.getTableStyles() ) { const std::vector< TableStyle >& rTableStyles( rBase.getTableStyles()->getTableStyles() ); diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx index 4566dfb7cbdb..0452d8ba2a04 100644 --- a/oox/source/drawingml/textbodycontext.cxx +++ b/oox/source/drawingml/textbodycontext.cxx @@ -49,25 +49,35 @@ namespace { class TextParagraphContext : public ContextHandler2 { public: - TextParagraphContext( ContextHandler2Helper const & rParent, TextParagraph& rPara, uint16_t& rListNumberingMask ); + TextParagraphContext( ContextHandler2Helper const & rParent, TextParagraph& rPara, ListNumberingState& rListNumberingState ); virtual ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; + virtual void onEndElement() override; protected: TextParagraph& mrParagraph; - uint16_t& mrListNumberingMask; + ListNumberingState& mrListNumberingState; }; } -TextParagraphContext::TextParagraphContext( ContextHandler2Helper const & rParent, TextParagraph& rPara, uint16_t& rListNumberingMask ) +TextParagraphContext::TextParagraphContext( ContextHandler2Helper const & rParent, TextParagraph& rPara, ListNumberingState& rListNumberingState ) : ContextHandler2( rParent ) , mrParagraph( rPara ) -, mrListNumberingMask( rListNumberingMask ) +, mrListNumberingState( rListNumberingState ) { mbEnableTrimSpace = false; } +void TextParagraphContext::onEndElement() +{ + // A paragraph without a:pPr is at level 0, with the bullet of the list style + TextParagraphProperties& rProps = mrParagraph.getProperties(); + if (isCurrentElement(A_TOKEN(p)) && !mrParagraph.hasProperties() + && mrListNumberingState.markParagraph(0, rProps.getBulletList())) + rProps.setRestartNumbering(true); +} + ContextHandlerRef TextParagraphContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { // EG_TextRun @@ -96,7 +106,7 @@ ContextHandlerRef TextParagraphContext::onCreateContext( sal_Int32 aElementToken case A_TOKEN( pPr ): case W_TOKEN( pPr ): mrParagraph.setHasProperties(); - return new TextParagraphPropertiesContext( *this, rAttribs, mrParagraph.getProperties(), &mrListNumberingMask ); + return new TextParagraphPropertiesContext( *this, rAttribs, mrParagraph.getProperties(), &mrListNumberingState ); case A_TOKEN( endParaRPr ): return new TextCharacterPropertiesContext( *this, rAttribs, mrParagraph.getEndProperties() ); case W_TOKEN( sdt ): @@ -180,7 +190,7 @@ ContextHandlerRef RegularTextRunContext::onCreateContext( sal_Int32 aElementToke TextBodyContext::TextBodyContext( ContextHandler2Helper const & rParent, TextBody& rTextBody ) : ContextHandler2( rParent ) , mrTextBody( rTextBody ) -, mListNumberingMask(0) +, maListNumberingState( rTextBody.getTextListStyle() ) { } @@ -205,7 +215,7 @@ ContextHandlerRef TextBodyContext::onCreateContext( sal_Int32 aElementToken, con return new TextListStyleContext( *this, mrTextBody.getTextListStyle() ); case A_TOKEN( p ): // CT_TextParagraph case W_TOKEN( p ): - return new TextParagraphContext( *this, mrTextBody.addParagraph(), mListNumberingMask ); + return new TextParagraphContext( *this, mrTextBody.addParagraph(), maListNumberingState ); case W_TOKEN( sdt ): case W_TOKEN( sdtContent ): return this; diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index a20d97debb89..c6d58d759c13 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -204,7 +204,8 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper cons // Push defaults mrTextBodyProp.maPropertyMap.setProperty( PROP_TextAutoGrowHeight, false); - mrTextBodyProp.maPropertyMap.setProperty( PROP_TextFitToSize, drawing::TextFitToSizeType_NONE); + if (!mrTextBodyProp.maPropertyMap.hasProperty(PROP_TextFitToSize)) + mrTextBodyProp.maPropertyMap.setProperty(PROP_TextFitToSize, TextFitToSizeType_NONE); } ContextHandlerRef TextBodyPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) @@ -232,6 +233,8 @@ ContextHandlerRef TextBodyPropertiesContext::onCreateContext( sal_Int32 aElement // EG_TextAutofit case A_TOKEN( noAutofit ): mrTextBodyProp.maPropertyMap.setProperty( PROP_TextAutoGrowHeight, false); // CT_TextNoAutofit + mrTextBodyProp.maPropertyMap.setProperty(PROP_TextFitToSize, + TextFitToSizeType_NONE); break; case A_TOKEN( normAutofit ): // CT_TextNormalAutofit { @@ -249,6 +252,8 @@ ContextHandlerRef TextBodyPropertiesContext::onCreateContext( sal_Int32 aElement const sal_Int32 tVert = mrTextBodyProp.moVert.value_or( XML_horz ); if( tVert != XML_vert && tVert != XML_eaVert && tVert != XML_vert270 && tVert != XML_mongolianVert ) mrTextBodyProp.maPropertyMap.setProperty( PROP_TextAutoGrowHeight, true); + mrTextBodyProp.maPropertyMap.setProperty(PROP_TextFitToSize, + TextFitToSizeType_NONE); } break; diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx index 3f0a47488784..5c2af554aa51 100644 --- a/oox/source/drawingml/textparagraphpropertiescontext.cxx +++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx @@ -19,7 +19,10 @@ #include +#include + #include +#include #include #include #include @@ -77,12 +80,11 @@ double lclGetGraphicAspectRatio( const Reference< XGraphic >& rxGraphic ) TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler2Helper const & rParent, const AttributeList& rAttribs, TextParagraphProperties& rTextParagraphProperties, - uint16_t* pListNumberingMask) + ListNumberingState* pListNumberingState) : ContextHandler2( rParent ) , mrTextParagraphProperties( rTextParagraphProperties ) , mrBulletList( rTextParagraphProperties.getBulletList() ) -, mpListNumberingMask( pListNumberingMask ) -, mbHaveNum( false ) +, mpListNumberingState( pListNumberingState ) { OUString sValue; @@ -192,8 +194,12 @@ TextParagraphPropertiesContext::~TextParagraphPropertiesContext() mrBulletList.setBulletAspectRatio( lclGetGraphicAspectRatio(mxBlipProps->mxFillGraphic) ); } - if( !mbHaveNum ) - markListUnnumbered(); + // The list is tracked only for a:pPr of a paragraph. Not for a:lvl1pPr etc. of a list + // style: a restart there would be inherited by every paragraph using the style + if (mpListNumberingState + && mpListNumberingState->markParagraph(mrTextParagraphProperties.getLevel(), mrBulletList)) + mrTextParagraphProperties.setRestartNumbering(true); + if( mrBulletList.is() ) rPropertyMap.setProperty( PROP_IsNumbering, true); sal_Int16 nLevel = mrTextParagraphProperties.getLevel(); @@ -204,50 +210,30 @@ TextParagraphPropertiesContext::~TextParagraphPropertiesContext() rPropertyMap.setProperty( PROP_ParaAdjust, *mrTextParagraphProperties.getParaAdjust()); } -bool TextParagraphPropertiesContext::markListNumbered() +bool ListNumberingState::markParagraph(int nLevel, const BulletList& rBullet) { - sal_Int16 nLevel = mrTextParagraphProperties.getLevel(); - - // We only track list state in some situations - if (mpListNumberingMask == nullptr) + const BulletList& rNumBullet + = rBullet.is() ? rBullet : mrListStyle.getListStyle()[nLevel].getBulletList(); + sal_Int16 nType = NumberingType::NUMBER_NONE; + rNumBullet.mnNumberingType >>= nType; + if (nType == NumberingType::NUMBER_NONE || nType == NumberingType::CHAR_SPECIAL + || nType == NumberingType::BITMAP) { + // Lists at our level and deeper end + std::fill(maLastNum.begin() + nLevel, maLastNum.end(), Num()); return false; } - uint16_t nOldMask = *mpListNumberingMask; - // The bit that represents this level (..0001000) - uint16_t nOurBit = static_cast(1) << nLevel; + // Lists at deeper levels end + std::fill(maLastNum.begin() + nLevel + 1, maLastNum.end(), Num()); - uint16_t nTmp = nOldMask; - // Clears all bits at our level and lower (..0000xxx) - nTmp &= nOurBit - 1; - // and put our bit in (..0001xxx) - nTmp |= nOurBit; - - *mpListNumberingMask = nTmp; - - return (nOldMask & nOurBit) == 0; -} - -void TextParagraphPropertiesContext::markListUnnumbered() -{ - sal_Int16 nLevel = mrTextParagraphProperties.getLevel(); - - // We only track list state in some situations - if (mpListNumberingMask == nullptr) - { - return; - } - - uint16_t nOldMask = *mpListNumberingMask; - // The bit that represents this level (..0001000) - uint16_t nOurBit = static_cast(1) << nLevel; - - uint16_t nTmp = nOldMask; - // Clears all bits at our level and lower (..0000xxx) - nTmp &= nOurBit - 1; - - *mpListNumberingMask = nTmp; + // A list continues while its numbering stays the same at this level, + // a missing startAt being the same as startAt="1" + Num aNum{ rNumBullet.mnNumberingType, rNumBullet.msNumberingPrefix, + rNumBullet.msNumberingSuffix, rNumBullet.mnStartAt }; + bool bRestart = maLastNum[nLevel] != aNum; + maLastNum[nLevel] = aNum; + return bRestart; } ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) @@ -292,16 +278,9 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl break; case A_TOKEN( buAutoNum ): // CT_TextAutonumberBullet { - bool bStartingNumList = markListNumbered(); - mbHaveNum = true; - try { sal_Int32 nType = rAttribs.getToken( XML_type, 0 ); sal_Int32 nStartAt = rAttribs.getInteger( XML_startAt, -1 ); - if( nStartAt >= 0 || bStartingNumList ) - { - mrTextParagraphProperties.setRestartNumbering(true); - } if( nStartAt > 32767 ) { diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx index 25b3129c8d79..b8070a4dead6 100644 --- a/oox/source/drawingml/transform2dcontext.cxx +++ b/oox/source/drawingml/transform2dcontext.cxx @@ -70,6 +70,7 @@ bool ConstructPresetTextRectangle(Shape& rShape, awt::Rectangle& rRect) switch (nType) { case XML_ellipse: + case XML_pie: // The preset text rectangle touches the perimeter of the ellipse at 45deg. rRect.X = rShape.getPosition().X + rShape.getSize().Width * ((1.0 - M_SQRT1_2) / 2.0); rRect.Y = rShape.getPosition().Y + rShape.getSize().Height * ((1.0 - M_SQRT1_2) / 2.0); @@ -124,11 +125,9 @@ bool ConstructPresetTextRectangle(Shape& rShape, awt::Rectangle& rRect) rRect.Height = rShape.getSize().Height; return true; } - case XML_pie: case XML_rect: case XML_wedgeRectCallout: { - // When tdf#149918 is fixed, pie will need its own case rRect.X = rShape.getPosition().X; rRect.Y = rShape.getPosition().Y; rRect.Width = rShape.getSize().Width; diff --git a/oox/source/export/ThemeExport.cxx b/oox/source/export/ThemeExport.cxx index e22d6c9f2caf..6a96eee51b24 100644 --- a/oox/source/export/ThemeExport.cxx +++ b/oox/source/export/ThemeExport.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -30,10 +31,19 @@ namespace void writeRelativeRectangle(sax_fastparser::FSHelperPtr pFS, sal_Int32 nToken, model::RelativeRectangle const& rRelativeRectangle) { - pFS->singleElementNS(XML_a, nToken, XML_l, OString::number(rRelativeRectangle.mnLeft), XML_t, - OString::number(rRelativeRectangle.mnTop), XML_r, - OString::number(rRelativeRectangle.mnRight), XML_b, - OString::number(rRelativeRectangle.mnBottom)); + // Only write non-0 offsets, 0 is the default in CT_RelativeRect + pFS->singleElementNS(XML_a, nToken, XML_l, + sax_fastparser::UseIf(OString::number(rRelativeRectangle.mnLeft), + rRelativeRectangle.mnLeft != 0), + XML_t, + sax_fastparser::UseIf(OString::number(rRelativeRectangle.mnTop), + rRelativeRectangle.mnTop != 0), + XML_r, + sax_fastparser::UseIf(OString::number(rRelativeRectangle.mnRight), + rRelativeRectangle.mnRight != 0), + XML_b, + sax_fastparser::UseIf(OString::number(rRelativeRectangle.mnBottom), + rRelativeRectangle.mnBottom != 0)); } } // end anonymous namespace @@ -98,8 +108,12 @@ void fillAttrList(rtl::Reference const& pAttr if (!rThemeFont.maPanose.isEmpty()) pAttrList->add(XML_panose, rThemeFont.maPanose); - pAttrList->add(XML_pitchFamily, OString::number(rThemeFont.getPitchFamily())); - pAttrList->add(XML_charset, OString::number(rThemeFont.maCharset)); + // CT_TextFont gives pitchFamily a default of 0 and + // charset a default of 1 (=WINDOWS_CHARSET_DEFAULT), skip writing the defaults + if (rThemeFont.getPitchFamily() != 0) + pAttrList->add(XML_pitchFamily, OString::number(rThemeFont.getPitchFamily())); + if (rThemeFont.maCharset != WINDOWS_CHARSET_DEFAULT) + pAttrList->add(XML_charset, OString::number(rThemeFont.maCharset)); } } // end anonymous ns @@ -387,11 +401,16 @@ void ThemeExport::writeGradientFill(model::GradientFill const& rGradientFill) if (!sPathType.isEmpty()) { mpFS->startElementNS(XML_a, XML_path, XML_path, sPathType); + // The fillToRect element is always written, because a missing one defaults to offsets + // of 50%, not 0 ([MS-OI29500] Part 1 Section 20.1.8) writeRelativeRectangle(mpFS, XML_fillToRect, rGradientFill.maFillToRectangle); mpFS->endElementNS(XML_a, XML_path); } } - writeRelativeRectangle(mpFS, XML_tileRect, rGradientFill.maTileRectangle); + // A missing tileRect means offsets of 0 ([MS-OI29500] Part 1 Section 20.1.8), + // so an all-zero one can be omitted + if (!rGradientFill.maTileRectangle.isZero()) + writeRelativeRectangle(mpFS, XML_tileRect, rGradientFill.maTileRectangle); mpFS->endElementNS(XML_a, XML_gradFill); } @@ -646,7 +665,9 @@ void ThemeExport::writeBlipFill(model::BlipFill const& rBlipFill) writeBlip(rBlipFill); - writeRelativeRectangle(mpFS, XML_srcRect, rBlipFill.maClipRectangle); + // A missing srcRect means no cropping, so an all-zero one can be omitted + if (!rBlipFill.maClipRectangle.isZero()) + writeRelativeRectangle(mpFS, XML_srcRect, rBlipFill.maClipRectangle); if (rBlipFill.meMode == model::BitmapMode::Tile) { @@ -662,9 +683,18 @@ void ThemeExport::writeBlipFill(model::BlipFill const& rBlipFill) } else if (rBlipFill.meMode == model::BitmapMode::Stretch) { - mpFS->startElementNS(XML_a, XML_stretch); - writeRelativeRectangle(mpFS, XML_fillRect, rBlipFill.maFillRectangle); - mpFS->endElementNS(XML_a, XML_stretch); + // A missing fillRect means offsets of 0 ([MS-OI29500] Part 1 Section 20.1.8), + // so an all-zero one can be omitted + if (rBlipFill.maFillRectangle.isZero()) + { + mpFS->singleElementNS(XML_a, XML_stretch); + } + else + { + mpFS->startElementNS(XML_a, XML_stretch); + writeRelativeRectangle(mpFS, XML_fillRect, rBlipFill.maFillRectangle); + mpFS->endElementNS(XML_a, XML_stretch); + } } mpFS->endElementNS(XML_a, XML_blipFill); diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index c23878a9df91..998c38fbb79a 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -113,6 +113,8 @@ #include #include +#include +#include #include #include @@ -3222,18 +3224,41 @@ void ChartExport::exportHatch( const Reference< XPropertySet >& xPropSet ) if (!xPropSet.is()) return; - if (GetProperty(xPropSet, u"FillHatchName"_ustr)) + css::drawing::Hatch aHatch; + bool bHatchFound = false; + + if (OUString aHatchName; GetProperty(xPropSet, u"FillHatchName"_ustr) && (mAny >>= aHatchName) + && !aHatchName.isEmpty()) { - OUString aHatchName; - mAny >>= aHatchName; uno::Reference< lang::XMultiServiceFactory > xFact( getModel(), uno::UNO_QUERY ); uno::Reference< container::XNameAccess > xHatchTable( xFact->createInstance(u"com.sun.star.drawing.HatchTable"_ustr), uno::UNO_QUERY ); - uno::Any rValue = xHatchTable->getByName(aHatchName); - css::drawing::Hatch aHatch; - rValue >>= aHatch; - WritePattFill(xPropSet, aHatch); + if (xHatchTable.is() && xHatchTable->hasByName(aHatchName)) + bHatchFound = (xHatchTable->getByName(aHatchName) >>= aHatch); } + // tdf#116148: the fill style is a hatch, but there is no hatch to name: the + // drawing layer paints such a series with the item pool's default hatch. + // OOXML has no matching default - leaving the fill out makes PowerPoint + // apply its own, which is solid - so the effective hatch has to be written + // out explicitly. + if (!bHatchFound && GetProperty(xPropSet, u"FillHatch"_ustr)) + { + // A property set that resolves the hatch itself knows better than the + // default below. chart2 does not expose the struct today, see the + // commented out PROP_FILL_HATCH in chart2/source/inc/FillProperties.hxx. + bHatchFound = (mAny >>= aHatch); + } + + if (!bHatchFound) + { + // Same default the item pool hands out, see SdrItemPool in svx/source/svdraw/svdattr.cxx. + const XHatch aDefaultHatch{ COL_DEFAULT_SHAPE_STROKE }; + aHatch.Style = aDefaultHatch.GetHatchStyle(); + aHatch.Color = sal_Int32(aDefaultHatch.GetColor()); + aHatch.Distance = aDefaultHatch.GetDistance(); + aHatch.Angle = aDefaultHatch.GetAngle().get(); + } + WritePattFill(xPropSet, aHatch); } void ChartExport::exportBitmapFill( const Reference< XPropertySet >& xPropSet ) diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 91b2ae13404f..30a4eb877eb7 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -4547,6 +4547,33 @@ void DrawingML::WriteBodyProps(const css::uno::Reference< css::uno::XInterface > mpFS->endElementNS((nXmlNamespace ? nXmlNamespace : XML_a), XML_bodyPr); } +void DrawingML::WriteTextlessParagraph(const Reference& rXIface) +{ + Reference xParagraph; + if (auto xAccess = rXIface.query()) + { + if (auto xParagraphs = xAccess->createEnumeration(); + xParagraphs && xParagraphs->hasMoreElements()) + xParagraph = xParagraphs->nextElement().query(); + } + + if (!xParagraph) + { + mpFS->singleElementNS(XML_a, XML_p); + return; + } + + // tdf#144092: with no run to ask, the run properties come from the shape's propset + auto xShapeProps = rXIface.query(); + assert(xShapeProps); + + mpFS->startElementNS(XML_a, XML_p); + WriteParagraphProperties(xParagraph, -1, XML_pPr); + WriteRunInput aInput{ .xShapePropSet = xShapeProps }; + WriteRunProperties(xShapeProps, XML_endParaRPr, aInput); + mpFS->endElementNS(XML_a, XML_p); +} + void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bool bText, sal_Int32 nXmlNamespace, bool bWritePropertiesAsLstStyles) { @@ -4683,27 +4710,9 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo sal_Int32 nCharHeight = -1; bool bFirstParagraph = true; - // tdf#144092 For shapes without text: Export run properties (into - // endParaRPr) from the shape's propset instead of the paragraph's. - if(xXText->getString().isEmpty() && enumeration->hasMoreElements()) + if (xXText->getString().isEmpty()) { - Any aAny (enumeration->nextElement()); - Reference xParagraph; - if( aAny >>= xParagraph ) - { - mpFS->startElementNS(XML_a, XML_p); - WriteParagraphProperties(xParagraph, nCharHeight, XML_pPr); - - WriteRunInput aInput; - aInput.xShapePropSet = rXPropSet; - aInput.bOverridingCharHeight = bOverridingCharHeight; - aInput.nCharHeight = nCharHeight; - WriteRunProperties(rXPropSet, XML_endParaRPr, aInput); - bOverridingCharHeight = aInput.bOverridingCharHeight; - nCharHeight = aInput.nCharHeight; - - mpFS->endElementNS(XML_a, XML_p); - } + WriteTextlessParagraph(rXIface); return; } diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index f443344265dc..2f01e3d76930 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -2358,7 +2358,7 @@ ShapeExport& ShapeExport::WriteTextBox( const Reference< XInterface >& xIface, s /*nXmlNamespace=*/0, /*bWritePropertiesAsLstStyles=*/bWritePropertiesAsLstStyles); if (!bText) // A text body holds at least one paragraph, and an empty one says the shape has no text - pFS->singleElementNS(XML_a, XML_p); + WriteTextlessParagraph(xIface); pFS->endElementNS( nXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX || mbUserShapes ? XML_txBody : XML_txbx) ); if (GetDocumentType() == DOCUMENT_DOCX && !mbUserShapes) WriteText( xIface, /*bBodyPr=*/true, /*bText=*/false, /*nXmlNamespace=*/nXmlNamespace ); diff --git a/oox/source/mathml/importutils.cxx b/oox/source/mathml/importutils.cxx index 4f6c243b9970..ca6402875940 100644 --- a/oox/source/mathml/importutils.cxx +++ b/oox/source/mathml/importutils.cxx @@ -312,6 +312,23 @@ void XmlStream::handleUnexpectedTag() skipElementInternal( currentToken(), false ); // otherwise skip the entire element } +std::vector XmlStream::tagAttributesWithin( int nEnclosingToken, int nTagToken, + int nAttributeToken ) const +{ + std::vector aValues; + int nDepth = 0; + for( const Tag& rTag : tags ) + { + if( rTag.token == OPENING( nEnclosingToken )) + ++nDepth; + else if( rTag.token == CLOSING( nEnclosingToken )) + --nDepth; + else if( nDepth > 0 && rTag.token == OPENING( nTagToken )) + aValues.push_back( rTag.attribute( nAttributeToken )); + } + return aValues; +} + void XmlStreamBuilder::appendOpeningTag( int token, const uno::Reference< xml::sax::XFastAttributeList >& attrs ) { tags.emplace_back( OPENING( token ), attrs ); diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx index 0ccb5ba5eec6..b11ef62fb1ac 100644 --- a/reportdesign/inc/RptObject.hxx +++ b/reportdesign/inc/RptObject.hxx @@ -182,7 +182,7 @@ public: virtual SdrObjKind GetObjIdentifier() const override; virtual SdrInventor GetObjInventor() const override; // Clone() should make a complete copy of the object. - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; virtual void initializeOle() override; void initializeChart( const css::uno::Reference< css::frame::XModel>& _xModel); @@ -262,7 +262,7 @@ public: virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override; virtual SdrObjKind GetObjIdentifier() const override; virtual SdrInventor GetObjInventor() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; private: virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override; diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index c451206fd82e..ae9003e61753 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -903,7 +903,7 @@ void OUnoObject::setUnoShape( const uno::Reference< drawing::XShape >& rxUnoShap releaseUnoShape(); } -rtl::Reference OUnoObject::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference OUnoObject::implCloneSdrObject(SdrModel& rTargetModel) const { return new OUnoObject(rTargetModel, *this); } @@ -1116,7 +1116,7 @@ static uno::Reference< chart2::data::XDatabaseDataProvider > lcl_getDataProvider } // Clone() should make a complete copy of the object. -rtl::Reference OOle2Obj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference OOle2Obj::implCloneSdrObject(SdrModel& rTargetModel) const { return new OOle2Obj(rTargetModel, *this); } diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index f6e6cdb90f55..d4cd6fa8b0e0 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -315,11 +315,19 @@ public: public: //XLocator virtual sal_Int32 SAL_CALL getColumnNumber() override { +#if (XML_MAJOR_VERSION > 2 || (XML_MAJOR_VERSION == 2 && XML_MINOR_VERSION >= 9)) + return XML_GetCurrentColumnNumber64( m_pParser->getEntity().pParser ); +#else return XML_GetCurrentColumnNumber( m_pParser->getEntity().pParser ); +#endif } virtual sal_Int32 SAL_CALL getLineNumber() override { +#if (XML_MAJOR_VERSION > 2 || (XML_MAJOR_VERSION == 2 && XML_MINOR_VERSION >= 9)) + return XML_GetCurrentLineNumber64( m_pParser->getEntity().pParser ); +#else return XML_GetCurrentLineNumber( m_pParser->getEntity().pParser ); +#endif } virtual OUString SAL_CALL getPublicId() override { @@ -337,7 +345,11 @@ public: //XLocator } virtual sal_Int64 SAL_CALL getPosition() override { +#if (XML_MAJOR_VERSION > 2 || (XML_MAJOR_VERSION == 2 && XML_MINOR_VERSION >= 9)) + return XML_GetCurrentByteIndex64( m_pParser->getEntity().pParser ); +#else return XML_GetCurrentByteIndex( m_pParser->getEntity().pParser ); +#endif } virtual ::sal_Int64 SAL_CALL getLength() override { diff --git a/sc/CppunitTest_sc_dynamic_array_functions_test.mk b/sc/CppunitTest_sc_dynamic_array_functions_test.mk index 36ea8374aa98..10d3f29c5b05 100644 --- a/sc/CppunitTest_sc_dynamic_array_functions_test.mk +++ b/sc/CppunitTest_sc_dynamic_array_functions_test.mk @@ -1,8 +1,6 @@ # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*- # -# Copyright the LibreOffice contributors. -# -# SPDX-License-Identifier: MPL-2.0 +# This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/CppunitTest_sc_oox_helpers_test.mk b/sc/CppunitTest_sc_oox_helpers_test.mk index 1c2072d6700a..300d395e86e4 100644 --- a/sc/CppunitTest_sc_oox_helpers_test.mk +++ b/sc/CppunitTest_sc_oox_helpers_test.mk @@ -1,8 +1,6 @@ # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*- # -# Copyright the LibreOffice contributors. -# -# SPDX-License-Identifier: MPL-2.0 +# This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/inc/TableContentCopier.hxx b/sc/inc/TableContentCopier.hxx index 19d3cf811ede..7f6f324d7d6d 100644 --- a/sc/inc/TableContentCopier.hxx +++ b/sc/inc/TableContentCopier.hxx @@ -36,8 +36,7 @@ public: void performCopy(const ScMarkData* pOnlyMarked, ScCloneFlags nCloneFlags, SCTAB nPreviousSourceTabNo = -1); - void updateReferencesAfterTabInsertion(RefUpdateInsertTabContext& rContext, - SCTAB nPreviousSourceTabNo); + void updateReferencesAfterTabInsertion(RefUpdateInsertTabContext& rContext); }; } // namespace sc diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 5ffa042b0a71..ff85dd634e88 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -600,7 +600,6 @@ public: bool GetDataEntries( SCROW nRow, std::set& rStrings) const; void UpdateInsertTabAbs(SCTAB nNewPos); - void AdjustRelativeTabRefs(SCTAB nOldTab, SCTAB nNewTab, sc::TargetTabState eMode); bool TestTabRefAbs(SCTAB nTable) const; bool GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& rData) const; diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 28addd72f2f4..1cb95085c8e1 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -362,7 +362,7 @@ private: bool ParseDoubleReference( const OUString& rSymbol, const OUString* pErrRef = nullptr ); bool ParsePredetectedReference( const OUString& rSymbol ); bool ParsePredetectedErrRefReference( const OUString& rName, const OUString* pErrRef ); - bool ParseMacro( const OUString& ); + bool ParseMacro( const OUString&, bool bParenFollows ); bool ParseNamedRange( const OUString&, bool onlyCheck = false ); bool ParseLocalName( const OUString& ); bool ParseExternalNamedRange( const OUString& rSymbol, bool& rbInvalidExternalNameRange ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index c58dc8033a74..2e88cc312df0 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -962,6 +962,14 @@ public: none. */ SC_DLLPUBLIC bool HasDataProviderMappings() const; + /** True when the document holds a database range that imports from a data source again each + time its refresh delay runs out. */ + bool HasRefreshingDBImport() const; + + /** True when a pivot table takes its data from a database document named by URL rather than + from a registered data source. */ + bool HasDataPilotDatabaseLink() const; + /** True when the document holds anything that fetches content from outside the document and so needs the user to agree before it updates. */ SC_DLLPUBLIC bool HasExternalLinks() const; diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 132775ea3385..306ef9e071e9 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -423,7 +423,7 @@ public: private: - static css::uno::Reference createRowSet( + css::uno::Reference createRowSet( sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand); void updateCache( @@ -436,6 +436,10 @@ public: ScDPCollection(const ScDPCollection& r); ~ScDPCollection(); + /** True when rDBName is the name of a data source registered in the user's configuration. + Any other name is the URL of a database document. */ + static bool IsRegisteredDatabase(const OUString& rDBName); + TranslateId ReloadCache(const ScDPObject* pDPObj, o3tl::sorted_vector& rRefs); bool ReloadGroupsInCache(const ScDPObject* pDPObj, o3tl::sorted_vector& rRefs); SC_DLLPUBLIC bool GetReferenceGroups(const ScDPObject& rDPObj, const ScDPDimensionSaveData** pGroups) const; diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index df9115de5abb..94bfe00c742b 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -326,7 +326,6 @@ public: void UpdateInsertTab( const sc::RefUpdateInsertTabContext& rCxt ); void UpdateInsertTabAbs(SCTAB nTable); - void AdjustRelativeTabRefs(SCTAB nOldTab, SCTAB nNewTab, sc::TargetTabState eMode); void UpdateDeleteTab( const sc::RefUpdateDeleteTabContext& rCxt ); void UpdateMoveTab( const sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo ); bool TestTabRefAbs(SCTAB nTable); diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index ab57077239c7..a659141189bf 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -373,10 +373,6 @@ #define STR_LINKERRORFILE NC_("STR_LINKERRORFILE", "File:") #define STR_LINKERRORTAB NC_("STR_LINKERRORTAB", "Sheet:") #define STR_OVERVIEW NC_("STR_OVERVIEW", "Overview") -#define STR_DOC_INFO NC_("STR_DOC_INFO", "Doc.Information") -#define STR_DOC_PRINTED NC_("STR_DOC_PRINTED", "Printed") -#define STR_BY NC_("STR_BY", "by") -#define STR_ON NC_("STR_ON", "on") #define STR_TRUST_DOCUMENT_WARNING NC_("STR_TRUST_DOCUMENT_WARNING", "Are you sure you trust this document?") #define STR_WEBSERVICE_WITH_LINKS_WARNING NC_("STR_WEBSERVICE_WITH_LINKS_WARNING", "Links to remote locations can be constructed that transmit local data to the remote server.") #define STR_REIMPORT_AFTER_LOAD NC_("STR_REIMPORT_AFTER_LOAD", "This file contains queries. The results of these queries were not saved.\nDo you want these queries to be repeated?") diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 75fcd6cae08f..aac6af83688b 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -25,6 +25,7 @@ #include #include #include +#include #include "global.hxx" #include "shellids.hxx" #include diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 135bcb149083..9fa40f5d1df6 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -398,6 +398,7 @@ public: void SetAnonymousDBData(std::unique_ptr pDBData); ScDBData* GetAnonymousDBData() { return pDBDataNoName.get();} + const ScDBData* GetAnonymousDBData() const { return pDBDataNoName.get(); } const OUString& GetCodeName() const { return aCodeName; } void SetCodeName( const OUString& rNewName ) { aCodeName = rNewName; } @@ -1326,7 +1327,6 @@ private: void FillFormula( const ScFormulaCell* pSrcCell, SCCOL nDestCol, SCROW nDestRow, bool bLast ); void UpdateInsertTabAbs(SCTAB nNewPos); - void AdjustRelativeTabRefs(SCTAB nOldTab, SCTAB nNewTab, sc::TargetTabState eMode); bool GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel, const ScMarkData& rMark) const; bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ) const; diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx index a43a577ac64e..1818bfa4244c 100644 --- a/sc/inc/tokenarray.hxx +++ b/sc/inc/tokenarray.hxx @@ -21,7 +21,7 @@ #include #include -#include "document.hxx" +#include "sheetlimits.hxx" #include "scdllapi.h" #include "types.hxx" #include "calcmacros.hxx" @@ -29,6 +29,8 @@ #include "global.hxx" #include +class ScDocument; + namespace sc { struct RefUpdateContext; @@ -39,13 +41,6 @@ struct RefUpdateResult; struct TokenStringContext; class ColRowReorderMapType; -/** If the target tab was inserted, or an existing tab was used. */ -enum class TargetTabState -{ - Existing, - Inserted, -}; - } struct ScRawToken; @@ -158,15 +153,12 @@ public: */ void AdjustAbsoluteRefs( const ScDocument& rOldDoc, const ScAddress& rOldPos, const ScAddress& rNewPos, bool bCheckCopyArea ); - /** Adjust relative tab references when copying a formula to a new table. - Non-zero relative tab offsets are recalculated so they still resolve - to the original target sheet from the new position. Same-sheet - relative refs (offset 0) are not modified. - If the target tab was newly inserted, the references pointing to - tabs at or after the insertion point are additionally shifted by - one. */ - void AdjustRelativeTabRefs(SCTAB nOldTab, SCTAB nNewTab, - sc::TargetTabState eMode = sc::TargetTabState::Existing); + /** Adjust relative tab references when copying a formula between tabs when + overwriting a tab. Non-zero relative tab offsets are decremented by + input delta value so they still resolve to the original target sheet + from the new position. Same-sheet relative refs with offset 0 are left + unchanged. */ + void AdjustRelativeTabRefs(SCTAB nDelta); /** When copying a sheet-local named expression, move sheet references that point to the originating sheet to point to the new sheet instead. diff --git a/sc/qa/extras/scdatabaserangeobj.cxx b/sc/qa/extras/scdatabaserangeobj.cxx index 4a035847bba8..0c220a866a59 100644 --- a/sc/qa/extras/scdatabaserangeobj.cxx +++ b/sc/qa/extras/scdatabaserangeobj.cxx @@ -51,6 +51,7 @@ public: CPPUNIT_TEST(testTokenIndex); CPPUNIT_TEST(testTotalsRow); CPPUNIT_TEST(testContainsHeader); + CPPUNIT_TEST(testTdf170842_TableStylePropertiesPlainRange); // XCellRangeReferrer CPPUNIT_TEST(testGetReferredCells); diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx index 1b306ef6a887..fd1b8fd9fd97 100644 --- a/sc/qa/extras/scpdfexport.cxx +++ b/sc/qa/extras/scpdfexport.cxx @@ -94,10 +94,31 @@ bool ScPDFExportTest::hasTextInPdf(const char* sText, bool& bFound) const std::size_t nRead = pStream->ReadBytes(pBuffer, nFileSize); if (nRead == nFileSize) { - const std::string haystack(pBuffer, pBuffer + nFileSize); - const std::string needle(sText); - const std::size_t n = haystack.find(needle); - bFound = (n != std::string::npos); + std::string haystack(pBuffer, pBuffer + nFileSize); + // what the writer put in an object stream stands in the file as deflated bytes only + vcl::filter::PDFDocument aDocument; + SvMemoryStream aFile(pBuffer, nFileSize, StreamMode::READ); + if (aDocument.Read(aFile)) + { + for (auto* pObject : aDocument.GetObjects()) + { + auto pType + = dynamic_cast(pObject->Lookup("Type"_ostr)); + if (!pType || pType->GetValue() != "ObjStm") + continue; + vcl::filter::PDFStreamElement* pObjStm = pObject->GetStream(); + CPPUNIT_ASSERT(pObjStm); + SvMemoryStream aDecompressed; + ZCodec aCodec; + aCodec.BeginCompression(); + pObjStm->GetMemory().Seek(0); + aCodec.Decompress(pObjStm->GetMemory(), aDecompressed); + CPPUNIT_ASSERT(aCodec.EndCompression() >= 0); + haystack.append(static_cast(aDecompressed.GetData()), + aDecompressed.GetSize()); + } + } + bFound = haystack.find(std::string(sText)) != std::string::npos; } delete[] pBuffer; @@ -958,11 +979,10 @@ CPPUNIT_TEST_FIXTURE(ScPDFExportTest, testSheetDestinations) // ISO 14289-2 8.8: a sheet's outline item names the sheet, not only the page it starts on OStringBuffer aTypes; std::set aTargets; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); // an outline item, not the document information dictionary, which also has a title - if (!pObject || !pObject->Lookup("Title"_ostr) || !pObject->Lookup("Parent"_ostr)) + if (!pObject->Lookup("Title"_ostr) || !pObject->Lookup("Parent"_ostr)) continue; auto pAction = dynamic_cast(pObject->Lookup("A"_ostr)); CPPUNIT_ASSERT(pAction); @@ -1076,11 +1096,8 @@ CPPUNIT_TEST_FIXTURE(ScPDFExportTest, testPageRangeSkipsSheetStart) int nOutlineItems = 0; std::set aWorksheetPages; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; if (pObject->Lookup("Title"_ostr) && pObject->Lookup("Parent"_ostr)) ++nOutlineItems; auto pType = dynamic_cast(pObject->Lookup("S"_ostr)); @@ -1106,11 +1123,8 @@ CPPUNIT_TEST_FIXTURE(ScPDFExportTest, testDatabaseRangeHeader) CPPUNIT_ASSERT(aDocument.Read(*maTempFile.GetStream(StreamMode::READ))); std::vector aTables; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("S"_ostr)); if (pType && pType->GetValue() == "Table") aTables.push_back(pObject); diff --git a/sc/qa/uitest/calc_dialogs/printDialog.py b/sc/qa/uitest/calc_dialogs/printDialog.py index cd359539cab1..0057ebf52e2f 100644 --- a/sc/qa/uitest/calc_dialogs/printDialog.py +++ b/sc/qa/uitest/calc_dialogs/printDialog.py @@ -7,7 +7,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # from uitest.framework import UITestCase -from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, select_by_text +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, select_by_text, mkPropertyValues class printDialog(UITestCase): def test_printDialog(self): @@ -22,11 +22,11 @@ class printDialog(UITestCase): xPortraiTotalNumberPages = xDialog.getChild("totalnumpages") self.assertEqual(get_state_as_dict(xPortraiTotalNumberPages)["Text"], "/ 2") - xPortraiPageRange = xDialog.getChild("pagerange") - self.assertEqual(get_state_as_dict(xPortraiPageRange)["Text"], "1-2") + xPageRange = xDialog.getChild("pagerange") + self.assertEqual(get_state_as_dict(xPageRange)["Text"], "") - xpageorientationbox = xDialog.getChild("pageorientationbox") - select_by_text(xpageorientationbox, "Landscape") + xPageOrientationBox = xDialog.getChild("pageorientationbox") + select_by_text(xPageOrientationBox, "Landscape") # Without the fix in place, this test would have failed with # Expected: "/ 1" @@ -34,17 +34,19 @@ class printDialog(UITestCase): xLandscapeTotalNumberPages = xDialog.getChild("totalnumpages") self.assertEqual(get_state_as_dict(xLandscapeTotalNumberPages)["Text"], "/ 1") - # Without the fix in place, this test would have failed with - # Expected: "1" - # Actual : "1-2" - xLandscapePageRange = xDialog.getChild("pagerange") - self.assertEqual(get_state_as_dict(xLandscapePageRange)["Text"], "1") + # Page range is empty by default and must not be populated automatically + self.assertEqual(get_state_as_dict(xPageRange)["Text"], "") - # check that when reselecting Portrait, the range is again 1-2 - # Expected: "1-2" - # Actual : "1" - select_by_text(xpageorientationbox, "Portrait") - xPortraitPageRange = xDialog.getChild("pagerange") - self.assertEqual(get_state_as_dict(xPortraitPageRange)["Text"], "1-2") + select_by_text(xPageOrientationBox, "Portrait") + # Page range must remain empty when the number of pages changes. + self.assertEqual(get_state_as_dict(xPageRange)["Text"], "") + + # User enters a page range. + xPageRange.executeAction("TYPE", mkPropertyValues({"TEXT": "2-3"})) + + select_by_text(xPageOrientationBox, "Landscape") + select_by_text(xPageOrientationBox, "Portrait") + + self.assertEqual(get_state_as_dict(xPageRange)["Text"], "2-3") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/correlationCircle.py b/sc/qa/uitest/chart2/correlationCircle.py index 21f44b9ffc8a..9a712eaf0fb5 100644 --- a/sc/qa/uitest/chart2/correlationCircle.py +++ b/sc/qa/uitest/chart2/correlationCircle.py @@ -1,8 +1,6 @@ # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- # -# Copyright the LibreOffice contributors. -# -# SPDX-License-Identifier: MPL-2.0 +# This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/qa/unit/RedundantParenthesesStripperTest.cxx b/sc/qa/unit/RedundantParenthesesStripperTest.cxx index 9720792bb26c..47c468cf3c98 100644 --- a/sc/qa/unit/RedundantParenthesesStripperTest.cxx +++ b/sc/qa/unit/RedundantParenthesesStripperTest.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/qa/unit/anchor.cxx b/sc/qa/unit/anchor.cxx index 4432e928bcc6..661fd667f25f 100644 --- a/sc/qa/unit/anchor.cxx +++ b/sc/qa/unit/anchor.cxx @@ -8,6 +8,7 @@ */ #include +#include #include #include #include diff --git a/sc/qa/unit/data/dataprovider/dbimportrefresh.fods b/sc/qa/unit/data/dataprovider/dbimportrefresh.fods new file mode 100644 index 000000000000..5582abaee625 --- /dev/null +++ b/sc/qa/unit/data/dataprovider/dbimportrefresh.fods @@ -0,0 +1,18 @@ + + + + + + + + unchanged + + + + + + + + + + diff --git a/sc/qa/unit/data/ods/vba-document-module.ods b/sc/qa/unit/data/ods/vba-document-module.ods new file mode 100644 index 000000000000..59397a648b9b Binary files /dev/null and b/sc/qa/unit/data/ods/vba-document-module.ods differ diff --git a/sc/qa/unit/data/xls/tdf171083.xls b/sc/qa/unit/data/xls/tdf171083.xls new file mode 100644 index 000000000000..1b46ea22b2a7 Binary files /dev/null and b/sc/qa/unit/data/xls/tdf171083.xls differ diff --git a/sc/qa/unit/dataproviders_test.cxx b/sc/qa/unit/dataproviders_test.cxx index e72531b0b6ef..64c735120cf3 100644 --- a/sc/qa/unit/dataproviders_test.cxx +++ b/sc/qa/unit/dataproviders_test.cxx @@ -38,6 +38,7 @@ public: void testTdf169541_TwoDataMapping(); void testTdf169610_SortTransform(); void testLinkUpdateGate(); + void testDBImportRefreshDeferred(); CPPUNIT_TEST_SUITE(ScDataProvidersTest); CPPUNIT_TEST(testCSVImport); @@ -48,6 +49,7 @@ public: CPPUNIT_TEST(testTdf169541_TwoDataMapping); CPPUNIT_TEST(testTdf169610_SortTransform); CPPUNIT_TEST(testLinkUpdateGate); + CPPUNIT_TEST(testDBImportRefreshDeferred); CPPUNIT_TEST_SUITE_END(); }; @@ -345,6 +347,33 @@ void ScDataProvidersTest::testLinkUpdateGate() CPPUNIT_ASSERT_EQUAL(u"changed"_ustr, pDoc->GetString(0, 0, 0)); } +void ScDataProvidersTest::testDBImportRefreshDeferred() +{ + // A database range that imports from a data source on a refresh delay is an external link. + // Its refresh must not fetch the data until the user allows link updating. + createScDoc("dbimportrefresh.fods"); + ScDocument* pDoc = getScDoc(); + CPPUNIT_ASSERT(pDoc); + ScDocShell* pDocShell = getScDocShell(); + CPPUNIT_ASSERT(pDocShell); + + // The document counts as having external links, so the user is asked about updating. + CPPUNIT_ASSERT(pDoc->HasExternalLinks()); + + ScDBData* pDBData = pDoc->GetDBCollection()->getNamedDBs().findByUpperName(u"MYIMPORT"_ustr); + CPPUNIT_ASSERT(pDBData); + + // With updating not allowed, the refresh leaves the saved value. + pDocShell->GetEmbeddedObjectContainer().setUserAllowsLinkUpdate(false); + pDBData->Timer::Invoke(); + CPPUNIT_ASSERT_EQUAL(u"unchanged"_ustr, pDoc->GetString(0, 0, 0)); + + // Once the user allows updating, the next refresh imports the data source. + pDocShell->GetEmbeddedObjectContainer().setUserAllowsLinkUpdate(true); + pDBData->Timer::Invoke(); + CPPUNIT_ASSERT_EQUAL(u"Identifier"_ustr, pDoc->GetString(0, 0, 0)); +} + ScDataProvidersTest::ScDataProvidersTest() : ScModelTestBase(u"sc/qa/unit/data/dataprovider"_ustr) { diff --git a/sc/qa/unit/functions_dynamic_array.cxx b/sc/qa/unit/functions_dynamic_array.cxx index 6e05546be470..814a78f16d2a 100644 --- a/sc/qa/unit/functions_dynamic_array.cxx +++ b/sc/qa/unit/functions_dynamic_array.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 5530dea72f0d..9a7d88035703 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -11,6 +11,7 @@ #include "qahelper.hxx" #include +#include #include #include "csv_handler.hxx" #include "debughelper.hxx" diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index 44eb5599794e..e8d73ca5a2bf 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -10,6 +10,7 @@ #include #include "helper/qahelper.hxx" +#include #include #include diff --git a/sc/qa/unit/subsequent_export_test6.cxx b/sc/qa/unit/subsequent_export_test6.cxx index 8e20bfef40b9..333ba1eb1b90 100644 --- a/sc/qa/unit/subsequent_export_test6.cxx +++ b/sc/qa/unit/subsequent_export_test6.cxx @@ -83,6 +83,16 @@ CPPUNIT_TEST_FIXTURE(ScExportTest6, testShapeMacroExtRef) u"Importieren"); } +CPPUNIT_TEST_FIXTURE(ScExportTest6, testConditionalFormattingExtRef) +{ + createScDoc("xls/tdf171083.xls"); + save(TestFilter::XLSX); + + //without the fix the externalLink1 wouldn't have been exported to XLSX + xmlDocUniquePtr pExtLink = parseExport(u"xl/externalLinks/externalLink1.xml"_ustr); + CPPUNIT_ASSERT(pExtLink); +} + // --- Table Style OOXML Export Tests --- CPPUNIT_TEST_FIXTURE(ScExportTest6, testTableStyleDefaultExportXLSX) diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index d9280d1f1ea6..2e777e92aa80 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -7,6 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include #include #include #include @@ -160,6 +161,25 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, testDrawImageRemoteNotFetched) CPPUNIT_ASSERT(pDoc); } +CPPUNIT_TEST_FIXTURE(ScFiltersTest, testVBADocumentBasicAfterLoad) +{ + // A document in VBA compatibility mode with a VBA document module, loaded with macros not + // allowed, gets its Basic only when something first asks for it. Here that is the INDIRECT + // in A1 compiling "FOO" during a recalculation. Loading the document module asks for the + // document Basic again while the first request is still creating it. + uno::Sequence aParams = { + comphelper::makePropertyValue(u"MacroExecutionMode"_ustr, + css::document::MacroExecMode::NEVER_EXECUTE), + }; + loadFromFile(u"ods/vba-document-module.ods", aParams); + + ScDocShell* pDocSh = getScDocShell(); + pDocSh->DoHardRecalc(); + + CPPUNIT_ASSERT_EQUAL(u"#REF!"_ustr, getScDoc()->GetString(ScAddress(0, 0, 0))); + CPPUNIT_ASSERT(pDocSh->GetBasic()); +} + CPPUNIT_TEST_FIXTURE(ScFiltersTest, testContentODS) { createScDoc("ods/universal-content.ods"); diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index a3070b5c5f77..74ae048d61df 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -39,6 +39,7 @@ #include #include +#include #include #include #include diff --git a/sc/qa/unit/tiledrendering/tiledrendering2.cxx b/sc/qa/unit/tiledrendering/tiledrendering2.cxx index 8e9f7a39113f..056e01041e27 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering2.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering2.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include using namespace com::sun::star; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 43a79f3e293c..74f1e873c4fc 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -5943,6 +5943,214 @@ CPPUNIT_TEST_FIXTURE(Test, testAreasWithNotes) m_pDoc->DeleteTab(0); } +namespace +{ +// A header row, then empty rows that carry a border on every side, down to nLastBorderedRow. +// This is the shape of a pre-printed form, where the bordered rows are filled in later. +void lcl_makeBorderedForm(ScDocument* pDoc, SCROW nLastBorderedRow) +{ + pDoc->SetString(0, 0, 0, u"Header"_ustr); + + ::editeng::SvxBorderLine aLine(nullptr, 50, SvxBorderLineStyle::SOLID); + SvxBoxItem aBorderItem(ATTR_BORDER); + aBorderItem.SetLine(&aLine, SvxBoxItemLine::LEFT); + aBorderItem.SetLine(&aLine, SvxBoxItemLine::RIGHT); + aBorderItem.SetLine(&aLine, SvxBoxItemLine::TOP); + aBorderItem.SetLine(&aLine, SvxBoxItemLine::BOTTOM); + ScPatternAttr aBordered(pDoc->getCellAttributeHelper()); + aBordered.ItemSetPut(aBorderItem); + pDoc->ApplyPatternAreaTab(0, 1, 2, nLastBorderedRow, 0, aBordered); +} + +// The pattern of a single border line, for marking one cell or one row. +ScPatternAttr lcl_oneLine(ScDocument* pDoc, SvxBoxItemLine eSide) +{ + ::editeng::SvxBorderLine aLine(nullptr, 50, SvxBorderLineStyle::SOLID); + SvxBoxItem aBorderItem(ATTR_BORDER); + aBorderItem.SetLine(&aLine, eSide); + ScPatternAttr aPattern(pDoc->getCellAttributeHelper()); + aPattern.ItemSetPut(aBorderItem); + return aPattern; +} + +ScPatternAttr lcl_colour(ScDocument* pDoc, const Color& rColor) +{ + ScPatternAttr aPattern(pDoc->getCellAttributeHelper()); + aPattern.ItemSetPut(SvxBrushItem(rColor, ATTR_BACKGROUND)); + return aPattern; +} + +SCROW lcl_printAreaEndRow(ScDocument* pDoc) +{ + SCCOL nEndCol; + SCROW nEndRow; + CPPUNIT_ASSERT(pDoc->GetPrintArea(0, nEndCol, nEndRow, false)); + return nEndRow; +} +} + +CPPUNIT_TEST_FIXTURE(Test, testPrintAreaCoversABorderedForm) +{ + // Empty rows carrying a border are printed, so they belong to the print area even though + // no cell in them holds anything. + m_pDoc->InsertTab(0, u"Form"_ustr); + lcl_makeBorderedForm(m_pDoc, 99); + + SCCOL nEndCol; + SCROW nEndRow; + CPPUNIT_ASSERT(m_pDoc->GetPrintArea(0, nEndCol, nEndRow, false)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("the printout reaches the last bordered row", + static_cast(99), nEndRow); + CPPUNIT_ASSERT_EQUAL_MESSAGE("the printout reaches the last bordered column", + static_cast(2), nEndCol); + m_pDoc->DeleteTab(0); + + // A form of over a thousand rows is still a form. + m_pDoc->InsertTab(0, u"LongForm"_ustr); + lcl_makeBorderedForm(m_pDoc, 1499); + CPPUNIT_ASSERT_EQUAL_MESSAGE("the printout reaches the last bordered row", + static_cast(1499), lcl_printAreaEndRow(m_pDoc)); + m_pDoc->DeleteTab(0); +} + +CPPUNIT_TEST_FIXTURE(Test, testPrintAreaIgnoresAColourBelowTheContent) +{ + // A colour below the last cell with content stays out of the print area, wherever it sits + // and however far it runs. + const SCROW nLast = m_pDoc->MaxRow(); + + const std::pair aRanges[] = { + { 0, nLast }, // the whole column + { 1, nLast }, // from under the header to the last row + { 10, nLast }, // from below the content to the last row + { 10, nLast - 1 }, // stopping one row short of the last row + { 49999, 49999 }, // one cell far below the content + }; + + sal_Int32 nSheet = 0; + for (const auto& rRange : aRanges) + { + m_pDoc->InsertTab(0, "Colour" + OUString::number(nSheet++)); + m_pDoc->SetString(0, 0, 0, u"Header"_ustr); + m_pDoc->ApplyPatternAreaTab(0, rRange.first, 0, rRange.second, 0, + lcl_colour(m_pDoc, COL_BLUE)); + + OString aMessage = "a colour over rows " + OString::number(rRange.first) + " to " + + OString::number(rRange.second); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMessage.getStr(), static_cast(0), + lcl_printAreaEndRow(m_pDoc)); + m_pDoc->DeleteTab(0); + } +} + +CPPUNIT_TEST_FIXTURE(Test, testPrintAreaIgnoresABorderTooWideForAForm) +{ + // A border far below the content, or one many times wider than a form, stays out of the + // print area. The printout ends at the last row with content. + const SCROW nLast = m_pDoc->MaxRow(); + + const std::pair aRanges[] = { + { nLast, nLast }, // the last row of the sheet + { 10, 50000 }, // reaching far below the content + }; + + sal_Int32 nSheet = 0; + for (const auto& rRange : aRanges) + { + m_pDoc->InsertTab(0, "Border" + OUString::number(nSheet++)); + m_pDoc->SetString(0, 0, 0, u"Header"_ustr); + m_pDoc->ApplyPatternAreaTab(0, rRange.first, 0, rRange.second, 0, + lcl_oneLine(m_pDoc, SvxBoxItemLine::BOTTOM)); + + OString aMessage = "a border over rows " + OString::number(rRange.first) + " to " + + OString::number(rRange.second); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMessage.getStr(), static_cast(0), + lcl_printAreaEndRow(m_pDoc)); + m_pDoc->DeleteTab(0); + } +} + +CPPUNIT_TEST_FIXTURE(Test, testPrintAreaIgnoresAFrameRoundAWholeColumn) +{ + // A frame round a whole column keeps the side lines on every row, the top line on the + // first row and the bottom line on the last, so it arrives as three ranges and the middle + // one covers nearly the sheet. The printout ends at the last row with content. + m_pDoc->InsertTab(0, u"Frame"_ustr); + m_pDoc->SetString(0, 0, 0, u"Header"_ustr); + const SCROW nLast = m_pDoc->MaxRow(); + + ::editeng::SvxBorderLine aLine(nullptr, 50, SvxBorderLineStyle::SOLID); + SvxBoxItem aSides(ATTR_BORDER); + aSides.SetLine(&aLine, SvxBoxItemLine::LEFT); + aSides.SetLine(&aLine, SvxBoxItemLine::RIGHT); + ScPatternAttr aSidesOnly(m_pDoc->getCellAttributeHelper()); + aSidesOnly.ItemSetPut(aSides); + m_pDoc->ApplyPatternAreaTab(0, 0, 0, nLast, 0, aSidesOnly); + + SvxBoxItem aTop(aSides); + aTop.SetLine(&aLine, SvxBoxItemLine::TOP); + ScPatternAttr aTopRow(m_pDoc->getCellAttributeHelper()); + aTopRow.ItemSetPut(aTop); + m_pDoc->ApplyPatternAreaTab(0, 0, 0, 0, 0, aTopRow); + + SvxBoxItem aBottom(aSides); + aBottom.SetLine(&aLine, SvxBoxItemLine::BOTTOM); + ScPatternAttr aBottomRow(m_pDoc->getCellAttributeHelper()); + aBottomRow.ItemSetPut(aBottom); + m_pDoc->ApplyPatternAreaTab(0, nLast, 0, nLast, 0, aBottomRow); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("the printout stops at the last row with content", + static_cast(0), lcl_printAreaEndRow(m_pDoc)); + m_pDoc->DeleteTab(0); +} + +CPPUNIT_TEST_FIXTURE(Test, testPrintAreaDoesNotMoveAsTheSheetIsFilledIn) +{ + // A form is printed in full wherever the last cell with content sits, so filling the form + // in row by row leaves the printout the same. + for (SCROW nContentRow : { SCROW(1), SCROW(13), SCROW(15), SCROW(16), SCROW(17), SCROW(50) }) + { + m_pDoc->InsertTab(0, "Form" + OUString::number(nContentRow)); + lcl_makeBorderedForm(m_pDoc, 99); + m_pDoc->SetString(0, nContentRow, 0, u"filled in"_ustr); + + OString aMessage = "a form, content in row " + OString::number(nContentRow); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMessage.getStr(), static_cast(99), + lcl_printAreaEndRow(m_pDoc)); + m_pDoc->DeleteTab(0); + } + + // A block too wide to be a form stays out of the printout while the content ends well + // above it. + for (SCROW nContentRow : { SCROW(0), SCROW(600), SCROW(3000) }) + { + m_pDoc->InsertTab(0, "Wide" + OUString::number(nContentRow)); + m_pDoc->SetString(0, 0, 0, u"Header"_ustr); + if (nContentRow > 0) + m_pDoc->SetString(0, nContentRow, 0, u"filled in"_ustr); + lcl_makeBorderedForm(m_pDoc, 10499); + + OString aMessage = "a wide block, content in row " + OString::number(nContentRow); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMessage.getStr(), nContentRow, + lcl_printAreaEndRow(m_pDoc)); + m_pDoc->DeleteTab(0); + } + + // A form too wide for the printout stays out of it wherever the content sits inside it. + // Bold over the upper part splits the form into two ranges that still look the same, and + // the lower one is short enough on its own to pass for a form. + m_pDoc->InsertTab(0, u"Split"_ustr); + lcl_makeBorderedForm(m_pDoc, 3000); + ScPatternAttr aBold(m_pDoc->getCellAttributeHelper()); + aBold.ItemSetPut(SvxWeightItem(WEIGHT_BOLD, ATTR_FONT_WEIGHT)); + m_pDoc->ApplyPatternAreaTab(0, 1, 2, 2500, 0, aBold); + m_pDoc->SetString(0, 2600, 0, u"filled in"_ustr); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("a wide form, content in its lower range", + static_cast(2600), lcl_printAreaEndRow(m_pDoc)); + m_pDoc->DeleteTab(0); +} + CPPUNIT_TEST_FIXTURE(Test, testAnchoredRotatedShape) { m_pDoc->InsertTab(0, u"TestTab"_ustr); @@ -7923,22 +8131,19 @@ CPPUNIT_TEST_FIXTURE(Test, testAutoFilterFlagsAfterColumnDeleteUndoRedo) CPPUNIT_TEST_FIXTURE(Test, testCopyTabContent) { - m_pDoc->InsertTab(0, u"Tab0"_ustr); - m_pDoc->InsertTab(1, u"Tab1"_ustr); - m_pDoc->InsertTab(2, u"Tab2"_ustr); - m_pDoc->InsertTab(3, u"Tab3"_ustr); + m_pDoc->InsertTab(0, u"Tab1"_ustr); + m_pDoc->InsertTab(1, u"Tab2"_ustr); + m_pDoc->InsertTab(2, u"Tab3"_ustr); - // For cross-sheet formula checking (forward and backward) - m_pDoc->SetValue(ScAddress(0, 0, 0), 99.0); // Tab0.A1 - m_pDoc->SetValue(ScAddress(0, 0, 3), 66.0); // Tab3.A1 + // For cross-sheet formula checking + m_pDoc->SetValue(ScAddress(0, 0, 2), 66.0); std::vector> aData = { { u"Column 1"_ustr, u"Column 2"_ustr, u"Column 3"_ustr }, { u"7"_ustr, u"A"_ustr, u"=A2+5"_ustr }, - { u"=2+2"_ustr, u"C"_ustr, u"=Tab3.A1"_ustr }, // forward cross-tab reference - { u"=A3-2"_ustr, u"D"_ustr, u"=SUM(A2:A6)"_ustr }, - { u"3"_ustr, u"B"_ustr, u"=C3-60"_ustr }, - { u"5"_ustr, u"E"_ustr, u"=Tab0.A1"_ustr }, // backward cross-tab reference + { u"=2+2"_ustr, u"C"_ustr, u"=Tab3.A1"_ustr }, + { u"=A3-2"_ustr, u"D"_ustr, u"=SUM(A2:A5)"_ustr }, + { u"3"_ustr, u"B"_ustr, u"=C3-60"_ustr } }; for (size_t i = 0; i < aData.size(); ++i) @@ -7947,7 +8152,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCopyTabContent) { if (!aData[i][j].isEmpty()) { - m_pDoc->SetString(j, i, 1, aData[i][j]); + m_pDoc->SetString(j, i, 0, aData[i][j]); } } } @@ -7955,223 +8160,121 @@ CPPUNIT_TEST_FIXTURE(Test, testCopyTabContent) // Verify Tab1 values and formulas before copy { - CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(0, 1, 1))); - CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0, 2, 1))); - CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0, 3, 1))); - CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0, 4, 1))); - CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(0, 5, 1))); + CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(0, 1, 0))); + CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0, 2, 0))); + CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0, 3, 0))); + CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0, 4, 0))); - CPPUNIT_ASSERT_EQUAL(u"A"_ustr, m_pDoc->GetString(ScAddress(1, 1, 1))); - CPPUNIT_ASSERT_EQUAL(u"C"_ustr, m_pDoc->GetString(ScAddress(1, 2, 1))); - CPPUNIT_ASSERT_EQUAL(u"D"_ustr, m_pDoc->GetString(ScAddress(1, 3, 1))); - CPPUNIT_ASSERT_EQUAL(u"B"_ustr, m_pDoc->GetString(ScAddress(1, 4, 1))); - CPPUNIT_ASSERT_EQUAL(u"E"_ustr, m_pDoc->GetString(ScAddress(1, 5, 1))); + CPPUNIT_ASSERT_EQUAL(u"A"_ustr, m_pDoc->GetString(ScAddress(1, 1, 0))); + CPPUNIT_ASSERT_EQUAL(u"C"_ustr, m_pDoc->GetString(ScAddress(1, 2, 0))); + CPPUNIT_ASSERT_EQUAL(u"D"_ustr, m_pDoc->GetString(ScAddress(1, 3, 0))); + CPPUNIT_ASSERT_EQUAL(u"B"_ustr, m_pDoc->GetString(ScAddress(1, 4, 0))); - CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(2, 1, 1))); // =A2+5=12 - CPPUNIT_ASSERT_EQUAL(66.0, m_pDoc->GetValue(ScAddress(2, 2, 1))); // =Tab3.A1 - CPPUNIT_ASSERT_EQUAL(21.0, m_pDoc->GetValue(ScAddress(2, 3, 1))); // =SUM(A2:A6) - CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(2, 4, 1))); // =C3-60 - CPPUNIT_ASSERT_EQUAL(99.0, m_pDoc->GetValue(ScAddress(2, 5, 1))); // =Tab0.A1 + CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(2, 1, 0))); + CPPUNIT_ASSERT_EQUAL(66.0, m_pDoc->GetValue(ScAddress(2, 2, 0))); + CPPUNIT_ASSERT_EQUAL(16.0, m_pDoc->GetValue(ScAddress(2, 3, 0))); + CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(2, 4, 0))); } - // Copy Tab1 to index 2 - Tab1_2 - m_pDoc->CopyTab(1, 2); - CPPUNIT_ASSERT_EQUAL(static_cast(5), m_pDoc->GetTableCount()); + // Copy Tab1 to index 1 - Tab1_2 + m_pDoc->CopyTab(0, 1); + CPPUNIT_ASSERT_EQUAL(static_cast(4), m_pDoc->GetTableCount()); - // Tab3 value shifted from index 3 to index 4 - CPPUNIT_ASSERT_EQUAL(66.0, m_pDoc->GetValue(ScAddress(0, 0, 4))); - // Tab0 value stays at index 0 - CPPUNIT_ASSERT_EQUAL(99.0, m_pDoc->GetValue(ScAddress(0, 0, 0))); + // Tab3 value shifted from index 2 to index 3 + CPPUNIT_ASSERT_EQUAL(66.0, m_pDoc->GetValue(ScAddress(0, 0, 3))); - // Tab1 (tab index 1) should be unchanged + // Tab1 (tab index 0) should be unchanged + { + CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(0, 1, 0))); + CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0, 2, 0))); + CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0, 3, 0))); + CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0, 4, 0))); + + CPPUNIT_ASSERT_EQUAL(u"A"_ustr, m_pDoc->GetString(ScAddress(1, 1, 0))); + CPPUNIT_ASSERT_EQUAL(u"C"_ustr, m_pDoc->GetString(ScAddress(1, 2, 0))); + CPPUNIT_ASSERT_EQUAL(u"D"_ustr, m_pDoc->GetString(ScAddress(1, 3, 0))); + CPPUNIT_ASSERT_EQUAL(u"B"_ustr, m_pDoc->GetString(ScAddress(1, 4, 0))); + + CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(2, 1, 0))); + CPPUNIT_ASSERT_EQUAL(66.0, m_pDoc->GetValue(ScAddress(2, 2, 0))); + CPPUNIT_ASSERT_EQUAL(16.0, m_pDoc->GetValue(ScAddress(2, 3, 0))); + CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(2, 4, 0))); + } + + // The copy Tab1_2 (tab index 1) should have the same data as Tab1 { CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(0, 1, 1))); CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0, 2, 1))); CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0, 3, 1))); CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0, 4, 1))); - CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(0, 5, 1))); CPPUNIT_ASSERT_EQUAL(u"A"_ustr, m_pDoc->GetString(ScAddress(1, 1, 1))); CPPUNIT_ASSERT_EQUAL(u"C"_ustr, m_pDoc->GetString(ScAddress(1, 2, 1))); CPPUNIT_ASSERT_EQUAL(u"D"_ustr, m_pDoc->GetString(ScAddress(1, 3, 1))); CPPUNIT_ASSERT_EQUAL(u"B"_ustr, m_pDoc->GetString(ScAddress(1, 4, 1))); - CPPUNIT_ASSERT_EQUAL(u"E"_ustr, m_pDoc->GetString(ScAddress(1, 5, 1))); CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(2, 1, 1))); CPPUNIT_ASSERT_EQUAL(66.0, m_pDoc->GetValue(ScAddress(2, 2, 1))); - CPPUNIT_ASSERT_EQUAL(21.0, m_pDoc->GetValue(ScAddress(2, 3, 1))); + CPPUNIT_ASSERT_EQUAL(16.0, m_pDoc->GetValue(ScAddress(2, 3, 1))); CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(2, 4, 1))); - CPPUNIT_ASSERT_EQUAL(99.0, m_pDoc->GetValue(ScAddress(2, 5, 1))); - } - - // The copy Tab1_2 (tab index 2) should have the same data as Tab1 - { - CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(0, 1, 2))); - CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0, 2, 2))); - CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0, 3, 2))); - CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0, 4, 2))); - CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(0, 5, 2))); - - CPPUNIT_ASSERT_EQUAL(u"A"_ustr, m_pDoc->GetString(ScAddress(1, 1, 2))); - CPPUNIT_ASSERT_EQUAL(u"C"_ustr, m_pDoc->GetString(ScAddress(1, 2, 2))); - CPPUNIT_ASSERT_EQUAL(u"D"_ustr, m_pDoc->GetString(ScAddress(1, 3, 2))); - CPPUNIT_ASSERT_EQUAL(u"B"_ustr, m_pDoc->GetString(ScAddress(1, 4, 2))); - CPPUNIT_ASSERT_EQUAL(u"E"_ustr, m_pDoc->GetString(ScAddress(1, 5, 2))); - - CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(2, 1, 2))); - CPPUNIT_ASSERT_EQUAL(66.0, m_pDoc->GetValue(ScAddress(2, 2, 2))); - CPPUNIT_ASSERT_EQUAL(21.0, m_pDoc->GetValue(ScAddress(2, 3, 2))); - CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(2, 4, 2))); - CPPUNIT_ASSERT_EQUAL(99.0, m_pDoc->GetValue(ScAddress(2, 5, 2))); } // Check the formulas in Tab1_2 { - CPPUNIT_ASSERT_EQUAL(u"=2+2"_ustr, m_pDoc->GetFormula(0, 2, 2)); - CPPUNIT_ASSERT_EQUAL(u"=A3-2"_ustr, m_pDoc->GetFormula(0, 3, 2)); - CPPUNIT_ASSERT_EQUAL(u"=A2+5"_ustr, m_pDoc->GetFormula(2, 1, 2)); - CPPUNIT_ASSERT_EQUAL(u"='Tab3'.A1"_ustr, m_pDoc->GetFormula(2, 2, 2)); - CPPUNIT_ASSERT_EQUAL(u"=SUM(A2:A6)"_ustr, m_pDoc->GetFormula(2, 3, 2)); - CPPUNIT_ASSERT_EQUAL(u"=C3-60"_ustr, m_pDoc->GetFormula(2, 4, 2)); - CPPUNIT_ASSERT_EQUAL(u"=Tab0.A1"_ustr, m_pDoc->GetFormula(2, 5, 2)); + CPPUNIT_ASSERT_EQUAL(u"=2+2"_ustr, m_pDoc->GetFormula(0, 2, 1)); + CPPUNIT_ASSERT_EQUAL(u"=A3-2"_ustr, m_pDoc->GetFormula(0, 3, 1)); + CPPUNIT_ASSERT_EQUAL(u"=A2+5"_ustr, m_pDoc->GetFormula(2, 1, 1)); + CPPUNIT_ASSERT_EQUAL(u"='Tab3'.A1"_ustr, m_pDoc->GetFormula(2, 2, 1)); + CPPUNIT_ASSERT_EQUAL(u"=SUM(A2:A5)"_ustr, m_pDoc->GetFormula(2, 3, 1)); + CPPUNIT_ASSERT_EQUAL(u"=C3-60"_ustr, m_pDoc->GetFormula(2, 4, 1)); } // Change Tab1 and verify the copy is independent - m_pDoc->SetValue(ScAddress(0, 1, 1), 10.0); // 7 -> 10 + m_pDoc->SetValue(ScAddress(0, 1, 0), 10.0); // 7 -> 10 m_pDoc->CalcAll(); // Tab1 should be changed { - CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(0, 1, 1))); + CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(0, 1, 0))); + CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0, 2, 0))); + CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0, 3, 0))); + CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0, 4, 0))); + + CPPUNIT_ASSERT_EQUAL(u"A"_ustr, m_pDoc->GetString(ScAddress(1, 1, 0))); + CPPUNIT_ASSERT_EQUAL(u"C"_ustr, m_pDoc->GetString(ScAddress(1, 2, 0))); + CPPUNIT_ASSERT_EQUAL(u"D"_ustr, m_pDoc->GetString(ScAddress(1, 3, 0))); + CPPUNIT_ASSERT_EQUAL(u"B"_ustr, m_pDoc->GetString(ScAddress(1, 4, 0))); + + CPPUNIT_ASSERT_EQUAL(15.0, m_pDoc->GetValue(ScAddress(2, 1, 0))); + CPPUNIT_ASSERT_EQUAL(66.0, m_pDoc->GetValue(ScAddress(2, 2, 0))); + CPPUNIT_ASSERT_EQUAL(19.0, m_pDoc->GetValue(ScAddress(2, 3, 0))); + CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(2, 4, 0))); + } + + // No change in Tab1_2 + { + CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(0, 1, 1))); CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0, 2, 1))); CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0, 3, 1))); CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0, 4, 1))); - CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(0, 5, 1))); CPPUNIT_ASSERT_EQUAL(u"A"_ustr, m_pDoc->GetString(ScAddress(1, 1, 1))); CPPUNIT_ASSERT_EQUAL(u"C"_ustr, m_pDoc->GetString(ScAddress(1, 2, 1))); CPPUNIT_ASSERT_EQUAL(u"D"_ustr, m_pDoc->GetString(ScAddress(1, 3, 1))); CPPUNIT_ASSERT_EQUAL(u"B"_ustr, m_pDoc->GetString(ScAddress(1, 4, 1))); - CPPUNIT_ASSERT_EQUAL(u"E"_ustr, m_pDoc->GetString(ScAddress(1, 5, 1))); - CPPUNIT_ASSERT_EQUAL(15.0, m_pDoc->GetValue(ScAddress(2, 1, 1))); + CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(2, 1, 1))); CPPUNIT_ASSERT_EQUAL(66.0, m_pDoc->GetValue(ScAddress(2, 2, 1))); - CPPUNIT_ASSERT_EQUAL(24.0, m_pDoc->GetValue(ScAddress(2, 3, 1))); // =SUM(A2:A6)=10+4+2+3+5 + CPPUNIT_ASSERT_EQUAL(16.0, m_pDoc->GetValue(ScAddress(2, 3, 1))); CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(2, 4, 1))); - CPPUNIT_ASSERT_EQUAL(99.0, m_pDoc->GetValue(ScAddress(2, 5, 1))); } - // No change in Tab1_2 - { - CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(0, 1, 2))); - CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0, 2, 2))); - CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0, 3, 2))); - CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0, 4, 2))); - CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(0, 5, 2))); - - CPPUNIT_ASSERT_EQUAL(u"A"_ustr, m_pDoc->GetString(ScAddress(1, 1, 2))); - CPPUNIT_ASSERT_EQUAL(u"C"_ustr, m_pDoc->GetString(ScAddress(1, 2, 2))); - CPPUNIT_ASSERT_EQUAL(u"D"_ustr, m_pDoc->GetString(ScAddress(1, 3, 2))); - CPPUNIT_ASSERT_EQUAL(u"B"_ustr, m_pDoc->GetString(ScAddress(1, 4, 2))); - CPPUNIT_ASSERT_EQUAL(u"E"_ustr, m_pDoc->GetString(ScAddress(1, 5, 2))); - - CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(2, 1, 2))); - CPPUNIT_ASSERT_EQUAL(66.0, m_pDoc->GetValue(ScAddress(2, 2, 2))); - CPPUNIT_ASSERT_EQUAL(21.0, m_pDoc->GetValue(ScAddress(2, 3, 2))); - CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(2, 4, 2))); - CPPUNIT_ASSERT_EQUAL(99.0, m_pDoc->GetValue(ScAddress(2, 5, 2))); - } - - m_pDoc->DeleteTab(4); m_pDoc->DeleteTab(3); m_pDoc->DeleteTab(2); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); } -// The relative sheet references of a copied sheet point at the same sheets as the ones of its -// source, wherever the copy is inserted. -CPPUNIT_TEST_FIXTURE(Test, testCopyTabRelativeTabRefs) -{ - // The source has two sheets on each side, so every insert position leaves referenced sheets - // both before and after the copy. - const SCTAB nTabCount = 5; - const SCTAB nSourceTab = 2; - - // Each sheet holds its own value in A1, so a reference that lands on the wrong sheet gives a - // different result. - struct RefCheck - { - OUString sFormula; - double fExpected; - }; - const std::vector aChecks = { - { u"=Tab0.A1"_ustr, 10.0 }, - { u"=Tab1.A1"_ustr, 11.0 }, - { u"=Tab3.A1"_ustr, 13.0 }, - { u"=Tab4.A1"_ustr, 14.0 }, - { u"=SUM(Tab0.A1:Tab0.A2)"_ustr, 110.0 }, - { u"=SUM(Tab4.A1:Tab4.A2)"_ustr, 114.0 }, - }; - - // Positions 0 and 1 put the copy in front of sheets it references on the left, 2 puts it - // directly before the source and 3 directly after it, 4 puts it between the two sheets it - // references on the right, and the last one appends it. - const SCTAB aInsertPositions[] = { 0, 1, 2, 3, 4, SC_TAB_APPEND }; - for (SCTAB nInsertPos : aInsertPositions) - { - // A document always keeps its last sheet, so each position gets a new document. - ScDocShellRef xDocShell; - getNewDocShell(xDocShell); - ScDocument& rDoc = xDocShell->GetDocument(); - - for (SCTAB nTab = 0; nTab < nTabCount; ++nTab) - { - rDoc.InsertTab(nTab, u"Tab"_ustr + OUString::number(nTab)); - rDoc.SetValue(ScAddress(0, 0, nTab), 10.0 + nTab); - rDoc.SetValue(ScAddress(0, 1, nTab), 100.0); - } - SCROW nRow = 0; - for (const RefCheck& rCheck : aChecks) - rDoc.SetString(ScAddress(1, nRow++, nSourceTab), rCheck.sFormula); - rDoc.SetString(ScAddress(2, 0, nSourceTab), u"=A1"_ustr); - - rDoc.CopyTab(nSourceTab, nInsertPos); - CPPUNIT_ASSERT_EQUAL(static_cast(nTabCount + 1), rDoc.GetTableCount()); - - const SCTAB nCopyTab = (nInsertPos == SC_TAB_APPEND) ? nTabCount : nInsertPos; - // The source moves one place to the right when the copy goes in at or before it. - const SCTAB nSourceTabAfterCopy - = (nInsertPos <= nSourceTab) ? nSourceTab + 1 : nSourceTab; - - // A new value in A1 of the copy tells a reference to the copy itself apart from one to - // the source. - rDoc.SetValue(ScAddress(0, 0, nCopyTab), 20.0); - rDoc.CalcAll(); - - auto checkSheet = [&](SCTAB nTab, double fOwnValue, std::string_view sSheet) - { - const OString sPrefix = OString::Concat(sSheet) + " sheet, copy at position " - + OString::number(nCopyTab) + ", "; - SCROW nCheckRow = 0; - for (const RefCheck& rCheck : aChecks) - { - const OString sMessage - = sPrefix + OUStringToOString(rCheck.sFormula, RTL_TEXTENCODING_UTF8); - CPPUNIT_ASSERT_EQUAL_MESSAGE(sMessage.getStr(), rCheck.fExpected, - rDoc.GetValue(ScAddress(1, nCheckRow++, nTab))); - } - const OString sMessage = sPrefix + "=A1"; - CPPUNIT_ASSERT_EQUAL_MESSAGE(sMessage.getStr(), fOwnValue, - rDoc.GetValue(ScAddress(2, 0, nTab))); - }; - checkSheet(nSourceTabAfterCopy, 12.0, "source"); - checkSheet(nCopyTab, 20.0, "copied"); - - xDocShell->DoClose(); - } -} - CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/ucalc_spilled_range.cxx b/sc/qa/unit/ucalc_spilled_range.cxx index 50974cfdb329..5309ef53a821 100644 --- a/sc/qa/unit/ucalc_spilled_range.cxx +++ b/sc/qa/unit/ucalc_spilled_range.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index cfd04f9458d7..1b051f11a9d6 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -9,6 +9,7 @@ #include "../helper/qahelper.hxx" #include +#include #include #include #include @@ -2161,6 +2162,43 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testPasteAsLink) WEIGHT_NORMAL, aFont.GetWeightMaybeAskConfig()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf57274_paste_special_link_empty_cells) +{ + createScDoc(); + ScDocument* pDoc = getScDoc(); + + // Source range A1:A3 spans several rows including an empty cell in A2 + insertStringToCell(u"A1"_ustr, u"1"); + insertStringToCell(u"A3"_ustr, u"3"); + + goToCell(u"A1:A3"_ustr); + dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); + + // Paste Special with paste all and link + goToCell(u"B1"_ustr); + uno::Sequence aArgs = comphelper::InitPropertySequence( + { { "Flags", uno::Any(u"A"_ustr) }, + { "FormulaCommand", uno::Any(sal_uInt16(ScPasteFunc::NONE)) }, + { "SkipEmptyCells", uno::Any(false) }, + { "Transpose", uno::Any(false) }, + { "AsLink", uno::Any(true) }, + { "MoveMode", uno::Any(sal_uInt16(InsCellCmd::INS_NONE)) } }); + dispatchCommand(mxComponent, u".uno:InsertContents"_ustr, aArgs); + + CPPUNIT_ASSERT_EQUAL(u"=$Sheet1.$A$1"_ustr, pDoc->GetFormula(1, 0, 0)); // B1 + // Without the fix in place, this test would have failed with + // - Expected: =$Sheet1.$A$2 + // - Actual : + // i.e. no reference was created for the empty source cell + CPPUNIT_ASSERT_EQUAL(u"=$Sheet1.$A$2"_ustr, pDoc->GetFormula(1, 1, 0)); // B2 + CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(1, 1, 0)); // B2 + CPPUNIT_ASSERT_EQUAL(u"=$Sheet1.$A$3"_ustr, pDoc->GetFormula(1, 2, 0)); // B3 + + // The link to the previously empty cell must follow its source + insertStringToCell(u"A2"_ustr, u"2"); + CPPUNIT_ASSERT_EQUAL(2.0, pDoc->GetValue(1, 1, 0)); // B2 +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf119659) { createScDoc(); @@ -2301,6 +2339,32 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf138710) CPPUNIT_ASSERT_EQUAL(u"Total"_ustr, pDoc->GetString(ScAddress(0, 0, 1))); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf173608_relative_references_when_copying_sheets) +{ + createScDoc(); + ScDocument* pDoc = getScDoc(); + + insertStringToCell(u"A1"_ustr, u"1"); + insertStringToCell(u"A2"_ustr, u"2"); + + insertNewSheet(*pDoc); + + insertStringToCell(u"A1"_ustr, u"=$Sheet1.A1+1"); + insertStringToCell(u"A2"_ustr, u"=Sheet1.A2+1"); + + CPPUNIT_ASSERT_EQUAL(u"2"_ustr, pDoc->GetString(ScAddress(0, 0, 1))); + CPPUNIT_ASSERT_EQUAL(u"3"_ustr, pDoc->GetString(ScAddress(0, 1, 1))); + + dispatchCommand(mxComponent, u".uno:DuplicateSheet"_ustr, {}); + CPPUNIT_ASSERT_EQUAL(static_cast(3), pDoc->GetTableCount()); + + CPPUNIT_ASSERT_EQUAL(u"2"_ustr, pDoc->GetString(ScAddress(0, 0, 2))); + // Without the fix in place, this test would have failed with + // - Expected: 4 + // - Actual : 3 + CPPUNIT_ASSERT_EQUAL(u"4"_ustr, pDoc->GetString(ScAddress(0, 1, 2))); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf128914) { createScDoc("tdf128914.ods"); diff --git a/sc/source/core/data/TableContentCopier.cxx b/sc/source/core/data/TableContentCopier.cxx index 0f8c1d6e3532..4a9fdb5701b8 100644 --- a/sc/source/core/data/TableContentCopier.cxx +++ b/sc/source/core/data/TableContentCopier.cxx @@ -88,13 +88,9 @@ void sc::TableContentCopier::performCopy(const ScMarkData* pOnlyMarked, ScCloneF } void sc::TableContentCopier::updateReferencesAfterTabInsertion( - sc::RefUpdateInsertTabContext& rContext, SCTAB nPreviousSourceTabNo) + sc::RefUpdateInsertTabContext& rContext) { mpTargetTab->UpdateInsertTabAbs(mnTargetTabNo); - // The cloned relative sheet offsets still count from where the source was before the insert. - // When the copy goes in at or before the source, that is one less than mnSourceTabNo. - mpTargetTab->AdjustRelativeTabRefs(nPreviousSourceTabNo, mnTargetTabNo, - sc::TargetTabState::Inserted); mpSourceTab->UpdateInsertTab(rContext); mpSourceTab->UpdateCompile(); } diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index db79f3d67a06..907d3cc2bde8 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1919,6 +1919,12 @@ bool ScAttrArray::GetFirstVisibleAttr( SCROW& rFirstRow ) const const SCROW SC_VISATTR_STOP = 84; +// how far a bordered block reaches into the print area, in its whole length and in its +// distance below the last cell with content. The length counts the rows that already hold +// content, so it stays the same as the form is filled in. 2000 rows is some forty pages here. + +const SCROW SC_VISATTR_BORDER_STOP = 2000; + bool ScAttrArray::GetLastVisibleAttr( SCROW& rLastRow, SCROW nLastData, bool bSkipEmpty ) const { if ( mvData.empty() ) @@ -1928,8 +1934,8 @@ bool ScAttrArray::GetLastVisibleAttr( SCROW& rLastRow, SCROW nLastData, bool bSk } // #i30830# changed behavior: - // ignore all attributes starting with the first run of SC_VISATTR_STOP equal rows - // below the last content cell + // ignore a long run of equally formatted rows below the last content cell, and everything + // below it. A bordered run of the size and position a form has is kept instead. if ( nLastData == rDocument.MaxRow() ) { @@ -1965,7 +1971,30 @@ bool ScAttrArray::GetLastVisibleAttr( SCROW& rLastRow, SCROW nLastData, bool bSk if ( nAttrStartRow <= nLastData ) nAttrStartRow = nLastData + 1; SCROW nAttrSize = mvData[nEndPos].nEndRow + 1 - nAttrStartRow; + bool bStop = false; if ( nAttrSize >= SC_VISATTR_STOP ) + { + // The length is measured over the whole block, so it holds steady as the + // sheet is filled in. The distance keeps the search within + // SC_VISATTR_BORDER_STOP rows of the last cell with content. + const SvxBoxItem& rBox + = mvData[nEndPos].getScPatternAttr()->GetItem( ATTR_BORDER ); + const bool bBordered = rBox.GetLeft() || rBox.GetRight() + || rBox.GetTop() || rBox.GetBottom(); + // walk back to the first range of this block, so the length is the same + // whichever of its ranges holds the last cell with content + SCSIZE nStartPos = nPos; + while ( nStartPos > 0 + && mvData[nStartPos-1].getScPatternAttr()->IsVisibleEqual( + *mvData[nStartPos].getScPatternAttr() ) ) + --nStartPos; + const SCROW nRangeStartRow + = ( nStartPos > 0 ) ? ( mvData[nStartPos-1].nEndRow + 1 ) : 0; + bStop = !bBordered + || mvData[nEndPos].nEndRow + 1 - nRangeStartRow >= SC_VISATTR_BORDER_STOP + || mvData[nEndPos].nEndRow - nLastData >= SC_VISATTR_BORDER_STOP; + } + if ( bStop ) break; // while, ignore this range and below else if ( mvData[nEndPos].getScPatternAttr()->IsVisible() ) { diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 8bcb8f94bc23..ca183f17312f 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2634,22 +2634,6 @@ public: } }; -/** For adjusting relative tab references. */ -class RelativeTabRefUpdater -{ - SCTAB mnOldTab; - SCTAB mnNewTab; - sc::TargetTabState meMode; -public: - RelativeTabRefUpdater(SCTAB nOldTab, SCTAB nNewTab, sc::TargetTabState eMode) : - mnOldTab(nOldTab), mnNewTab(nNewTab), meMode(eMode) {} - - void operator() (size_t /*nRow*/, ScFormulaCell* pCell) - { - pCell->AdjustRelativeTabRefs(mnOldTab, mnNewTab, meMode); - } -}; - class UsedRangeNameFinder { sc::UpdatedRangeNames& mrIndexes; @@ -3080,12 +3064,6 @@ void ScColumn::UpdateInsertTabAbs(SCTAB nNewPos) CellStorageModified(); } -void ScColumn::AdjustRelativeTabRefs(SCTAB nOldTab, SCTAB nNewTab, sc::TargetTabState eMode) -{ - RelativeTabRefUpdater aFunc(nOldTab, nNewTab, eMode); - sc::ProcessFormula(maCells, aFunc); -} - void ScColumn::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo ) { nTab = nTabNo; diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 8328314c0662..0859ab9ac45c 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -1556,7 +1556,9 @@ void ScColumn::CopyFromClip( return; ScDocument& rDocument = GetDoc(); - if (rCxt.isAsLink() && rCxt.getInsertFlag() == InsertDeleteFlags::ALL) + // tdf#57274 - ignore objects since ScViewFunc::PasteFromClip removes the objects flag + if (rCxt.isAsLink() + && (rCxt.getInsertFlag() | InsertDeleteFlags::OBJECTS) == InsertDeleteFlags::ALL) { // We also reference empty cells for "ALL" // InsertDeleteFlags::ALL must always contain more flags when compared to "Insert contents" as diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 071ab15bfc85..fbd1a36e7c58 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -974,7 +974,7 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM { sc::TableContentCopier aHandler(*this, nOldPos, nNewPos); aHandler.performCopy(pOnlyMarked, ScCloneFlags::NamesToLocal, nPreviousSourceTabNo); - aHandler.updateReferencesAfterTabInsertion(aCxt, nPreviousSourceTabNo); + aHandler.updateReferencesAfterTabInsertion(aCxt); } SetNoListening(false); diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx index b43bab38c6e1..97c19be79be9 100644 --- a/sc/source/core/data/document10.cxx +++ b/sc/source/core/data/document10.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include #include @@ -1047,6 +1049,54 @@ bool ScDocument::HasDataProviderMappings() const return mpDataMapper && !mpDataMapper->getDataSources().empty(); } +namespace +{ +bool isRefreshingImport(const ScDBData* pData) +{ + return pData && pData->HasImportParam() && pData->GetRefreshDelaySeconds() > 0; +} +} + +bool ScDocument::HasRefreshingDBImport() const +{ + if (isRefreshingImport(mpAnonymousDBData.get())) + return true; + + if (pDBCollection) + { + for (const auto& rxData : pDBCollection->getNamedDBs()) + if (isRefreshingImport(rxData.get())) + return true; + for (const auto& rxData : pDBCollection->getAnonDBs()) + if (isRefreshingImport(rxData.get())) + return true; + } + + SCTAB nTabCount = GetTableCount(); + for (SCTAB nTab = 0; nTab < nTabCount; ++nTab) + { + const ScTable* pTable = FetchTable(nTab); + if (pTable && isRefreshingImport(pTable->GetAnonymousDBData())) + return true; + } + + return false; +} + +bool ScDocument::HasDataPilotDatabaseLink() const +{ + if (!pDPCollection) + return false; + + for (size_t i = 0, nCount = pDPCollection->GetCount(); i < nCount; ++i) + { + const ScImportSourceDesc* pDesc = (*pDPCollection)[i].GetImportSourceDesc(); + if (pDesc && !ScDPCollection::IsRegisteredDatabase(pDesc->aDBName)) + return true; + } + return false; +} + bool ScDocument::HasExternalLinks() const { if (ScExternalRefManager* pRefMgr = GetExternalRefManager(); pRefMgr && pRefMgr->hasExternalData()) @@ -1058,8 +1108,8 @@ bool ScDocument::HasExternalLinks() const if (IsLinked(nTab)) return true; - if (HasLinkFormulaNeedingCheck() || HasDataProviderMappings() - || GetDocLinkManager().hasUpdatableLinks()) + if (HasLinkFormulaNeedingCheck() || HasDataProviderMappings() || HasRefreshingDBImport() + || HasDataPilotDatabaseLink() || GetDocLinkManager().hasUpdatableLinks()) return true; const ScDrawLayer* pDrawLayer = GetDrawLayer(); diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index ab2b0f16509e..6a2d0c9b629a 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -3474,6 +3475,24 @@ bool ScDPCollection::DBType::less::operator() (const DBType& left, const DBType& ScDPCollection::DBCaches::DBCaches(ScDocument& rDoc) : mrDoc(rDoc) {} +bool ScDPCollection::IsRegisteredDatabase(const OUString& rDBName) +{ + if (rDBName.isEmpty()) + return false; + + try + { + uno::Reference xContext + = sdb::DatabaseContext::create(comphelper::getProcessComponentContext()); + return xContext->hasRegisteredDatabase(rDBName); + } + catch (const uno::Exception&) + { + TOOLS_WARN_EXCEPTION("sc", "ScDPCollection::IsRegisteredDatabase"); + } + return false; +} + bool ScDPCollection::DBCaches::hasCache(sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand) const { DBType aType(nSdbType, rDBName, rCommand); @@ -3532,6 +3551,17 @@ uno::Reference ScDPCollection::DBCaches::createRowSet( sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand) { uno::Reference xRowSet; + + // A database document named by URL is an external link, so it is opened only once the user + // allows link updates. + ScDocShell* pDocShell = mrDoc.GetDocumentShell(); + if (pDocShell && !pDocShell->GetEmbeddedObjectContainer().getUserAllowsLinkUpdate() + && !IsRegisteredDatabase(rDBName)) + { + SAL_WARN("sc", "data pilot source " << rDBName << " waits for link updates to be allowed"); + return xRowSet; + } + try { xRowSet.set(comphelper::getProcessServiceFactory()->createInstance( diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index 9d177f043bfa..fc0b9f0fd874 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -905,7 +905,7 @@ ScDPSaveDimension* ScDPSaveData::GetDimensionByName(const OUString& rName) for (auto const& iter : m_DimList) { if (iter->GetName() == rName && !iter->IsDataLayout() ) - return &(*iter); + return iter.get(); } return AppendNewDimension(rName, false); @@ -916,7 +916,7 @@ ScDPSaveDimension* ScDPSaveData::GetExistingDimensionByName(std::u16string_view for (auto const& iter : m_DimList) { if (iter->GetName() == rName && !iter->IsDataLayout() ) - return &(*iter); + return iter.get(); } return nullptr; // don't create new } @@ -946,7 +946,7 @@ ScDPSaveDimension* ScDPSaveData::GetExistingDataLayoutDimension() const for (auto const& iter : m_DimList) { if ( iter->IsDataLayout() ) - return &(*iter); + return iter.get(); } return nullptr; } @@ -1003,7 +1003,7 @@ ScDPSaveDimension* ScDPSaveData::GetFirstDimension(sheet::DataPilotFieldOrientat for (auto const& iter : m_DimList) { if (iter->GetOrientation() == eOrientation && !iter->IsDataLayout()) - return &(*iter); + return iter.get(); } return nullptr; } diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 9096748d4566..b46ae3fe7cea 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -895,7 +895,8 @@ ScFormulaCell::ScFormulaCell(const ScFormulaCell& rCell, ScDocument& rDoc, const if ((nCloneFlags & ScCloneFlags::AdjustCrossSheetRefs) != ScCloneFlags::Default) { - pCode->AdjustRelativeTabRefs(rCell.aPos.Tab(), aPos.Tab()); + SCTAB nDelta = aPos.Tab() - rCell.aPos.Tab(); + pCode->AdjustRelativeTabRefs(nDelta); } } @@ -4184,18 +4185,6 @@ void ScFormulaCell::UpdateInsertTabAbs(SCTAB nTable) } } -void ScFormulaCell::AdjustRelativeTabRefs(SCTAB nOldTab, SCTAB nNewTab, sc::TargetTabState eMode) -{ - if (rDocument.IsClipOrUndo()) - return; - - bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this; - if (!bAdjustCode) - return; - - pCode->AdjustRelativeTabRefs(nOldTab, nNewTab, eMode); -} - bool ScFormulaCell::TestTabRefAbs(SCTAB nTable) { if (rDocument.IsClipOrUndo()) diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index ad4be97da919..1ee138c98d28 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -2756,12 +2756,6 @@ void ScTable::UpdateInsertTabAbs(SCTAB nTable) aCol[i].UpdateInsertTabAbs(nTable); } -void ScTable::AdjustRelativeTabRefs(SCTAB nOldTab, SCTAB nNewTab, sc::TargetTabState eMode) -{ - for (SCCOL i=0; i < aCol.size(); i++) - aCol[i].AdjustRelativeTabRefs(nOldTab, nNewTab, eMode); -} - bool ScTable::GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel, const ScMarkData& rMark) const { diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 8e30a93823f7..3e4487facecc 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -2036,12 +2036,12 @@ static OUString getFileNameFromDoc( const ScDocument* pDoc ) // TODO : er points at ScGlobal::GetAbsDocName() // as a better template. Look into it OUString sFileName; - SfxObjectShell* pShell; + ScDocShell* pShell; if( nullptr != pDoc && nullptr != (pShell = pDoc->GetDocumentShell() ) ) { - uno::Reference< frame::XModel > xModel = pShell->GetModel(); + rtl::Reference< ScModelObj > xModel = pShell->GetModel(); if( xModel.is() ) { if( !xModel->getURL().isEmpty() ) diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index eac1dfb55ada..39b705680d99 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -367,10 +367,13 @@ ScAutoFormat::~ScAutoFormat() = default; const ScAutoFormatData* ScAutoFormat::GetData(size_t nIndex) const { - return &*mpImpl->maAutoFormats[nIndex]; + return mpImpl->maAutoFormats[nIndex].get(); } -ScAutoFormatData* ScAutoFormat::GetData(size_t nIndex) { return &*mpImpl->maAutoFormats[nIndex]; } +ScAutoFormatData* ScAutoFormat::GetData(size_t nIndex) +{ + return mpImpl->maAutoFormats[nIndex].get(); +} bool ScAutoFormat::InsertAutoFormat(SvxAutoFormatData* pFormat) { diff --git a/sc/source/core/tool/callable.cxx b/sc/source/core/tool/callable.cxx index fabb939c705e..2206f5315563 100644 --- a/sc/source/core/tool/callable.cxx +++ b/sc/source/core/tool/callable.cxx @@ -62,8 +62,13 @@ ScMacroFunction::ScMacroFunction(const ScInterpreter& rInterpreter, const OUStri return; } - // The macro security prompt is not raised here. CallBasic checks it when - // the macro actually runs. + // The macro mode is decided before the document's Basic is loaded. + if (!mpDocShell->AdjustMacroMode()) + { + mbInvalid = true; + mnError = FormulaError::NoMacro; + return; + } // Find the Basic method by name, then keep the library and macro name // strings that CallBasic needs to invoke it. diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 70f6f64c07a8..122df86ff9aa 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -3753,10 +3754,30 @@ bool ScCompiler::ParseReference( const OUString& rName, const OUString* pErrRef return false; } -bool ScCompiler::ParseMacro( const OUString& rName ) +#if HAVE_FEATURE_SCRIPTING +static bool lcl_IsBasicFunction( StarBASIC& rBasic, const OUString& rName ) +{ + SbxMethod* pMeth = static_cast(rBasic.Find( rName, SbxClassType::Method )); + if( !pMeth ) + { + return false; + } + // It really should be a BASIC function! + if( pMeth->GetType() == SbxVOID + || ( pMeth->IsFixed() && pMeth->GetType() == SbxEMPTY ) + || dynamic_cast( pMeth) == nullptr ) + { + return false; + } + return true; +} +#endif + +bool ScCompiler::ParseMacro( const OUString& rName, bool bParenFollows ) { #if !HAVE_FEATURE_SCRIPTING (void) rName; + (void) bParenFollows; return false; #else @@ -3780,9 +3801,36 @@ bool ScCompiler::ParseMacro( const OUString& rName ) } OUString aName( rName); + // ODFF recommends to store user-defined functions prefixed with "USER.", + // use only unprefixed name if encountered. BASIC doesn't allow '.' in a + // function name so a function "USER.FOO" could not exist, and macro check + // is assigned the lowest priority in function name check. + if (FormulaGrammar::isODFF( GetGrammar()) && aName.startsWithIgnoreAsciiCase("USER.")) + aName = aName.copy(5); + StarBASIC* pObj = nullptr; ScDocShell* pDocSh = rDoc.GetDocumentShell(); + // During ODF import the Basic of a document whose macros are not allowed yet stays unloaded. + // A called name that is not an application Basic function may be one of the document's own + // macros only if the document has Basic libraries. Such a call is kept as a macro call, and the + // document is flagged as calling macros. + if (pDocSh && rDoc.IsImportingXML() && !pDocSh->IsMacroExecutionAllowed()) + { + if (!bParenFollows) + return false; + StarBASIC* pAppBasic = SfxApplication::GetBasic(); + if (!pAppBasic || !lcl_IsBasicFunction(*pAppBasic, aName)) + { + if (!sfx2::DocumentMacroMode::containerHasBasicMacros(pDocSh->GetBasicContainer())) + return false; + pDocSh->SetMacroCallsSeenWhileLoading(); + } + maRawToken.SetExternal( aName ); + maRawToken.eOp = ocMacro; + return true; + } + try { if( pDocSh )//XXX @@ -3795,28 +3843,9 @@ bool ScCompiler::ParseMacro( const OUString& rName ) return false; } - if (!pObj) + if (!pObj || !lcl_IsBasicFunction(*pObj, aName)) return false; - // ODFF recommends to store user-defined functions prefixed with "USER.", - // use only unprefixed name if encountered. BASIC doesn't allow '.' in a - // function name so a function "USER.FOO" could not exist, and macro check - // is assigned the lowest priority in function name check. - if (FormulaGrammar::isODFF( GetGrammar()) && aName.startsWithIgnoreAsciiCase("USER.")) - aName = aName.copy(5); - - SbxMethod* pMeth = static_cast(pObj->Find( aName, SbxClassType::Method )); - if( !pMeth ) - { - return false; - } - // It really should be a BASIC function! - if( pMeth->GetType() == SbxVOID - || ( pMeth->IsFixed() && pMeth->GetType() == SbxEMPTY ) - || dynamic_cast( pMeth) == nullptr ) - { - return false; - } maRawToken.SetExternal( aName ); maRawToken.eOp = ocMacro; return true; @@ -4960,7 +4989,7 @@ Label_Rewind: if (!bParenFollows && ParseColRowName( aUpper )) return true; - if (ParseMacro( aUpper )) + if (ParseMacro( aUpper, bParenFollows )) return true; if (ParseOpCode( aUpper, bInArray )) @@ -5047,7 +5076,7 @@ Label_Rewind: // the same user-defined function, so in the call position the macro // takes priority over a same-named defined name. A plain name // reference still resolves as the named range. - if (bMayBeName && bParenFollows && ParseMacro(aUpper)) + if (bMayBeName && bParenFollows && ParseMacro(aUpper, bParenFollows)) return true; if (ParseNamedRange( aUpper )) @@ -5084,7 +5113,7 @@ Label_Rewind: if (bMayBeName) { - if (ParseMacro( aUpper )) + if (ParseMacro( aUpper, bParenFollows )) return true; if (ParseLocalName( aOrg )) diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index c14c757bfa15..1d8e594b3805 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -2627,25 +2627,8 @@ void ScTokenArray::AdjustAbsoluteRefs( const ScDocument& rOldDoc, const ScAddres } } -namespace +void ScTokenArray::AdjustRelativeTabRefs( SCTAB nDelta ) { - -void adjustRelativeTabRef(ScSingleRefData& rRef, SCTAB nOldTab, SCTAB nNewTab, bool bInsertedTab) -{ - if (!rRef.IsTabRel() || rRef.Tab() == 0) - return; - SCTAB nAbsTarget = nOldTab + rRef.Tab(); - if (bInsertedTab && nAbsTarget >= nNewTab) - nAbsTarget++; - SCTAB nNewOffset = nAbsTarget - nNewTab; - rRef.IncTab(nNewOffset - rRef.Tab()); -} - -} // anonymous namespace - -void ScTokenArray::AdjustRelativeTabRefs(SCTAB nOldTab, SCTAB nNewTab, sc::TargetTabState eMode) -{ - const bool bInsertedTab = (eMode == sc::TargetTabState::Inserted); TokenPointers aPtrs( pCode.get(), nLen, pRPN.get(), nRPN, true); for (size_t j=0; j<2; ++j) { @@ -2662,14 +2645,17 @@ void ScTokenArray::AdjustRelativeTabRefs(SCTAB nOldTab, SCTAB nNewTab, sc::Targe case svDoubleRef: { ScComplexRefData& rRef = static_cast(p)->GetDoubleRef(); - adjustRelativeTabRef(rRef.Ref1, nOldTab, nNewTab, bInsertedTab); - adjustRelativeTabRef(rRef.Ref2, nOldTab, nNewTab, bInsertedTab); + if (rRef.Ref1.IsTabRel() && rRef.Ref1.Tab() != 0) + rRef.Ref1.IncTab(-nDelta); + if (rRef.Ref2.IsTabRel() && rRef.Ref2.Tab() != 0) + rRef.Ref2.IncTab(-nDelta); break; } case svSingleRef: { ScSingleRefData& rRef = static_cast(p)->GetSingleRef(); - adjustRelativeTabRef(rRef, nOldTab, nNewTab, bInsertedTab); + if (rRef.IsTabRel() && rRef.Tab() != 0) + rRef.IncTab(-nDelta); break; } default: diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx index 73ef59dadc72..43383ce61cc2 100644 --- a/sc/source/filter/excel/frmbase.cxx +++ b/sc/source/filter/excel/frmbase.cxx @@ -18,6 +18,7 @@ */ #include +#include #include diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 80dab2adb885..3bd1c659a8e6 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1670,8 +1670,8 @@ OUString XclExpTbxControlObj::SaveControlPropertiesXml(XclExpXmlStream& rStrm) c { const sal_Int32 nDrawing = rStrm.getNewDrawingUniqueId(); sax_fastparser::FSHelperPtr pFormControl = rStrm.CreateOutputStream( - XclXmlUtils::GetStreamName( "xl/", "ctrlProps/ctrlProps", nDrawing ), - XclXmlUtils::GetStreamName( "../", "ctrlProps/ctrlProps", nDrawing ), + XclXmlUtils::GetStreamName( "xl/", "ctrlProps/ctrlProp", nDrawing ), + XclXmlUtils::GetStreamName( "../", "ctrlProps/ctrlProp", nDrawing ), rStrm.GetCurrentStream()->getOutputStream(), "application/vnd.ms-excel.controlproperties+xml", oox::getRelationship(Relationship::CTRLPROP), @@ -1715,8 +1715,8 @@ OUString XclExpTbxControlObj::SaveControlPropertiesXml(XclExpXmlStream& rStrm) c { sal_Int32 nDrawing = rStrm.getNewDrawingUniqueId(); sax_fastparser::FSHelperPtr pFormControl = rStrm.CreateOutputStream( - XclXmlUtils::GetStreamName("xl/", "ctrlProps/ctrlProps", nDrawing), - XclXmlUtils::GetStreamName("../", "ctrlProps/ctrlProps", nDrawing), + XclXmlUtils::GetStreamName("xl/", "ctrlProps/ctrlProp", nDrawing), + XclXmlUtils::GetStreamName("../", "ctrlProps/ctrlProp", nDrawing), rStrm.GetCurrentStream()->getOutputStream(), "application/vnd.ms-excel.controlproperties+xml", oox::getRelationship(Relationship::CTRLPROP), &sIdFormControlPr); diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index d162b9e419f1..5dbe4c9b38ff 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -244,14 +244,13 @@ void XclExpRoot::InitializeGlobals() SAL_WARN( "sc", "XclExpRoot::InitializeGlobals - no object shell"); break; } - uno::Reference< lang::XComponent > xComponent = pShell->GetModel(); - if (!xComponent.is()) + rtl::Reference< ScModelObj > xModel = pShell->GetModel(); + if (!xModel.is()) { SAL_WARN( "sc", "XclExpRoot::InitializeGlobals - no component"); break; } - uno::Reference< lang::XMultiServiceFactory > xModelFactory( xComponent, uno::UNO_QUERY); - oox::xls::OpCodeProvider aOpCodeProvider(xModelFactory, false); + oox::xls::OpCodeProvider aOpCodeProvider(xModel, false); // Compiler mocks about non-matching ctor or conversion from // Sequence<...> to Sequence if directly created or passed, // conversion through Any works around. diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 263823f0e3ec..9ee6284ce8ea 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -134,8 +135,6 @@ const char ScHTMLExport::sIndentSource[nIndentMax+1] = #define OUT_SP_CSTR_ASS( s ) rStrm.WriteChar(' ').WriteOString( s ).WriteChar( '=' ) -#define GLOBSTR(id) ScResId( id ) - void ScFormatFilterPluginImpl::ScExportHTML( SvStream& rStrm, const OUString& rBaseURL, ScDocument* pDoc, const ScRange& rRange, const rtl_TextEncoding /*eNach*/, bool bAll, const OUString& rStreamPath, OUString& rNonConvertibleChars, const OUString& rFilterOptions ) @@ -163,33 +162,17 @@ static OString lcl_getColGroupString(sal_Int32 nSpan, sal_Int32 nWidth) return aByteStr.makeStringAndClear(); } -static void lcl_AddStamp( OUString& rStr, std::u16string_view rName, - const css::util::DateTime& rDateTime, - const LocaleDataWrapper& rLoc ) +static void lcl_AddStamp(OUString& rStr, std::u16string_view rName, + const css::util::DateTime& rDateTime) { - Date aD(rDateTime.Day, rDateTime.Month, rDateTime.Year); - tools::Time aT(rDateTime.Hours, rDateTime.Minutes, rDateTime.Seconds, - rDateTime.NanoSeconds); - DateTime aDateTime(aD,aT); - - OUString aStrDate = rLoc.getDate( aDateTime ); - OUString aStrTime = rLoc.getTime( aDateTime ); - - rStr += GLOBSTR( STR_BY ) + " "; + rStr += u"by "_ustr; if (!rName.empty()) rStr += rName; else - rStr += "???"; - rStr += " " + GLOBSTR( STR_ON ) + " "; - if (!aStrDate.isEmpty()) - rStr += aStrDate; - else - rStr += "???"; - rStr += ", "; - if (!aStrTime.isEmpty()) - rStr += aStrTime; - else - rStr += "???"; + rStr += u"???"_ustr; + + rStr += u" on "_ustr; + rStr += utl::toISO8601(rDateTime); } static OString lcl_makeHTMLColorTriplet(const Color& rColor) @@ -336,10 +319,9 @@ void ScHTMLExport::WriteHeader() if (!xDocProps->getPrintedBy().isEmpty()) { - OUT_COMMENT( GLOBSTR( STR_DOC_INFO ) ); - OUString aStrOut = GLOBSTR( STR_DOC_PRINTED ) + ": "; - lcl_AddStamp( aStrOut, xDocProps->getPrintedBy(), - xDocProps->getPrintDate(), ScGlobal::getLocaleData() ); + OUT_COMMENT( u"Doc.Information" ); + OUString aStrOut = u"Printed: "_ustr; + lcl_AddStamp( aStrOut, xDocProps->getPrintedBy(), xDocProps->getPrintDate() ); OUT_COMMENT( aStrOut ); } diff --git a/sc/source/filter/inc/personsfragment.hxx b/sc/source/filter/inc/personsfragment.hxx index 7268644a9548..7814172e1c33 100644 --- a/sc/source/filter/inc/personsfragment.hxx +++ b/sc/source/filter/inc/personsfragment.hxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/source/filter/inc/threadedcommentsfragment.hxx b/sc/source/filter/inc/threadedcommentsfragment.hxx index dd2d74e570ba..b9d1fb4c90b7 100644 --- a/sc/source/filter/inc/threadedcommentsfragment.hxx +++ b/sc/source/filter/inc/threadedcommentsfragment.hxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/source/filter/oox/personsfragment.cxx b/sc/source/filter/oox/personsfragment.cxx index 953ee36c0dd2..b42f3ae11166 100644 --- a/sc/source/filter/oox/personsfragment.cxx +++ b/sc/source/filter/oox/personsfragment.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/source/filter/oox/threadedcommentsfragment.cxx b/sc/source/filter/oox/threadedcommentsfragment.cxx index 97a55de95105..2cd85f57061d 100644 --- a/sc/source/filter/oox/threadedcommentsfragment.cxx +++ b/sc/source/filter/oox/threadedcommentsfragment.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx index d6bc672a174a..696595cae826 100644 --- a/sc/source/filter/xcl97/xcl97esc.cxx +++ b/sc/source/filter/xcl97/xcl97esc.cxx @@ -414,7 +414,7 @@ std::unique_ptr XclEscherEx::CreateOCXCtrlObj( Reference< X // writes from xCtrlModel into mxCtlsStrm, raw class name returned in aClassName Reference< XOutputStream > xOut( new utl::OSeekableOutputStreamWrapper( *mxCtlsStrm ) ); - Reference< css::frame::XModel > xModel( GetDocShell() ? GetDocShell()->GetModel() : nullptr ); + rtl::Reference< ScModelObj > xModel( GetDocShell() ? GetDocShell()->GetModel() : nullptr ); if( xModel.is() && xOut.is() && oox::ole::MSConvertOCXControls::WriteOCXExcelKludgeStream( xModel, xOut, xCtrlModel, xShape->getSize(), aClassName ) ) { sal_uInt32 nStrmSize = static_cast< sal_uInt32 >( mxCtlsStrm->Tell() - nStrmStart ); diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 56a33bf86840..15d47f96180d 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -1687,9 +1687,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportFODS(SvStream &rStream) { ScDLL::Init(); - SfxObjectShellLock xDocSh(new ScDocShell); + rtl::Reference xDocSh(new ScDocShell); + SfxObjectShellLock xLock(xDocSh.get()); xDocSh->DoInitNew(); - uno::Reference xModel(xDocSh->GetModel()); + rtl::Reference xModel(xDocSh->GetModel()); uno::Reference xMultiServiceFactory(comphelper::getProcessServiceFactory()); uno::Reference xStream(new ::utl::OSeekableInputStreamWrapper(rStream)); @@ -1740,9 +1741,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestFODSExportXLS(SvStream &rStream) { ScDLL::Init(); - SfxObjectShellLock xDocSh(new ScDocShell); + rtl::Reference xDocSh(new ScDocShell); + SfxObjectShellLock xLock(xDocSh.get()); xDocSh->DoInitNew(); - uno::Reference xModel(xDocSh->GetModel()); + rtl::Reference xModel(xDocSh->GetModel()); uno::Reference xMultiServiceFactory(comphelper::getProcessServiceFactory()); uno::Reference xStream(new ::utl::OSeekableInputStreamWrapper(rStream)); @@ -1814,9 +1816,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportXLSX(SvStream &rStream) { ScDLL::Init(); - SfxObjectShellLock xDocSh(new ScDocShell); + rtl::Reference xDocSh(new ScDocShell); + SfxObjectShellLock xLock(xDocSh.get()); xDocSh->DoInitNew(); - uno::Reference xModel(xDocSh->GetModel()); + rtl::Reference xModel(xDocSh->GetModel()); uno::Reference xMultiServiceFactory(comphelper::getProcessServiceFactory()); uno::Reference xStream(new utl::OSeekableInputStreamWrapper(rStream)); diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index e7c2f7fbd4d7..d0f36de5eca0 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -290,7 +290,7 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCodeMsg& rError ) xStorage = pMedium->GetStorage(); // get filter - uno::Reference xModel = mrDocShell.GetModel(); + rtl::Reference xModel = mrDocShell.GetModel(); /** property map for export info set */ static comphelper::PropertyMapEntry const aImportInfoMap[] = @@ -318,10 +318,9 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCodeMsg& rError ) // ---- get BuildId from parent container if available - uno::Reference< container::XChild > xChild( xModel, uno::UNO_QUERY ); - if( xChild.is() ) + if( xModel.is() ) { - uno::Reference< beans::XPropertySet > xParentSet( xChild->getParent(), uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xParentSet( xModel->getParent(), uno::UNO_QUERY ); if( xParentSet.is() ) { uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xParentSet->getPropertySetInfo() ); @@ -382,13 +381,11 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCodeMsg& rError ) // RDF metadata: ODF >= 1.2 try { - const uno::Reference< rdf::XDocumentMetadataAccess > xDMA( - xModel, uno::UNO_QUERY_THROW ); const uno::Reference< rdf::XURI > xBaseURI( ::sfx2::createBaseURI( xContext, xModel, aBaseURL, aName ) ); uno::Reference xHandler = mrDocShell.GetMedium()->GetInteractionHandler(); - xDMA->loadMetadataFromStorage( xStorage, xBaseURI, xHandler ); + xModel->loadMetadataFromStorage( xStorage, xBaseURI, xHandler ); } catch ( const lang::WrappedTargetException & e) { @@ -534,19 +531,18 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCodeMsg& rError ) bool bRet = !rError.IsError(); - ::svx::DropUnusedNamedItems(xModel); + ::svx::DropUnusedNamedItems(cppu::getXWeak(xModel.get())); // set BuildId on XModel for later OLE object loading if( xInfoSet.is() ) { - uno::Reference< beans::XPropertySet > xModelSet( xModel, uno::UNO_QUERY ); - if( xModelSet.is() ) + if( xModel.is() ) { - uno::Reference< beans::XPropertySetInfo > xModelSetInfo( xModelSet->getPropertySetInfo() ); + uno::Reference< beans::XPropertySetInfo > xModelSetInfo( xModel->getPropertySetInfo() ); OUString sBuildPropName(u"BuildId"_ustr ); if( xModelSetInfo.is() && xModelSetInfo->hasPropertyByName(sBuildPropName) ) { - xModelSet->setPropertyValue( sBuildPropName, xInfoSet->getPropertyValue(sBuildPropName) ); + xModel->setPropertyValue( sBuildPropName, xInfoSet->getPropertyValue(sBuildPropName) ); } } @@ -563,9 +559,9 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCodeMsg& rError ) /* Set library container to VBA compatibility mode, this forces loading the Basic project, which in turn creates the VBA Globals object and does all related initialization. */ - if ( xModelSet.is() ) try + if ( xModel.is() ) try { - uno::Reference< script::vba::XVBACompatibility > xVBACompat( xModelSet->getPropertyValue( + uno::Reference< script::vba::XVBACompatibility > xVBACompat( xModel->getPropertyValue( u"BasicLibraries"_ustr ), uno::UNO_QUERY_THROW ); xVBACompat->setVBACompatibilityMode( true ); } @@ -763,11 +759,10 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly) if ( pObjSh && xStorage.is() ) { - uno::Reference xModel(pObjSh->GetModel()); + rtl::Reference xModel(pObjSh->GetModel()); // sorting wants to create undo actions assert(SfxObjectCreateMode::STANDARD != pObjSh->GetCreateMode() || rDoc.GetDrawLayer()->IsUndoEnabled()); - uno::Reference const xDPS(xModel, uno::UNO_QUERY); - uno::Reference const xDPs(xDPS->getDrawPages()); + uno::Reference const xDPs(xModel->getDrawPages()); assert(xDPs.is()); for (auto i = xDPs->getCount(); 0 < i; ) { @@ -852,9 +847,7 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly) && aVersion != ODFVER_010_TEXT && aVersion != ODFVER_011_TEXT ) { - const uno::Reference< rdf::XDocumentMetadataAccess > xDMA( - xModel, uno::UNO_QUERY_THROW ); - xDMA->storeMetadataToStorage( xStorage ); + xModel->storeMetadataToStorage( xStorage ); } } catch ( const beans::UnknownPropertyException &) diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index b08c545c7fda..54c2548ba9d1 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -23,6 +23,7 @@ #include #include +#include #include #include diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 70deffec5e9f..a7219ab00fec 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -20,6 +20,7 @@ #undef SC_DLLIMPLEMENTATION #include "scdlgfact.hxx" +#include #include #include diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index d3d5892cb490..2821597fe80f 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 38e638d19a3c..baa9292ff89c 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -22,6 +22,8 @@ #include #include +#include +#include #include #include #include diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 5d912c423a33..2be1114274ee 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -1163,6 +1163,11 @@ bool ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, bool bCopy, bool bRec IMPL_LINK( ScDocShell, RefreshDBDataHdl, Timer*, pRefreshTimer, void ) { + // The timer keeps running, so the import starts at the first refresh after the user allows + // link updates. + if (!GetEmbeddedObjectContainer().getUserAllowsLinkUpdate()) + return; + ScDBDocFunc aFunc(*this); ScDBData* pDBData = static_cast(pRefreshTimer); diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 41e73d62575d..312fa3e592f4 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -610,7 +610,7 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) bool bChanged = false; //! GetPortions and GetAttribs should be const! - EditEngine& rEditEng = const_cast(rOutliner.GetEditEngine()); + EditEngine& rEditEng = rOutliner.GetEditEngine(); sal_Int32 nParCount = rOutliner.GetParagraphCount(); for (sal_Int32 nPar=0; nPar +#include #include #include diff --git a/sc/source/ui/drawfunc/fuconcustomshape.cxx b/sc/source/ui/drawfunc/fuconcustomshape.cxx index c72accf9429d..d376cfdfdcac 100644 --- a/sc/source/ui/drawfunc/fuconcustomshape.cxx +++ b/sc/source/ui/drawfunc/fuconcustomshape.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/sc/source/ui/drawfunc/fuconpol.cxx b/sc/source/ui/drawfunc/fuconpol.cxx index 49a2e4ca055e..ea13c181abfe 100644 --- a/sc/source/ui/drawfunc/fuconpol.cxx +++ b/sc/source/ui/drawfunc/fuconpol.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx index 2a69e202d273..085ed441f7f3 100644 --- a/sc/source/ui/drawfunc/fuconrec.cxx +++ b/sc/source/ui/drawfunc/fuconrec.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include diff --git a/sc/source/ui/drawfunc/fuconstr.cxx b/sc/source/ui/drawfunc/fuconstr.cxx index cf41533747e7..f48326e182ea 100644 --- a/sc/source/ui/drawfunc/fuconstr.cxx +++ b/sc/source/ui/drawfunc/fuconstr.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/sc/source/ui/drawfunc/fuconuno.cxx b/sc/source/ui/drawfunc/fuconuno.cxx index 01fc06a257bc..1110864b5597 100644 --- a/sc/source/ui/drawfunc/fuconuno.cxx +++ b/sc/source/ui/drawfunc/fuconuno.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx index 49fa6c8a4b60..3801ca506395 100644 --- a/sc/source/ui/drawfunc/fudraw.cxx +++ b/sc/source/ui/drawfunc/fudraw.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index 1f18d7dc0661..a1684eec5fe2 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/sc/source/ui/inc/operation/InsertThreadedCommentOperation.hxx b/sc/source/ui/inc/operation/InsertThreadedCommentOperation.hxx index 347d8926799d..7a9156031cd6 100644 --- a/sc/source/ui/inc/operation/InsertThreadedCommentOperation.hxx +++ b/sc/source/ui/inc/operation/InsertThreadedCommentOperation.hxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 7b7248032ac7..8eb2cbc140a2 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -23,14 +23,15 @@ #include #include #include +#include #include #include "hiranges.hxx" #include "viewutil.hxx" #include "select.hxx" #include "gridwin.hxx" -#include "drawview.hxx" +class ScDrawView; class ScEditEngineDefaulter; class ScOutlineWindow; class ScRowBar; diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index c1fe4e40495c..3aef67717902 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -38,6 +40,9 @@ #include class SdrOle2Obj; +namespace com::sun::star::drawing { class XShapes; } +namespace com::sun::star::table { struct CellRangeAddress; } +class ScTableSheetObj; class SfxAbstractTabDialog; class SfxBindings; class SfxChildWindow; diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 9a5480406f17..e8c81402e123 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -18,6 +18,8 @@ */ #include +#include +#include #include #include #include diff --git a/sc/source/ui/operation/InsertThreadedCommentOperation.cxx b/sc/source/ui/operation/InsertThreadedCommentOperation.cxx index d3b30834b832..a783e9532fd2 100644 --- a/sc/source/ui/operation/InsertThreadedCommentOperation.cxx +++ b/sc/source/ui/operation/InsertThreadedCommentOperation.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx index b86f937ffafd..3a4fa120ec9b 100644 --- a/sc/source/ui/pagedlg/tphfedit.cxx +++ b/sc/source/ui/pagedlg/tphfedit.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/sc/source/ui/theme/ThemeColorChanger.cxx b/sc/source/ui/theme/ThemeColorChanger.cxx index d79277d48264..fce94fd11248 100644 --- a/sc/source/ui/theme/ThemeColorChanger.cxx +++ b/sc/source/ui/theme/ThemeColorChanger.cxx @@ -9,6 +9,7 @@ */ #include +#include #include #include diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx index 3c70015b9939..f5f94e10013e 100644 --- a/sc/source/ui/uitest/uiobject.cxx +++ b/sc/source/ui/uitest/uiobject.cxx @@ -9,6 +9,7 @@ #include #include +#include #include #include diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 91d63dcad362..31bae93e466e 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index a0454f8937bf..9e371c814628 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -2129,14 +2129,18 @@ uno::Any SAL_CALL ScDatabaseRangeObj::getPropertyValue( const OUString& aPropert { const ScTableStyleParam* pTableStyleInfo = GetDBData_Impl()->GetTableStyleInfo(); bool bVal = false; - if (aPropertyName == SC_UNONAME_ROW_STRIPES) - bVal = pTableStyleInfo->mbRowStripes; - else if (aPropertyName == SC_UNONAME_COL_STRIPES) - bVal = pTableStyleInfo->mbColumnStripes; - else if (aPropertyName == SC_UNONAME_FIRST_COL) - bVal = pTableStyleInfo->mbFirstColumn; - else if (aPropertyName == SC_UNONAME_LAST_COL) - bVal = pTableStyleInfo->mbLastColumn; + // tdf#170842 - check for missing table style info on plain database ranges + if (pTableStyleInfo) + { + if (aPropertyName == SC_UNONAME_ROW_STRIPES) + bVal = pTableStyleInfo->mbRowStripes; + else if (aPropertyName == SC_UNONAME_COL_STRIPES) + bVal = pTableStyleInfo->mbColumnStripes; + else if (aPropertyName == SC_UNONAME_FIRST_COL) + bVal = pTableStyleInfo->mbFirstColumn; + else if (aPropertyName == SC_UNONAME_LAST_COL) + bVal = pTableStyleInfo->mbLastColumn; + } aRet <<= bVal; } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 6f5d2ea239b3..134e9438631a 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 914f6aaab16e..e108dda59182 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -256,7 +256,7 @@ ScVbaApplication::hasProperty( const OUString& Name ) uno::Reference< excel::XWorkbook > ScVbaApplication::getActiveWorkbook() { - uno::Reference< frame::XModel > xModel( getCurrentExcelDoc( mxContext ), uno::UNO_SET_THROW ); + rtl::Reference< ScModelObj > xModel( dynamic_cast(getCurrentExcelDoc( mxContext ).get()) ); uno::Reference< excel::XWorkbook > xWorkbook( getVBADocument( xModel ), uno::UNO_QUERY ); if( xWorkbook.is() ) return xWorkbook; // #i116936# getVBADocument() may return null in documents without global VBA mode enabled @@ -266,7 +266,7 @@ ScVbaApplication::getActiveWorkbook() uno::Reference< excel::XWorkbook > SAL_CALL ScVbaApplication::getThisWorkbook() { - uno::Reference< frame::XModel > xModel( getThisExcelDoc( mxContext ), uno::UNO_SET_THROW ); + rtl::Reference< ScModelObj > xModel( dynamic_cast(getThisExcelDoc( mxContext ).get()) ); uno::Reference< excel::XWorkbook > xWorkbook( getVBADocument( xModel ), uno::UNO_QUERY ); if( xWorkbook.is() ) return xWorkbook; // #i116936# getVBADocument() may return null in documents without global VBA mode enabled @@ -481,7 +481,7 @@ ScVbaApplication::Dialogs( const uno::Any &aIndex ) uno::Reference< excel::XWindow > SAL_CALL ScVbaApplication::getActiveWindow() { - uno::Reference< frame::XModel > xModel = getCurrentDocument(); + rtl::Reference< ScModelObj > xModel = getCurrentDocument(); uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); uno::Reference< XHelperInterface > xParent( getActiveWorkbook(), uno::UNO_QUERY_THROW ); uno::Reference< excel::XWindow > xWin( new ScVbaWindow( xParent, mxContext, xModel, xController ) ); @@ -551,7 +551,7 @@ ScVbaApplication::setStatusBar( const uno::Any& _statusbar ) ScVbaApplication::getCalculation() { // TODO: in Excel, this is an application-wide setting - uno::Reference xCalc(getCurrentDocument(), uno::UNO_QUERY_THROW); + rtl::Reference xCalc(getCurrentDocument()); if(xCalc->isAutomaticCalculationEnabled()) return excel::XlCalculation::xlCalculationAutomatic; else @@ -562,7 +562,7 @@ void SAL_CALL ScVbaApplication::setCalculation( ::sal_Int32 _calculation ) { // TODO: in Excel, this is an application-wide setting - uno::Reference< sheet::XCalculatable > xCalc(getCurrentDocument(), uno::UNO_QUERY_THROW); + rtl::Reference< ScModelObj > xCalc(getCurrentDocument()); switch(_calculation) { case excel::XlCalculation::xlCalculationManual: @@ -978,9 +978,8 @@ ScVbaApplication::setIteration( sal_Bool bSet ) void SAL_CALL ScVbaApplication::Calculate() { - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_SET_THROW ); - uno::Reference< sheet::XCalculatable > xCalculatable( getCurrentDocument(), uno::UNO_QUERY_THROW ); - xCalculatable->calculateAll(); + rtl::Reference< ScModelObj > xModel( getCurrentDocument() ); + xModel->calculateAll(); } /// @throws uno::RuntimeException @@ -1429,10 +1428,10 @@ ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) return aRet; } -uno::Reference< frame::XModel > +ScModelObj* ScVbaApplication::getCurrentDocument() { - return getCurrentExcelDoc(mxContext); + return dynamic_cast(getCurrentExcelDoc(mxContext).get()); } uno::Any SAL_CALL diff --git a/sc/source/ui/vba/vbaapplication.hxx b/sc/source/ui/vba/vbaapplication.hxx index e2bbc49cf60c..05e2501f6c08 100644 --- a/sc/source/ui/vba/vbaapplication.hxx +++ b/sc/source/ui/vba/vbaapplication.hxx @@ -26,6 +26,7 @@ #include #include #include +#include namespace com::sun::star::uno { class XComponentContext; } namespace ooo::vba { class XSink; } @@ -53,7 +54,7 @@ private: comphelper::InvocationHelper m_aInvocationHelper; protected: - virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() override; + virtual ScModelObj* getCurrentDocument() override; public: explicit ScVbaApplication( const css::uno::Reference< css::uno::XComponentContext >& m_xContext ); diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx index a866b7c6105e..20b442857490 100644 --- a/sc/source/ui/vba/vbaformat.cxx +++ b/sc/source/ui/vba/vbaformat.cxx @@ -61,12 +61,12 @@ template< typename... Ifc > ScVbaFormat< Ifc... >::ScVbaFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, uno::Reference< beans::XPropertySet > _xPropertySet, - uno::Reference< frame::XModel > xModel, + const rtl::Reference< ScModelObj >& xModel, bool bCheckAmbiguoity ) : ScVbaFormat_BASE( xParent, xContext ), m_aDefaultLocale( u"en"_ustr, u"US"_ustr, OUString() ), mxPropertySet(std::move( _xPropertySet )), - mxModel(std::move( xModel )), + mxModel( xModel ), mbCheckAmbiguoity( bCheckAmbiguoity ), mbAddIndent( false ) { @@ -773,7 +773,7 @@ ScVbaFormat< Ifc... >::initializeNumberFormats() { if ( !xNumberFormats.is() ) { - mxNumberFormatsSupplier.set( mxModel, uno::UNO_QUERY_THROW ); + mxNumberFormatsSupplier.set( cppu::getXWeak(mxModel.get()), uno::UNO_QUERY_THROW ); xNumberFormats = mxNumberFormatsSupplier->getNumberFormats(); xNumberFormatTypes.set( xNumberFormats, uno::UNO_QUERY ); // _THROW? } diff --git a/sc/source/ui/vba/vbaformat.hxx b/sc/source/ui/vba/vbaformat.hxx index a85818ddd214..696e01286580 100644 --- a/sc/source/ui/vba/vbaformat.hxx +++ b/sc/source/ui/vba/vbaformat.hxx @@ -20,6 +20,7 @@ #include #include +#include namespace com::sun::star::beans { class XPropertySet; } namespace com::sun::star::beans { class XPropertyState; } @@ -31,6 +32,7 @@ namespace ooo::vba::excel { class XFont; } namespace ooo::vba::excel { class XInterior; } class ScCellRangesBase; +class ScModelObj; class SfxItemSet; template< typename... Ifc > @@ -43,7 +45,7 @@ protected: css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier; css::uno::Reference< css::util::XNumberFormats > xNumberFormats; css::uno::Reference< css::util::XNumberFormatTypes > xNumberFormatTypes; - css::uno::Reference< css::frame::XModel > mxModel; + rtl::Reference< ScModelObj > mxModel; css::uno::Reference< css::beans::XPropertyState > xPropertyState; bool mbCheckAmbiguoity; bool mbAddIndent; @@ -61,7 +63,7 @@ protected: virtual ScCellRangesBase* getCellRangesBase(); public: /// @throws css::script::BasicErrorException - ScVbaFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, css::uno::Reference< css::beans::XPropertySet > _xPropertySet, css::uno::Reference< css::frame::XModel > xModel, bool bCheckAmbiguoity ); + ScVbaFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, css::uno::Reference< css::beans::XPropertySet > _xPropertySet, const rtl::Reference& xModel, bool bCheckAmbiguoity ); virtual css::uno::Reference< ov::XHelperInterface > thisHelperIface() = 0; /// @throws css::uno::RuntimeException void SAL_CALL setAddIndent( const css::uno::Any& BAddIndent) { BAddIndent >>= mbAddIndent; } diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 77ccc0129e87..1aedfe261fad 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -388,14 +388,14 @@ getDocShellFromRanges( const uno::Reference< sheet::XSheetCellRangeContainer >& } /// @throws uno::RuntimeException -static uno::Reference< frame::XModel > getModelFromXIf( const uno::Reference< uno::XInterface >& xIf ) +static rtl::Reference< ScModelObj > getModelFromXIf( const uno::Reference< uno::XInterface >& xIf ) { ScDocShell* pDocShell = getDocShellFromIf(xIf ); return pDocShell->GetModel(); } /// @throws uno::RuntimeException -static uno::Reference< frame::XModel > getModelFromRange( const uno::Reference< table::XCellRange >& xRange ) +static rtl::Reference< ScModelObj > getModelFromRange( const uno::Reference< table::XCellRange >& xRange ) { // the XInterface for getImplementation can be any derived interface, no need for queryInterface uno::Reference< uno::XInterface > xIf( xRange ); @@ -480,7 +480,7 @@ class NumFormatHelper public: explicit NumFormatHelper( const uno::Reference< table::XCellRange >& xRange ) { - mxSupplier.set( getModelFromRange( xRange ), uno::UNO_QUERY_THROW ); + mxSupplier.set( cppu::getXWeak(getModelFromRange( xRange ).get()), uno::UNO_QUERY_THROW ); mxRangeProps.set( xRange, uno::UNO_QUERY_THROW); mxFormats = mxSupplier->getNumberFormats(); } @@ -1418,7 +1418,14 @@ lcl_setupBorders( const uno::Reference< excel::XRange >& xParentRange, const uno } ScVbaRange::ScVbaRange( uno::Sequence< uno::Any> const & args, - uno::Reference< uno::XComponentContext> const & xContext ) : ScVbaRange_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ), getModelFromXIf( getXSomethingFromArgs< uno::XInterface >( args, 1 ) ), true ), mbIsRows( false ), mbIsColumns( false ) + uno::Reference< uno::XComponentContext> const & xContext ) + : ScVbaRange_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), + xContext, + getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ), + getModelFromXIf( getXSomethingFromArgs< uno::XInterface >( args, 1 ) ), + true ), + mbIsRows( false ), + mbIsColumns( false ) { mxRange.set( mxPropertySet, uno::UNO_QUERY ); mxRanges.set( mxPropertySet, uno::UNO_QUERY ); @@ -5374,8 +5381,8 @@ ScVbaRange::getStyle() OUString sStyleName; xProps->getPropertyValue( CELLSTYLE ) >>= sStyleName; ScDocShell* pShell = getScDocShell(); - uno::Reference< frame::XModel > xModel( pShell->GetModel() ); - uno::Reference< excel::XStyle > xStyle = new ScVbaStyle( this, mxContext, sStyleName, xModel ); + ScModelObj* pModel( pShell->GetModel() ); + uno::Reference< excel::XStyle > xStyle = new ScVbaStyle( this, mxContext, sStyleName, pModel ); return uno::Any( xStyle ); } void SAL_CALL diff --git a/sc/source/ui/vba/vbastyle.cxx b/sc/source/ui/vba/vbastyle.cxx index 86eedeac344d..92e435e63a73 100644 --- a/sc/source/ui/vba/vbastyle.cxx +++ b/sc/source/ui/vba/vbastyle.cxx @@ -21,6 +21,7 @@ #include #include #include +#include using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -28,17 +29,18 @@ using namespace ::com::sun::star; constexpr OUString DISPLAYNAME = u"DisplayName"_ustr; uno::Reference< container::XNameAccess > -ScVbaStyle::getStylesNameContainer( const uno::Reference< frame::XModel >& xModel ) +ScVbaStyle::getStylesNameContainer( const rtl::Reference& xModel ) { - uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( xModel, uno::UNO_QUERY_THROW); - uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName(u"CellStyles"_ustr), uno::UNO_QUERY_THROW ); + if (!xModel) + throw uno::RuntimeException(); + uno::Reference< container::XNameAccess > xStylesAccess( xModel->getStyleFamilies()->getByName(u"CellStyles"_ustr), uno::UNO_QUERY_THROW ); return xStylesAccess; } /// @throws script::BasicErrorException /// @throws uno::RuntimeException static uno::Reference< beans::XPropertySet > -lcl_getStyleProps( const OUString& sStyleName, const uno::Reference< frame::XModel >& xModel ) +lcl_getStyleProps( const OUString& sStyleName, const rtl::Reference& xModel ) { uno::Reference< beans::XPropertySet > xStyleProps( ScVbaStyle::getStylesNameContainer( xModel )->getByName( sStyleName ), uno::UNO_QUERY_THROW ); @@ -56,14 +58,12 @@ void ScVbaStyle::initialise() } mxStyle.set( mxPropertySet, uno::UNO_QUERY_THROW ); - uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxModel, uno::UNO_QUERY_THROW ); mxStyleFamilyNameContainer.set( ScVbaStyle::getStylesNameContainer( mxModel ), uno::UNO_QUERY_THROW ); - } ScVbaStyle::ScVbaStyle( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, - const OUString& sStyleName, const uno::Reference< frame::XModel >& _xModel ) + const OUString& sStyleName, const rtl::Reference& _xModel ) : ScVbaStyle_BASE( xParent, xContext, lcl_getStyleProps( sStyleName, _xModel ), _xModel, false ) { try @@ -79,7 +79,7 @@ ScVbaStyle::ScVbaStyle( const uno::Reference< ov::XHelperInterface >& xParent, ScVbaStyle::ScVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet, - const uno::Reference< frame::XModel >& _xModel ) + const rtl::Reference& _xModel ) : ScVbaStyle_BASE( xParent, xContext, _xPropertySet, _xModel, false ) { try diff --git a/sc/source/ui/vba/vbastyle.hxx b/sc/source/ui/vba/vbastyle.hxx index cc002ce6ff64..df565e75fc18 100644 --- a/sc/source/ui/vba/vbastyle.hxx +++ b/sc/source/ui/vba/vbastyle.hxx @@ -25,6 +25,8 @@ #include #include "vbaformat.hxx" +class ScModelObj; + typedef ScVbaFormat< ov::excel::XStyle > ScVbaStyle_BASE; class ScVbaStyle final : public ScVbaStyle_BASE @@ -37,12 +39,12 @@ class ScVbaStyle final : public ScVbaStyle_BASE public: /// @throws css::script::BasicErrorException /// @throws css::uno::RuntimeException - ScVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const OUString& sStyleName, const css::uno::Reference< css::frame::XModel >& _xModel ); + ScVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const OUString& sStyleName, const rtl::Reference& _xModel ); /// @throws css::script::BasicErrorException /// @throws css::uno::RuntimeException - ScVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet, const css::uno::Reference< css::frame::XModel >& _xModel ); + ScVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet, const rtl::Reference& _cModel ); /// @throws css::uno::RuntimeException - static css::uno::Reference< css::container::XNameAccess > getStylesNameContainer( const css::uno::Reference< css::frame::XModel >& xModel ); + static css::uno::Reference< css::container::XNameAccess > getStylesNameContainer( const rtl::Reference& xModel ); virtual css::uno::Reference< ov::XHelperInterface > thisHelperIface() override { return this; }; // XStyle Methods virtual sal_Bool SAL_CALL BuiltIn() override; diff --git a/sc/source/ui/vba/vbastyles.cxx b/sc/source/ui/vba/vbastyles.cxx index 8e1aa8cb2ca4..829f420e767d 100644 --- a/sc/source/ui/vba/vbastyles.cxx +++ b/sc/source/ui/vba/vbastyles.cxx @@ -24,12 +24,13 @@ #include #include #include +#include using namespace ::ooo::vba; using namespace ::com::sun::star; static css::uno::Any -lcl_createAPIStyleToVBAObject( const css::uno::Any& aObject, const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) +lcl_createAPIStyleToVBAObject( const css::uno::Any& aObject, const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::Reference& xModel ) { uno::Reference< beans::XPropertySet > xStyleProps( aObject, uno::UNO_QUERY_THROW ); uno::Reference< excel::XStyle > xStyle( new ScVbaStyle( xParent, xContext, xStyleProps, xModel ) ); @@ -38,15 +39,15 @@ lcl_createAPIStyleToVBAObject( const css::uno::Any& aObject, const uno::Referenc ScVbaStyles::ScVbaStyles( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, - const uno::Reference< frame::XModel >& xModel ) + ScModelObj* pModel ) : ScVbaStyles_BASE( xParent, xContext, - uno::Reference< container::XIndexAccess >( ScVbaStyle::getStylesNameContainer( xModel ), uno::UNO_QUERY_THROW ) ), - mxModel( xModel ) + uno::Reference< container::XIndexAccess >( ScVbaStyle::getStylesNameContainer( pModel ), uno::UNO_QUERY_THROW ) ), + mxModel( pModel ) { try { - mxMSF.set( mxModel, uno::UNO_QUERY_THROW ); + mxMSF = mxModel; mxNameContainerCellStyles.set( m_xNameAccess, uno::UNO_QUERY_THROW ); } catch (uno::Exception& ) @@ -80,11 +81,11 @@ class EnumWrapper : public EnumerationHelper_BASE uno::Reference m_xIndexAccess; uno::Reference m_xParent; uno::Reference m_xContext; - uno::Reference m_xModel; + rtl::Reference m_xModel; sal_Int32 nIndex; public: - EnumWrapper( uno::Reference< container::XIndexAccess > xIndexAccess, uno::Reference xParent, uno::Reference xContext, uno::Reference xModel ) : m_xIndexAccess(std::move( xIndexAccess )), m_xParent(std::move( xParent )), m_xContext(std::move( xContext )), m_xModel(std::move( xModel )), nIndex( 0 ) {} + EnumWrapper( uno::Reference< container::XIndexAccess > xIndexAccess, uno::Reference xParent, uno::Reference xContext, rtl::Reference xModel ) : m_xIndexAccess(std::move( xIndexAccess )), m_xParent(std::move( xParent )), m_xContext(std::move( xContext )), m_xModel(std::move( xModel )), nIndex( 0 ) {} virtual sal_Bool SAL_CALL hasMoreElements( ) override { return ( nIndex < m_xIndexAccess->getCount() ); diff --git a/sc/source/ui/vba/vbastyles.hxx b/sc/source/ui/vba/vbastyles.hxx index 78990bca969c..fad786e948c4 100644 --- a/sc/source/ui/vba/vbastyles.hxx +++ b/sc/source/ui/vba/vbastyles.hxx @@ -19,19 +19,21 @@ #pragma once #include #include +#include namespace com::sun::star::lang { class XMultiServiceFactory; } namespace com::sun::star::container { class XNameContainer; } +class ScModelObj; typedef CollTestImplHelper< ov::excel::XStyles > ScVbaStyles_BASE; class ScVbaStyles: public ScVbaStyles_BASE { - css::uno::Reference< css::frame::XModel > mxModel; + rtl::Reference< ScModelObj > mxModel; css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF; css::uno::Reference< css::container::XNameContainer > mxNameContainerCellStyles; public: /// @throws css::script::BasicErrorException - ScVbaStyles( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel ); + ScVbaStyles( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, ScModelObj* pModel ); /// @throws css::uno::RuntimeException css::uno::Sequence< OUString > getStyleNames(); /// @throws css::script::BasicErrorException diff --git a/sc/source/ui/vba/vbatextboxshape.cxx b/sc/source/ui/vba/vbatextboxshape.cxx index d7d02112177f..39e038497fe9 100644 --- a/sc/source/ui/vba/vbatextboxshape.cxx +++ b/sc/source/ui/vba/vbatextboxshape.cxx @@ -18,6 +18,8 @@ */ #include "excelvbahelper.hxx" +#include +#include #include "vbatextboxshape.hxx" #include "vbacharacters.hxx" #include diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index c9847e6d523d..4ee3a1cc5949 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -190,7 +190,7 @@ public: ScVbaWindow::ScVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, - const uno::Reference< frame::XModel >& xModel, + const rtl::Reference< ScModelObj >& xModel, const uno::Reference< frame::XController >& xController ) : WindowImpl_BASE( xParent, xContext, xController ), m_xModel(xModel) @@ -202,7 +202,7 @@ ScVbaWindow::ScVbaWindow( const uno::Sequence< uno::Any >& args, const uno::Reference< uno::XComponentContext >& xContext ) : WindowImpl_BASE( args, xContext ), - m_xModel(getXSomethingFromArgs< frame::XModel >( args, 1, false )) + m_xModel(dynamic_cast(getXSomethingFromArgs< frame::XModel >( args, 1, false ).get())) { init(); } @@ -729,7 +729,7 @@ void SAL_CALL ScVbaWindow::setZoom(const uno::Any& _zoom) { sal_Int16 nZoom = 100; _zoom >>= nZoom; - uno::Reference xSpreadDoc( m_xModel, uno::UNO_QUERY_THROW ); + uno::Reference xSpreadDoc( m_xModel ); uno::Reference< excel::XWorksheet > xActiveSheet = ActiveSheet(); SCTAB nTab = 0; if ( !ScVbaWorksheets::nameExists (xSpreadDoc, xActiveSheet->getName(), nTab) ) diff --git a/sc/source/ui/vba/vbawindow.hxx b/sc/source/ui/vba/vbawindow.hxx index bb84719a6be3..0a6e0cf1b205 100644 --- a/sc/source/ui/vba/vbawindow.hxx +++ b/sc/source/ui/vba/vbawindow.hxx @@ -27,12 +27,14 @@ #include +class ScModelObj; + typedef cppu::ImplInheritanceHelper< VbaWindowBase, ov::excel::XWindow > WindowImpl_BASE; class ScVbaWindow : public WindowImpl_BASE { private: - css::uno::Reference m_xModel; + rtl::Reference m_xModel; css::uno::Reference< ov::excel::XPane > m_xPane; void init(); @@ -55,7 +57,7 @@ public: ScVbaWindow( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, - const css::uno::Reference< css::frame::XModel >& xModel, + const rtl::Reference< ScModelObj >& xModel, const css::uno::Reference< css::frame::XController >& xController ); /// @throws css::uno::RuntimeException ScVbaWindow( diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx index 4b36116c6c4e..9807be7ce626 100644 --- a/sc/source/ui/vba/vbawindows.cxx +++ b/sc/source/ui/vba/vbawindows.cxx @@ -41,7 +41,7 @@ using namespace ::ooo::vba; typedef std::unordered_map< OUString, sal_Int32 > NameIndexHash; -static uno::Reference< XHelperInterface > lcl_createWorkbookHIParent( const uno::Reference< frame::XModel >& xModel, const uno::Reference< uno::XComponentContext >& xContext, const uno::Any& aApplication ) +static uno::Reference< XHelperInterface > lcl_createWorkbookHIParent( const rtl::Reference< ScModelObj >& xModel, const uno::Reference< uno::XComponentContext >& xContext, const uno::Any& aApplication ) { return new ScVbaWorkbook( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel ); } @@ -49,9 +49,10 @@ static uno::Reference< XHelperInterface > lcl_createWorkbookHIParent( const uno: static uno::Any ComponentToWindow( const uno::Any& aSource, const uno::Reference< uno::XComponentContext > & xContext, const uno::Any& aApplication ) { uno::Reference< frame::XModel > xModel( aSource, uno::UNO_QUERY_THROW ); + ScModelObj* pModel = dynamic_cast(xModel.get()); // !! TODO !! iterate over all controllers - uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); - uno::Reference< excel::XWindow > xWin( new ScVbaWindow( lcl_createWorkbookHIParent( xModel, xContext, aApplication ), xContext, xModel, xController ) ); + uno::Reference< frame::XController > xController( pModel->getCurrentController(), uno::UNO_SET_THROW ); + uno::Reference< excel::XWindow > xWin( new ScVbaWindow( lcl_createWorkbookHIParent( pModel, xContext, aApplication ), xContext, pModel, xController ) ); return uno::Any( xWin ); } @@ -144,7 +145,10 @@ public: if ( xNext.is() ) { m_windows.push_back( xNext ); - uno::Reference< frame::XModel > xModel( xNext, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given + // that the spreadsheetdocument is a xmodel is a given + rtl::Reference xModel = dynamic_cast(xNext.get()); + if (!xModel) + throw uno::RuntimeException(); // tdf#126457 - add workbook name to window titles rtl::Reference workbook(new ScVbaWorkbook( diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx index 7abf25406248..8c58603e00d7 100644 --- a/sc/source/ui/vba/vbaworkbook.cxx +++ b/sc/source/ui/vba/vbaworkbook.cxx @@ -190,7 +190,7 @@ ScVbaWorkbook::init() ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, - css::uno::Reference< css::frame::XModel > const & xModel ) + rtl::Reference< ScModelObj > const & xModel ) : ScVbaWorkbook_BASE( xParent, xContext ), mxModel(xModel) { @@ -200,7 +200,7 @@ ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& ScVbaWorkbook::ScVbaWorkbook( uno::Sequence< uno::Any> const & args, uno::Reference< uno::XComponentContext> const & xContext ) : ScVbaWorkbook_BASE( args, xContext ), - mxModel(getXSomethingFromArgs< frame::XModel >( args, 1 )) + mxModel(dynamic_cast(getXSomethingFromArgs< frame::XModel >( args, 1 ).get())) { init(); } @@ -263,8 +263,7 @@ ScVbaWorkbook::Protect( const uno::Any &aPassword ) sal_Bool ScVbaWorkbook::getProtectStructure() { - uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); - return xProt->isProtected(); + return getModel()->isProtected(); } sal_Bool SAL_CALL ScVbaWorkbook::getPrecisionAsDisplayed() @@ -290,7 +289,7 @@ void SAL_CALL ScVbaWorkbook::setPrecisionAsDisplayed( sal_Bool _precisionAsDispl OUString SAL_CALL ScVbaWorkbook::getAuthor() { - uno::Reference xDPS( getModel(), uno::UNO_QUERY ); + rtl::Reference xDPS( getModel() ); if (!xDPS.is()) return u"?"_ustr; uno::Reference xDocProps = xDPS->getDocumentProperties(); @@ -299,7 +298,7 @@ OUString SAL_CALL ScVbaWorkbook::getAuthor() void SAL_CALL ScVbaWorkbook::setAuthor( const OUString& _author ) { - uno::Reference xDPS( getModel(), uno::UNO_QUERY ); + rtl::Reference xDPS( getModel() ); if (!xDPS.is()) return; uno::Reference xDocProps = xDPS->getDocumentProperties(); @@ -311,7 +310,7 @@ ScVbaWorkbook::SaveCopyAs( const OUString& sFileName ) { OUString aURL; osl::FileBase::getFileURLFromSystemPath( sFileName, aURL ); - uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW ); + rtl::Reference< ScModelObj > xStor( getModel() ); uno::Sequence< beans::PropertyValue > storeProps{ comphelper::makePropertyValue( u"FilterName"_ustr, SC_XL97_FILTER_NAME) }; xStor->storeToURL( aURL, storeProps ); @@ -358,7 +357,7 @@ ScVbaWorkbook::SaveAs( const uno::Any& FileName, const uno::Any& FileFormat, con uno::Sequence storeProps{ comphelper::makePropertyValue(u"FilterName"_ustr, uno::Any()) }; setFilterPropsFromFormat( nFileFormat, storeProps ); - uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW ); + rtl::Reference< ScModelObj > xStor( getModel() ); xStor->storeAsURL( sURL, storeProps ); } @@ -417,7 +416,7 @@ ScVbaWorkbook::getServiceNames() OUString SAL_CALL ScVbaWorkbook::getCodeName() { - uno::Reference< beans::XPropertySet > xModelProp( getModel(), uno::UNO_QUERY_THROW ); + rtl::Reference< ScModelObj > xModelProp( getModel() ); return xModelProp->getPropertyValue(u"CodeName"_ustr).get< OUString >(); } diff --git a/sc/source/ui/vba/vbaworkbook.hxx b/sc/source/ui/vba/vbaworkbook.hxx index d6ee4b016779..af0dddc523b8 100644 --- a/sc/source/ui/vba/vbaworkbook.hxx +++ b/sc/source/ui/vba/vbaworkbook.hxx @@ -22,6 +22,7 @@ #include #include #include +#include typedef cppu::ImplInheritanceHelper< VbaDocumentBase, ov::excel::XWorkbook > ScVbaWorkbook_BASE; @@ -31,14 +32,14 @@ class ScVbaWorkbook : public ScVbaWorkbook_BASE static bool setFilterPropsFromFormat( sal_Int32 nFormat, css::uno::Sequence< css::beans::PropertyValue >& rProps ); void init(); - css::uno::Reference< css::frame::XModel > mxModel; + rtl::Reference< ScModelObj > mxModel; protected: - virtual css::uno::Reference< css::frame::XModel > getModel() const override { return mxModel; } + virtual ScModelObj* getModel() const override { return mxModel.get(); } public: ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, - css::uno::Reference< css::frame::XModel > const & xModel ); + rtl::Reference< ScModelObj > const & xModel ); ScVbaWorkbook( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ); // Attributes diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx index 468124764bdf..d1982e70d885 100644 --- a/sc/source/ui/vba/vbaworkbooks.cxx +++ b/sc/source/ui/vba/vbaworkbooks.cxx @@ -42,11 +42,10 @@ const sal_Int16 CUSTOM_CHAR = 5; static uno::Any getWorkbook( const uno::Reference< uno::XComponentContext >& xContext, - const uno::Reference< sheet::XSpreadsheetDocument > &xDoc, + const rtl::Reference< ScModelObj > &xModel, const uno::Reference< XHelperInterface >& xParent ) { // FIXME: fine as long as ScVbaWorkbook is stateless ... - uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY ); if( !xModel.is() ) return uno::Any(); @@ -71,7 +70,7 @@ public: virtual uno::Any SAL_CALL nextElement( ) override { uno::Reference< sheet::XSpreadsheetDocument > xDoc( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); - return getWorkbook( m_xContext, xDoc, m_xParent ); + return getWorkbook( m_xContext, static_cast(xDoc.get()), m_xParent ); } }; @@ -102,7 +101,7 @@ uno::Any ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource ) { uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY_THROW ); - return getWorkbook( mxContext, xDoc, mxParent ); + return getWorkbook( mxContext, dynamic_cast(xDoc.get()), mxParent ); } uno::Any SAL_CALL @@ -147,7 +146,7 @@ ScVbaWorkbooks::Add( const uno::Any& Template ) if (!xSpreadDoc.is()) return uno::Any(); - uno::Any aRet = getWorkbook( mxContext, xSpreadDoc, mxParent ); + uno::Any aRet = getWorkbook( mxContext, dynamic_cast(xSpreadDoc.get()), mxParent ); uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY ); if (xWBook.is()) xWBook->Activate(); @@ -266,7 +265,7 @@ ScVbaWorkbooks::Open( const OUString& rFileName, const uno::Any& /*UpdateLinks*/ throw uno::RuntimeException(u"Bad Format"_ustr ); uno::Reference xSpreadDoc( openDocument( rFileName, ReadOnly, sProps ), uno::UNO_QUERY_THROW ); - uno::Any aRet = getWorkbook( mxContext, xSpreadDoc, mxParent ); + uno::Any aRet = getWorkbook( mxContext, dynamic_cast(xSpreadDoc.get()), mxParent ); uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY ); if ( xWBook.is() ) xWBook->Activate(); diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx index b9e40a7283b0..b12516319d80 100644 --- a/sc/source/ui/view/cliputil.cxx +++ b/sc/source/ui/view/cliputil.cxx @@ -8,6 +8,7 @@ */ #include +#include #include #include #include diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx index b6653cdb86e5..780bf0ee6c44 100644 --- a/sc/source/ui/view/colrowba.cxx +++ b/sc/source/ui/view/colrowba.cxx @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index 5645f5a47ae8..55fe84701c41 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 70caf85056b7..f738ab661b3a 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index 3748bf71c0fe..8ddfeb036c0c 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/sc/source/ui/view/output3.cxx b/sc/source/ui/view/output3.cxx index 61fcfbfc731d..3d1bfbe3148b 100644 --- a/sc/source/ui/view/output3.cxx +++ b/sc/source/ui/view/output3.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index df84d38eab7e..0d793d15d784 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 5eb25ba65650..dfb079a7d242 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include diff --git a/sc/source/ui/view/tabsplit.cxx b/sc/source/ui/view/tabsplit.cxx index 14118c26392a..26c74c77a1c6 100644 --- a/sc/source/ui/view/tabsplit.cxx +++ b/sc/source/ui/view/tabsplit.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 3f4661b0af58..e3bfb03fd9f2 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index b7fd6ac965f8..660aa6bc6eb9 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include +#include #include #include #include diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 04f8cc346f60..0a9aa6970899 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1881,8 +1881,8 @@ static bool lcl_CheckInArrayCols(std::vector>& nUniqueRe rtl::Reference ScTabViewShell::GetRangeWithSheet(css::table::CellRangeAddress& rRangeData, bool& bHasData, bool bHasUnoArguments) { // get spreadsheet document model & controller - uno::Reference xModel(GetViewData().GetDocShell()->GetModel()); - uno::Reference xController(xModel->getCurrentController()); + ScModelObj* pModel(GetViewData().GetDocShell()->GetModel()); + uno::Reference xController(pModel->getCurrentController()); // spreadsheet's extension of com.sun.star.frame.Controller service ScTabViewObj* pSpreadsheetDocument = dynamic_cast(xController.get()); @@ -1952,30 +1952,27 @@ void ScTabViewShell::HandleDuplicateRecordsHighlight(const rtl::Reference xModel(GetViewData().GetDocShell()->GetModel()); + ScModelObj* pModel(GetViewData().GetDocShell()->GetModel()); rtl::Reference xSheetRange( ActiveSheet->getScCellRangeByPosition(aRange.StartColumn, aRange.StartRow, aRange.EndColumn, aRange.EndRow)); uno::Sequence> aDataArray = xSheetRange->getDataArray(); - uno::Reference< document::XUndoManagerSupplier > xUndoManager( xModel, uno::UNO_QUERY ); - uno::Reference xLockable(xModel, uno::UNO_QUERY); - ScDocument& rDoc = GetViewData().GetDocShell()->GetDocument(); comphelper::ScopeGuard aUndoContextGuard( - [&xUndoManager, &xLockable, &xModel, &rDoc] { - xUndoManager->getUndoManager()->leaveUndoContext(); - xLockable->removeActionLock(); - if (xModel->hasControllersLocked()) - xModel->unlockControllers(); + [pModel, &rDoc] { + pModel->getUndoManager()->leaveUndoContext(); + pModel->removeActionLock(); + if (pModel->hasControllersLocked()) + pModel->unlockControllers(); rDoc.UnlockAdjustHeight(); }); rDoc.LockAdjustHeight(); - xModel->lockControllers(); - xLockable->addActionLock(); - xUndoManager->getUndoManager()->enterUndoContext("HandleDuplicateRecords"); + pModel->lockControllers(); + pModel->addActionLock(); + pModel->getUndoManager()->enterUndoContext("HandleDuplicateRecords"); bool nModifier = false; // modifier key pressed? bool bNoDuplicatesForSelection = true; @@ -2052,34 +2049,30 @@ void ScTabViewShell::HandleDuplicateRecordsRemove(const rtl::Reference xModel(GetViewData().GetDocShell()->GetModel()); + ScModelObj* pModel(GetViewData().GetDocShell()->GetModel()); rtl::Reference xSheetRange( ActiveSheet->getScCellRangeByPosition(aRange.StartColumn, aRange.StartRow, aRange.EndColumn, aRange.EndRow)); uno::Sequence> aDataArray = xSheetRange->getDataArray(); - uno::Reference< document::XUndoManagerSupplier > xUndoManager( xModel, uno::UNO_QUERY ); - uno::Reference xLockable(xModel, uno::UNO_QUERY); - - uno::Reference xCalculatable(xModel, uno::UNO_QUERY); - bool bAutoCalc = xCalculatable->isAutomaticCalculationEnabled(); + bool bAutoCalc = pModel->isAutomaticCalculationEnabled(); ScDocument& rDoc = GetViewData().GetDocShell()->GetDocument(); comphelper::ScopeGuard aUndoContextGuard( - [&xUndoManager, &xLockable, &xModel, &xCalculatable, &bAutoCalc, &rDoc] { - xUndoManager->getUndoManager()->leaveUndoContext(); - xCalculatable->enableAutomaticCalculation(bAutoCalc); - xLockable->removeActionLock(); - if (xModel->hasControllersLocked()) - xModel->unlockControllers(); + [pModel, &bAutoCalc, &rDoc] { + pModel->getUndoManager()->leaveUndoContext(); + pModel->enableAutomaticCalculation(bAutoCalc); + pModel->removeActionLock(); + if (pModel->hasControllersLocked()) + pModel->unlockControllers(); rDoc.UnlockAdjustHeight(); }); rDoc.LockAdjustHeight(); - xModel->lockControllers(); - xLockable->addActionLock(); - xCalculatable->enableAutomaticCalculation(true); - xUndoManager->getUndoManager()->enterUndoContext("HandleDuplicateRecords"); + pModel->lockControllers(); + pModel->addActionLock(); + pModel->enableAutomaticCalculation(true); + pModel->getUndoManager()->enterUndoContext("HandleDuplicateRecords"); if (bDuplicateRows) { diff --git a/sc/source/ui/view/tabvwsh9.cxx b/sc/source/ui/view/tabvwsh9.cxx index 86d5c0cdcb8c..ae10048bc850 100644 --- a/sc/source/ui/view/tabvwsh9.cxx +++ b/sc/source/ui/view/tabvwsh9.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 850b135a710a..eceeeb81e08e 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -198,14 +199,8 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) SfxViewFrame& rThisFrame = GetViewFrame(); bool bOle = GetViewFrame().GetFrame().IsInPlace(); - SCTAB nTabSelCount = rMark.GetSelectCount(); SCTAB nCountVisible = 0; const SCTAB nTabCount = rDoc.GetTableCount(); - for ( SCTAB i = 0; nCountVisible < 2 && i < nTabCount ; i++ ) - if ( rDoc.IsVisible( i ) ) - ++nCountVisible; - const bool bOnlyOneVisibleSheet = nCountVisible < 2; - bool bAllSelected = true; SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); @@ -284,7 +279,10 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) rSet.Put( SfxUInt16Item( nWhich, static_cast(GetViewData().GetTabNumber()) + 1 ) ); // enabled only if several sheets are visible - if ( bOnlyOneVisibleSheet ) + for ( SCTAB i = 0; nCountVisible < 2 && i < nTabCount ; i++ ) + if ( rDoc.IsVisible( i ) ) + ++nCountVisible; + if ( nCountVisible < 2 ) rSet.DisableItem( nWhich ); break; @@ -555,20 +553,14 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) break; case FID_TAB_DESELECTALL: - if ( nTabSelCount == 1 ) + if ( rMark.GetSelectCount() == 1 ) rSet.DisableItem( nWhich ); // enabled only if several sheets are selected break; case FID_TAB_SELECTALL: - if ( bOnlyOneVisibleSheet ) - rSet.DisableItem( nWhich ); // enabled only if several sheets are visible - else - { - for ( SCTAB i = 0; i < nTabCount && bAllSelected; i++ ) - bAllSelected = !( rDoc.IsVisible(i) && !rMark.GetTableSelect(i) ); - if ( bAllSelected ) - rSet.DisableItem( nWhich ); // disabled if all sheets are already selected - } + // tdf#173835 count visible and hidden sheets + if ( rDoc.GetTableCount() == rMark.GetSelectCount() ) + rSet.DisableItem( nWhich ); // disabled if all sheets are already selected break; case FID_TOGGLEHIDDENCOLROW: diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 5f166a9cd78c..471357c46a8d 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -18,6 +18,8 @@ */ #include +#include +#include #include #include #include diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index d5808897527c..a35aaa6c4d97 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx index f7532e6f0016..3507675c5715 100644 --- a/sc/source/ui/view/tabvwshh.cxx +++ b/sc/source/ui/view/tabvwshh.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index e1e78cd88a8a..316d4099543e 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include #include diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index cc8392dd4797..689018d9ab71 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -18,6 +18,7 @@ */ #include +#include #include diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 9cce9a688bea..20866c9f82a1 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include diff --git a/sc/uiconfig/scalc/ui/notebookbar.ui b/sc/uiconfig/scalc/ui/notebookbar.ui index 57aec5fd2db0..9de4fa6379cc 100644 --- a/sc/uiconfig/scalc/ui/notebookbar.ui +++ b/sc/uiconfig/scalc/ui/notebookbar.ui @@ -7939,7 +7939,7 @@ True - + True False 6 @@ -7949,16 +7949,16 @@ 3 3 - + True False - Freeze + Panes - + @@ -8016,7 +8016,7 @@ - + @@ -8174,33 +8174,33 @@ - - + + True False 3 - 6 + 3 6 6 3 3 - + True False - Options + View - + 0 2 - 6 + 4 @@ -8210,35 +8210,11 @@ vertical - 6 + 4 0 3 - - - True - True - center - True - both-horiz - False - - - True - .uno:Sidebar - - - False - True - - - - - 1 - 0 - - True @@ -8259,7 +8235,7 @@ - 2 + 1 0 @@ -8283,7 +8259,7 @@ - 2 + 1 1 @@ -8307,7 +8283,7 @@ - 3 + 2 0 @@ -8331,7 +8307,7 @@ - 3 + 2 1 @@ -8353,7 +8329,7 @@ - 4 + 3 0 @@ -8375,73 +8351,7 @@ - 4 - 1 - - - - - True - False - both-horiz - False - - - True - .uno:ViewColumnRowHighlighting - - - False - True - - - - - 5 - 0 - - - - - True - False - both-horiz - False - - - True - .uno:ViewHiddenColRow - - - False - True - - - - - 5 - 1 - - - - - True - False - both-horiz - False - - - True - .uno:FunctionBox - - - False - True - - - - - 1 + 3 1 @@ -8471,6 +8381,148 @@ 2 + + + + + + False + True + 2 + + + + + + True + False + 3 + 6 + 6 + 6 + 3 + 3 + + + True + False + Options + + + + + + + + + + 0 + 2 + 2 + + + + + True + False + vertical + + + 2 + 0 + 3 + + + + + True + False + both-horiz + False + + + True + .uno:ViewColumnRowHighlighting + + + False + True + + + + + 1 + 0 + + + + + True + False + both-horiz + False + + + True + .uno:ViewHiddenColRow + + + False + True + + + + + 1 + 1 + + + + + True + False + both-horiz + False + + + True + .uno:DesignerDialog + + + False + True + + + + + 0 + 1 + + + + + True + True + center + True + both-horiz + False + + + True + .uno:Sidebar + + + False + True + + + + + 0 + 0 + + diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx index f87373153f0c..c9a15d36aea0 100644 --- a/scripting/source/provider/MasterScriptProvider.cxx +++ b/scripting/source/provider/MasterScriptProvider.cxx @@ -51,15 +51,6 @@ using namespace ::sf_misc; namespace func_provider { -static bool endsWith( std::u16string_view target, std::u16string_view item ) -{ - size_t index = target.find( item ); - return index != std::u16string_view::npos && - index == ( target.size() - item.size() ); -} - -/* should be available in some central location. */ - // XScriptProvider implementation @@ -286,7 +277,7 @@ MasterScriptProvider::getScript( const OUString& scriptURI ) if ( ( location == "document" && m_xModel.is() ) - || ( endsWith( m_sCtxString, location ) ) + || ( m_sCtxString == location ) || ( language == "Basic" ) ) { diff --git a/sd/CppunitTest_sd_export_tests-ooxml3.mk b/sd/CppunitTest_sd_export_tests-ooxml3.mk index 4e79f4ccd9cc..88b15f953261 100644 --- a/sd/CppunitTest_sd_export_tests-ooxml3.mk +++ b/sd/CppunitTest_sd_export_tests-ooxml3.mk @@ -11,7 +11,4 @@ $(eval $(call sd_export_test,-ooxml3)) -$(call gb_CppunitTest_get_target,sd_export_tests-ooxml3): \ - $(call gb_Package_get_target,postprocess_images) - # vim: set noet sw=4 ts=4: diff --git a/sd/CppunitTest_sd_export_tests-ooxml5.mk b/sd/CppunitTest_sd_export_tests-ooxml5.mk new file mode 100644 index 000000000000..0e75dc1e9ef6 --- /dev/null +++ b/sd/CppunitTest_sd_export_tests-ooxml5.mk @@ -0,0 +1,14 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#************************************************************************* +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +#************************************************************************* + +$(eval $(call sd_export_test,-ooxml5)) + +# vim: set noet sw=4 ts=4: diff --git a/sd/Module_sd.mk b/sd/Module_sd.mk index 0890fcad4b19..3117aa752bc6 100644 --- a/sd/Module_sd.mk +++ b/sd/Module_sd.mk @@ -41,6 +41,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sd,\ CppunitTest_sd_export_tests-ooxml2 \ CppunitTest_sd_export_tests-ooxml3 \ CppunitTest_sd_export_tests-ooxml4 \ + CppunitTest_sd_export_tests-ooxml5 \ CppunitTest_sd_export_tests \ CppunitTest_sd_export_tests2 \ CppunitTest_sd_filters_test \ diff --git a/sd/inc/SdSoundLink.hxx b/sd/inc/SdSoundLink.hxx index 0d9b00884dae..38db4bd9d97e 100644 --- a/sd/inc/SdSoundLink.hxx +++ b/sd/inc/SdSoundLink.hxx @@ -1,8 +1,6 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc index 2d884d43d3c5..cab549e851c8 100644 --- a/sd/inc/strings.hrc +++ b/sd/inc/strings.hrc @@ -144,6 +144,8 @@ #define STR_GOTO_SLIDE_DLG_TITLE NC_("STR_GOTO_SLIDE_DLG_TITLE", "Go to Slide") #define STR_CLICK_ACTION_BOOKMARK NC_("STR_CLICK_ACTION_BOOKMARK", "Go to page or object") #define STR_CLICK_ACTION_DOCUMENT NC_("STR_CLICK_ACTION_DOCUMENT", "Go to document") +#define STR_CLICK_ACTION_INVISIBLE NC_("STR_CLICK_ACTION_INVISIBLE", "Hide object") +#define STR_CLICK_ACTION_VANISH NC_("STR_CLICK_ACTION_VANISH", "Hide object with effect") #define STR_CLICK_ACTION_SOUND NC_("STR_CLICK_ACTION_SOUND", "Play audio") #define STR_CLICK_ACTION_VERB NC_("STR_CLICK_ACTION_VERB", "Start object action") #define STR_CLICK_ACTION_PROGRAM NC_("STR_CLICK_ACTION_PROGRAM", "Run program") diff --git a/sd/qa/unit/data/pptx/empty-title-placeholder.pptx b/sd/qa/unit/data/pptx/empty-title-placeholder.pptx new file mode 100644 index 000000000000..26e27115e25f Binary files /dev/null and b/sd/qa/unit/data/pptx/empty-title-placeholder.pptx differ diff --git a/sd/qa/unit/data/pptx/tdf173712-liststyle.pptx b/sd/qa/unit/data/pptx/tdf173712-liststyle.pptx new file mode 100644 index 000000000000..150d2ada5ad4 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf173712-liststyle.pptx differ diff --git a/sd/qa/unit/data/pptx/tdf173712.pptx b/sd/qa/unit/data/pptx/tdf173712.pptx new file mode 100644 index 000000000000..47686f00efd1 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf173712.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx index 97116c2dd5f8..33fd9cb8ae72 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -9,16 +9,11 @@ #include "sdmodeltestbase.hxx" #include -#include -#include -#include #include #include #include #include #include -#include -#include #include #include @@ -27,23 +22,15 @@ #include #include #include -#include -#include #include #include #include -#include -#include -#include #include #include -#include -#include #include #include -#include #include class SdOOXMLExportTest4 : public SdModelTestBase @@ -1074,6 +1061,30 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testPicturePlaceholderCustomPromptText) assertXPath(pDefault, aPicPlaceholder + "/p:txBody/a:bodyPr", 1); assertXPath(pDefault, aPicPlaceholder + "/p:txBody/a:p", 1); assertXPath(pDefault, aPicPlaceholder + "/p:txBody/a:p/a:r", 0); + // The paragraph still states what text put there would look like + assertXPath(pDefault, aPicPlaceholder + "/p:txBody/a:p/a:endParaRPr", 1); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testEmptyTitlePlaceholderFormatting) +{ + // Given a slide holding a title placeholder nothing was typed into, which its layout formats + // 22pt in the light scheme colour, not bold, indented: + createSdImpressDoc("pptx/empty-title-placeholder.pptx"); + save(TestFilter::PPTX); + + static constexpr OString aTitle( + "/p:sld/p:cSld/p:spTree/p:sp[p:nvSpPr/p:nvPr/p:ph/@type='title']/p:txBody/a:p"_ostr); + xmlDocUniquePtr pSlide = parseExport(u"ppt/slides/slide1.xml"_ustr); + + // Without the fix the paragraph was written bare, and PowerPoint showed the title + // bold black at 17pt, not white at 22pt + assertXPath(pSlide, aTitle + "/a:pPr", "marL", u"717480"); + assertXPath(pSlide, aTitle + "/a:endParaRPr", "sz", u"2200"); + assertXPath(pSlide, aTitle + "/a:endParaRPr", "b", u"0"); + assertXPath(pSlide, aTitle + "/a:endParaRPr/a:solidFill/a:schemeClr", "val", u"lt1"); + + // The prompt shown in it is Impress's own, and stays out of the file + assertXPath(pSlide, aTitle + "/a:r", 0); } CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testEnhancedPathViewBox) @@ -1329,1291 +1340,6 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testAutofittedTextboxIndent) u"1080000"); } -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf151622_oleIcon) -{ - createSdImpressDoc("odp/ole_icon.odp"); - - save(TestFilter::PPTX); - - xmlDocUniquePtr pXml = parseExport(u"ppt/slides/slide1.xml"_ustr); - - // Without the accompanying fix in place, this test would have failed with: - // - Expression: prop - // - In ..., XPath '//p:oleObj' no attribute 'showAsIcon' exist - // i.e. show as icon option wasn't exported. - assertXPath(pXml, "//p:oleObj", "showAsIcon", u"1"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf152436) -{ - createSdImpressDoc("pptx/ole-emf_min.pptx"); - saveAndReload(TestFilter::PPTX); - - // Check number of shapes after export. - CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0)->getCount()); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testLinkedOLE) -{ - // The linked OLE object needs its link completed during load so it can - // be exported. Use FULL_UPDATE since the default test mode defers links. - uno::Sequence aParams = { - comphelper::makePropertyValue(u"UpdateDocMode"_ustr, - sal_Int16(css::document::UpdateDocMode::FULL_UPDATE)), - }; - loadFromFile(u"odp/linked_ole.odp", aParams); - - save(TestFilter::PPTX); - - xmlDocUniquePtr pXml = parseExport(u"ppt/slides/slide1.xml"_ustr); - - // Without the accompanying fix in place, this test would have failed with: - // - Expected: 1 - // - Actual : 0 - // - In<>, XPath '//p:oleObj' number of nodes is incorrect - // i.e. the linked ole object wasn't exported. - assertXPath(pXml, "//p:oleObj", 1); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf102261_testParaTabStopDefaultDistance) -{ - createSdImpressDoc("pptx/tdf102261_testParaTabStopDefaultDistance.pptx"); - saveAndReload(TestFilter::PPTX); - - uno::Reference xShape(getShapeFromPage(0, 0)); - { - uno::Reference xPropSet(getParagraphFromShape(0, xShape), - uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL( - sal_Int32{ 1270 }, - xPropSet->getPropertyValue(u"ParaTabStopDefaultDistance"_ustr).get()); - } - { - uno::Reference xPropSet(getParagraphFromShape(1, xShape), - uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL( - sal_Int32{ 2540 }, - xPropSet->getPropertyValue(u"ParaTabStopDefaultDistance"_ustr).get()); - } -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testNotesAuthorDate) -{ - createSdImpressDoc("pptx/pres-with-notes.pptx"); - - using ScriptingCfg = officecfg::Office::Common::Security::Scripting; - ScopedConfigValue aCfg1(true); - { - // 1. Remove all personal info, but keep note info - ScopedConfigValue aCfg2(true); - - saveAndReload(TestFilter::PPTX); - - xmlDocUniquePtr pXml = parseExport(u"ppt/commentAuthors.xml"_ustr); - assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=0]", "name", u"Hans Wurst"); - assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=1]", "name", u"Max Muster"); - - pXml = parseExport(u"ppt/comments/comment1.xml"_ustr); - assertXPath(pXml, "/p:cmLst/p:cm", "dt", u"2024-06-13T12:03:08.000000000"); - } - - { - // 2. Remove all personal info - ScopedConfigValue aCfg2(false); - saveAndReload(TestFilter::PPTX); - - xmlDocUniquePtr pXml = parseExport(u"ppt/commentAuthors.xml"_ustr); - assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=0]", "name", u"Author1"); - assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=1]", "name", u"Author2"); - - pXml = parseExport(u"ppt/comments/comment1.xml"_ustr); - assertXPathNoAttribute(pXml, "/p:cmLst/p:cm", "dt"); - } -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTableCellVerticalPropertyRoundtrip) -{ - createSdImpressDoc("pptx/tcPr-vert-roundtrip.pptx"); - saveAndReload(TestFilter::PPTX); - - xmlDocUniquePtr pXml = parseExport(u"ppt/slides/slide1.xml"_ustr); - - assertXPath(pXml, "(//a:tcPr)[1]", "vert", u"vert"); - assertXPath(pXml, "(//a:tcPr)[2]", "vert", u"vert270"); - assertXPath(pXml, "(//a:tcPr)[3]", "vert", u"wordArtVert"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf157740_slideMasters) -{ - createSdImpressDoc("pptx/tdf157740.pptx"); - saveAndReload(TestFilter::PPTX); - - // The original file has 1 slide master and 7 slide layouts in that master - xmlDocUniquePtr pXmlDocContent = parseExport(u"ppt/presentation.xml"_ustr); - assertXPath(pXmlDocContent, "/p:presentation/p:sldMasterIdLst/p:sldMasterId", 1); - - pXmlDocContent = parseExport(u"ppt/slideMasters/slideMaster1.xml"_ustr); - assertXPath(pXmlDocContent, "/p:sldMaster/p:sldLayoutIdLst/p:sldLayoutId", 7); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf159931_slideLayouts) -{ - createSdImpressDoc("odp/repeatBitmapMode.odp"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDocRels1 = parseExport(u"ppt/slides/_rels/slide1.xml.rels"_ustr); - xmlDocUniquePtr pXmlDocRels2 = parseExport(u"ppt/slides/_rels/slide2.xml.rels"_ustr); - - assertXPath(pXmlDocRels1, "(/rels:Relationships/rels:Relationship[@Type='http://" - "schemas.openxmlformats.org/officeDocument/2006/relationships/" - "slideLayout'])"); - - // the relative target e.g. "../slideLayouts/slideLayout2.xml" - OUString sRelativeLayoutPath1 - = getXPathContent(pXmlDocRels1, "(/rels:Relationships/rels:Relationship[@Type='http://" - "schemas.openxmlformats.org/officeDocument/2006/" - "relationships/slideLayout'])/@Target"); - - assertXPath(pXmlDocRels2, "(/rels:Relationships/rels:Relationship[@Type='http://" - "schemas.openxmlformats.org/officeDocument/2006/relationships/" - "slideLayout'])"); - - // the relative target e.g. "../slideLayouts/slideLayout1.xml" - OUString sRelativeLayoutPath2 - = getXPathContent(pXmlDocRels2, "(/rels:Relationships/rels:Relationship[@Type='http://" - "schemas.openxmlformats.org/officeDocument/2006/" - "relationships/slideLayout'])/@Target"); - - uno::Reference xNameAccess - = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), - maTempFile.GetURL()); - - // Check that the referenced slideLayout files exist - // Without the accompanying fix in place, this test would have failed with: - // equality assertion failed - // - Expected: 1 - // - Actual : 0 - // i.e. the referenced slideLayout file was missing on export. - OUString sSlideLayoutName1 = sRelativeLayoutPath1.getToken(2, '/'); - OUString sSlideLayoutName2 = sRelativeLayoutPath2.getToken(2, '/'); - - CPPUNIT_ASSERT_EQUAL(true, - bool(xNameAccess->hasByName("ppt/slideLayouts/" + sSlideLayoutName1))); - CPPUNIT_ASSERT_EQUAL(true, - bool(xNameAccess->hasByName("ppt/slideLayouts/" + sSlideLayoutName2))); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf163483_export_math_fallback) -{ - createSdImpressDoc("odp/formula.fodp"); - - // Before export-and-reload, there is a formula on page. - { - auto xProps = getShapeFromPage(0, 0); - auto xInfo = xProps->getPropertyValue(u"Model"_ustr).queryThrow(); - CPPUNIT_ASSERT(xInfo->supportsService(u"com.sun.star.formula.FormulaProperties"_ustr)); - - // tdf#164101: check that the size is imported correctly - css::awt::Size formulaSize = xProps.queryThrow()->getSize(); - CPPUNIT_ASSERT_EQUAL(sal_Int32(1553), formulaSize.Width); - CPPUNIT_ASSERT_EQUAL(sal_Int32(528), formulaSize.Height); - - CPPUNIT_ASSERT_THROW(getShapeFromPage(0, 1), - css::lang::IndexOutOfBoundsException); // Only one shape on page - } - - saveAndReload(TestFilter::PPTX); - - // After save-and-reload, there must still be a single shape; now it's a fallback image. - // When we start to import formulas from PPTX, that will be formula. - { - // Without the fix, this threw IndexOutOfBoundsException, because there was no fallback, - // and no shape got imported. - auto xInfo = getShapeFromPage(0, 0).queryThrow(); - CPPUNIT_ASSERT(xInfo->supportsService(u"com.sun.star.drawing.CustomShape"_ustr)); - - css::awt::Size formulaSize = xInfo.queryThrow()->getSize(); - // The fallback image size after the roundtrip may be a bit different - allow some tolerance - CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1553), formulaSize.Width, 1); - CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(528), formulaSize.Height, 1); - - CPPUNIT_ASSERT_THROW(getShapeFromPage(0, 1), - css::lang::IndexOutOfBoundsException); // Only one shape on page - } - - xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - - const OUString cNvPr_id = getXPath( - pXmlDoc, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:nvSpPr/p:cNvPr", - "id"); - - // Check that the alternate content is exported - assertXPath( - pXmlDoc, - "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Fallback/p:sp/p:spPr/a:blipFill/a:blip", - "embed", u"rId1"); - - // Its cNvPr_id must be the same - assertXPath(pXmlDoc, - "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Fallback/p:sp/p:nvSpPr/p:cNvPr", - "id", cNvPr_id); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf169979_missing_ppic) -{ - createSdImpressDoc("odp/tdf169979.odp"); - - save(TestFilter::PPTX); - - xmlDocUniquePtr pXml2 = parseExport(u"ppt/slides/slide2.xml"_ustr); - - // Without the fix in place, this test would have failed with - // - Expected: 1 - // - Actual : 0 - // - In <>, XPath '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj/p:pic/p:nvPicPr/p:cNvPr' number of nodes is incorrect - assertXPath(pXml2, - "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/" - "a:graphicData/p:oleObj/p:pic/p:nvPicPr/p:cNvPr", - "name", u""); - - assertXPath(pXml2, - "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/" - "a:graphicData/p:oleObj/p:pic/p:nvPicPr/p:cNvPr", - "descr", u""); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testEmptyChildTnLstElement) -{ - createSdImpressDoc("odp/emptyChildTnLstElement.odp"); - - // Without the fix in place, this test would have failed with - // - Expected: 0 - // - Actual : 4 - // - validation error in OOXML export: Errors: 4 - saveAndReload(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - - // tdf#170202: Without the fix in place, this test would have failed with - // - Expected: 0 - // - Actual : 1 - CPPUNIT_ASSERT_EQUAL(0, countXPathNodes(pXmlDoc, "//p:sld/p:timing")); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf169941_internal_link_to_shapes) -{ - createSdImpressDoc("odp/tdf169941.odp"); - - save(TestFilter::PPTX); - - xmlDocUniquePtr pRelsDoc2 = parseExport(u"ppt/slides/_rels/slide2.xml.rels"_ustr); - - // Without the fix in place, this test would have failed with - // - Expected: slide1.xml - // - Actual : - assertXPath(pRelsDoc2, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", - u"slide1.xml"); - - xmlDocUniquePtr pRelsDoc3 = parseExport(u"ppt/slides/_rels/slide3.xml.rels"_ustr); - assertXPath(pRelsDoc3, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", - u"slide1.xml"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testEmptyAttrNameElement) -{ - createSdImpressDoc("odp/emptyChildTnLstElement.odp"); - - // Without the fix in place, this test would have failed with - // - Expected: 0 - // - Actual : 2 - // - validation error in OOXML export: Errors: 2 - saveAndReload(TestFilter::PPTX); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testPlaceHolderFitHeightToText) -{ - createSdImpressDoc("pptx/tdf160487.pptx"); - saveAndReload(TestFilter::PPTX); - uno::Reference xShape(getShapeFromPage(1, 0)); - bool bTextAutoGrowHeight = false; - xShape->getPropertyValue(u"TextAutoGrowHeight"_ustr) >>= bTextAutoGrowHeight; - CPPUNIT_ASSERT_MESSAGE("PlaceHolder Fit height to text should be true.", bTextAutoGrowHeight); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testDeduplicateMasters) -{ - createSdImpressDoc("pptx/onemaster-twolayouts.pptx"); - saveAndReload(TestFilter::PPTX); - - // Check that the document still has one master and two layouts - xmlDocUniquePtr pXmlDocContent = parseExport("ppt/presentation.xml"); - assertXPath(pXmlDocContent, "/p:presentation/p:sldMasterIdLst/p:sldMasterId"_ostr, 1); - pXmlDocContent = parseExport("ppt/slideMasters/slideMaster1.xml"); - assertXPath(pXmlDocContent, "/p:sldMaster/p:sldLayoutIdLst/p:sldLayoutId"_ostr, 2); - - // Check that both background colors have been preserved - uno::Reference xDoc(mxComponent, uno::UNO_QUERY); - CPPUNIT_ASSERT(xDoc.is()); - CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDoc->getMasterPages()->getCount()); - - uno::Reference xPage(xDoc->getMasterPages()->getByIndex(0), - uno::UNO_QUERY_THROW); - uno::Reference xPropSet(xPage, uno::UNO_QUERY); - uno::Any aAny = xPropSet->getPropertyValue("Background"); - CPPUNIT_ASSERT(aAny.hasValue()); - uno::Reference aXBackgroundPropSet; - aAny >>= aXBackgroundPropSet; - Color nColor; - CPPUNIT_ASSERT(aXBackgroundPropSet->getPropertyValue("FillColor") >>= nColor); - CPPUNIT_ASSERT_EQUAL(Color(0x0E2841), nColor); - - uno::Reference xPage1(xDoc->getMasterPages()->getByIndex(1), - uno::UNO_QUERY_THROW); - uno::Reference xPropSet1(xPage1, uno::UNO_QUERY); - aAny = xPropSet1->getPropertyValue("Background"); - CPPUNIT_ASSERT(aAny.hasValue()); - aAny >>= aXBackgroundPropSet; - CPPUNIT_ASSERT(aXBackgroundPropSet->getPropertyValue("FillColor") >>= nColor); - CPPUNIT_ASSERT_EQUAL(Color(0x000000), nColor); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testInvalidAttributeValuesInSrcRect) -{ - createSdImpressDoc("odp/invalidAttributeValuesInSrcRect.odp"); - - // Without the fix in place, this test would have failed with - // - Expected: 0 - // - Actual : 24 - // - validation error in OOXML export: Errors: 24 - saveAndReload(TestFilter::PPTX); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testInvalidBuAutoNumEnumValue) -{ - createSdImpressDoc("odp/invalidBuAutoNumEnumValue.odp"); - - // Without the fix in place, this test would have failed with - // - Expected: 0 - // - Actual : 4 - // - validation error in OOXML export: Errors: 4 - saveAndReload(TestFilter::PPTX); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testInvalidCxAndCyAttribute) -{ - createSdImpressDoc("odp/invalidCxAndCyAttribute.odp"); - - // Without the fix in place, this test would have failed with - // - Expected: 0 - // - Actual : 4 - // - validation error in OOXML export: Errors: 4 - saveAndReload(TestFilter::PPTX); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testBadPercentageValue) -{ - createSdImpressDoc("odp/badPercentageValue.odp"); - - // Without the fix in place, this test would have failed with - // - Expected: 0 - // - Actual : 4 - // - validation error in OOXML export: Errors: 4 - saveAndReload(TestFilter::PPTX); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testInvalidAudio) -{ - createSdImpressDoc("odp/invalidAudio.odp"); - - // Without the fix in place, this test would have failed with - // - Expected: 0 - // - Actual : 1 - // - validation error in OOXML export: Errors: 1 - saveAndReload(TestFilter::PPTX); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testInvalidPrstDashEnumValue) -{ - createSdImpressDoc("odp/invalidPrstDashEnumValue.odp"); - - // Without the fix in place, this test would have failed with - // - Expected: 0 - // - Actual : 113 - // - validation error in OOXML export: Errors: 113 - saveAndReload(TestFilter::PPTX); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testInvalidXmlBy) -{ - createSdImpressDoc("odp/invalidXmlBy.odp"); - - // Without the fix in place, this test would have failed with - // - Expected: 0 - // - Actual : 15 - // - validation error in OOXML export: Errors: 15 - saveAndReload(TestFilter::PPTX); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testConvertWithMasterDeduplication) -{ - createSdImpressDoc("odp/dupmastermultlayouts.odp"); - saveAndReload(TestFilter::PPTX); - - uno::Reference xNameAccess - = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), - maTempFile.GetURL()); - - // For each slide check that its layout exists - for (int i = 1; i <= 4; ++i) - { - xmlDocUniquePtr pXmlDocRels - = parseExport("ppt/slides/_rels/slide" + OUString::number(i) + ".xml.rels"); - - assertXPath( - pXmlDocRels, - "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])"_ostr); - // the relative target e.g. "../slideLayouts/slideLayout2.xml" - OUString sRelativeLayoutPath = getXPathContent( - pXmlDocRels, - "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])/@Target"_ostr); - - // Check that the referenced slideLayout files exist - // Without the accompanying fix in place, this test would have failed with: - // equality assertion failed - // - Expected: 1 - // - Actual : 0 - // i.e. the referenced slideLayout file was missing on export. - OUString sSlideLayoutName = sRelativeLayoutPath.getToken(2, '/'); - CPPUNIT_ASSERT_EQUAL(true, - bool(xNameAccess->hasByName("ppt/slideLayouts/" + sSlideLayoutName))); - } -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf162571HorzAnchor) -{ - createSdImpressDoc("pptx/tdf165261.pptx"); - saveAndReload(TestFilter::PPTX); - - uno::Reference xShape(getShapeFromPage(1, 0), uno::UNO_QUERY); - uno::Reference xProp(xShape, uno::UNO_QUERY); - - drawing::TextHorizontalAdjust eHori; - CPPUNIT_ASSERT(xProp->getPropertyValue(u"TextHorizontalAdjust"_ustr) >>= eHori); - CPPUNIT_ASSERT_EQUAL(drawing::TextHorizontalAdjust::TextHorizontalAdjust_LEFT, eHori); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf165261HorzAnchor) -{ - createSdImpressDoc("pptx/tdf165261.pptx"); - saveAndReload(TestFilter::PPTX); - - uno::Reference xGroupShape(getShapeFromPage(0, 0), uno::UNO_QUERY); - uno::Reference xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY); - - uno::Reference xProp(xShape, uno::UNO_QUERY); - drawing::TextHorizontalAdjust eHori; - CPPUNIT_ASSERT(xProp->getPropertyValue(u"TextHorizontalAdjust"_ustr) >>= eHori); - CPPUNIT_ASSERT_EQUAL(drawing::TextHorizontalAdjust::TextHorizontalAdjust_CENTER, eHori); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testCustomPromptTexts) -{ - createSdImpressDoc("pptx/tdf163239.pptx"); - saveAndReload(TestFilter::PPTX); - - const SdrPage* pPage1 = GetPage(1); - { - // subtitle placeholder text - SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage1->GetObj(0)); - CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong object type!", SdrObjKind::Text, - pTxtObj->GetObjIdentifier()); - const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); - OUString aText = aEdit.GetText(0); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text!", - u"Click to edit customized Master Subtitle style"_ustr, aText); - - auto xShapeProps(getShapeFromPage(0, 0)); - CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"CustomPromptText"_ustr) >>= aText); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text was set!", - u"Click to edit customized Master Subtitle style"_ustr, aText); - } - - { - SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage1->GetObj(1)); - CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong object type!", SdrObjKind::TitleText, - pTxtObj->GetObjIdentifier()); - const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); - OUString aText = aEdit.GetText(0); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text!", u"Custom Title 1"_ustr, aText); - - auto xShapeProps(getShapeFromPage(1, 0)); - CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"CustomPromptText"_ustr) >>= aText); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text was set!", u"Custom Title 1"_ustr, - aText); - } - - const SdrPage* pPage2 = GetPage(3); - { - // body placeholder text - SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage2->GetObj(0)); - CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong object type!", SdrObjKind::OutlineText, - pTxtObj->GetObjIdentifier()); - const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); - OUString aText = aEdit.GetText(0); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text!", u"Text placeholder"_ustr, aText); - - auto xShapeProps(getShapeFromPage(0, 1)); - CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"CustomPromptText"_ustr) >>= aText); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text was set!", u"Text placeholder"_ustr, - aText); - } -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testPresObjTextStyles) -{ - createSdImpressDoc("pptx/tdf163239_v2.pptx"); - saveAndReload(TestFilter::PPTX); - - uno::Reference xStyleFamiliesSupplier(mxComponent, - uno::UNO_QUERY); - uno::Reference xStyleFamilies - = xStyleFamiliesSupplier->getStyleFamilies(); - // 1st slide - uno::Reference xStyleFamily( - xStyleFamilies->getByName(u"Title Slide"_ustr), uno::UNO_QUERY); - { - // Title style - uno::Reference xStyle(xStyleFamily->getByName(u"title"_ustr), - uno::UNO_QUERY); - uno::Reference xPropSet(xStyle, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(60.0f, xPropSet->getPropertyValue(u"CharHeight"_ustr).get()); - CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), - xPropSet->getPropertyValue(u"ParaAdjust"_ustr).get()); - CPPUNIT_ASSERT_EQUAL(u"Marianne"_ustr, - xPropSet->getPropertyValue(u"CharFontName"_ustr).get()); - } - // 2nd slide - xStyleFamily.set(xStyleFamilies->getByName(u"Title and Content"_ustr), uno::UNO_QUERY); - { - // Title style - uno::Reference xStyle(xStyleFamily->getByName(u"title"_ustr), - uno::UNO_QUERY); - uno::Reference xPropSet(xStyle, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(44.0f, xPropSet->getPropertyValue(u"CharHeight"_ustr).get()); - CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), - xPropSet->getPropertyValue(u"ParaAdjust"_ustr).get()); - CPPUNIT_ASSERT_EQUAL(u"Marianne"_ustr, - xPropSet->getPropertyValue(u"CharFontName"_ustr).get()); - - // outline1 style - xStyle.set(xStyleFamily->getByName(u"outline1"_ustr), uno::UNO_QUERY); - xPropSet.set(xStyle, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(28.0f, xPropSet->getPropertyValue(u"CharHeight"_ustr).get()); - CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), - xPropSet->getPropertyValue(u"ParaAdjust"_ustr).get()); - CPPUNIT_ASSERT_EQUAL(u"Marianne"_ustr, - xPropSet->getPropertyValue(u"CharFontName"_ustr).get()); - - // outline2 style - xStyle.set(xStyleFamily->getByName(u"outline2"_ustr), uno::UNO_QUERY); - xPropSet.set(xStyle, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(24.0f, xPropSet->getPropertyValue(u"CharHeight"_ustr).get()); - CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), - xPropSet->getPropertyValue(u"ParaAdjust"_ustr).get()); - CPPUNIT_ASSERT_EQUAL(u"Marianne"_ustr, - xPropSet->getPropertyValue(u"CharFontName"_ustr).get()); - - // outline5 style - xStyle.set(xStyleFamily->getByName(u"outline5"_ustr), uno::UNO_QUERY); - xPropSet.set(xStyle, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(18.0f, xPropSet->getPropertyValue(u"CharHeight"_ustr).get()); - CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), - xPropSet->getPropertyValue(u"ParaAdjust"_ustr).get()); - CPPUNIT_ASSERT_EQUAL(u"Marianne"_ustr, - xPropSet->getPropertyValue(u"CharFontName"_ustr).get()); - } -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTextStylesXML) -{ - createSdImpressDoc("pptx/tdf163239_v2.pptx"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slideLayouts/slideLayout1.xml"_ustr); - - assertXPath(pXmlDocRels, "/p:sldLayout/p:cSld/p:spTree/p:sp[1]/p:txBody/a:lstStyle/a:lvl1pPr", - "algn", u"ctr"); - assertXPath(pXmlDocRels, - "/p:sldLayout/p:cSld/p:spTree/p:sp[1]/p:txBody/a:lstStyle/a:lvl1pPr/a:defRPr", "sz", - u"6000"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTextAlignLeft) -{ - createSdImpressDoc("pptx/presLeftAlign.pptx"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slides/slide1.xml"_ustr); - - assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr", "algn", u"l"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testSubtitleNoBullets) -{ - createSdImpressDoc("odp/tdf170166.odp"); - saveAndReload(TestFilter::PPTX); - - const SdrPage* pPage1 = GetPage(1); - { - // subtitle placeholder object - SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage1->GetObj(0)); - CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong object type!", SdrObjKind::Text, - pTxtObj->GetObjIdentifier()); - const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); - const SvxNumBulletItem* pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET); - // Without a fix, it will fail with numbering type: SVX_NUM_CHAR_SPECIAL - CPPUNIT_ASSERT(pNumFmt); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Bullet's numbering type is wrong!", SVX_NUM_NUMBER_NONE, - pNumFmt->GetNumRule().GetLevel(0).GetNumberingType()); - } -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testOLEObjectAnimationTarget) -{ - createSdImpressDoc("pptx/tdf169088.pptx"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - - const OUString sOleId = getXPath( - pXmlDoc, "/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id"); - const OUString sPicId = getXPath(pXmlDoc, - "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/" - "a:graphicData/p:oleObj/p:pic/p:nvPicPr/p:cNvPr", - "id"); - - // Check OLE id is different from pic id - CPPUNIT_ASSERT_MESSAGE("OLE id is same as pic id", sOleId != sPicId); - - // Check animation target spid matches OLE object id - assertXPath(pXmlDoc, - "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/" - "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/" - "p:cBhvr/p:tgtEl/p:spTgt", - "spid", sOleId); - - assertXPath(pXmlDoc, - "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/" - "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animEffect/" - "p:cBhvr/p:tgtEl/p:spTgt", - "spid", sOleId); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testtdf169496_hidden_graphic) -{ - createSdImpressDoc("pptx/tdf169496_hidden_graphic.pptx"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - - // Graphic 5 is hidden and Graphic 4 is visible, but their order might change in the XML - // Without the fix the hidden attribute wasn't exported - OUString sName1 - = getXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:nvPicPr/p:cNvPr", "name"); - OUString sName2 - = getXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:nvPicPr/p:cNvPr", "name"); - if (sName1 == "Graphic 5" && sName2 == "Graphic 4") - { - OUString aHidden - = getXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:nvPicPr/p:cNvPr", "hidden"); - bool bHidden = aHidden == u"true"_ustr || aHidden == u"1"; - CPPUNIT_ASSERT_EQUAL_MESSAGE("Graphic 3 is supposed to be hidden", true, bHidden); - - assertXPathNoAttribute(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:nvPicPr/p:cNvPr", - "hidden"); - } - else if (sName1 == "Graphic 4" && sName2 == "Graphic 5") - { - assertXPathNoAttribute(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:nvPicPr/p:cNvPr", - "hidden"); - - OUString aHidden - = getXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:nvPicPr/p:cNvPr", "hidden"); - bool bHidden = aHidden == u"true"_ustr || aHidden == u"1"; - CPPUNIT_ASSERT_EQUAL_MESSAGE("Graphic 4 is supposed to be hidden", true, bHidden); - } - else - CPPUNIT_FAIL("Names of graphics is incorrect"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testHiddenGroupShape) -{ - createSdImpressDoc("pptx/hidden_group_shape.pptx"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:grpSp/p:nvGrpSpPr/p:cNvPr", "hidden", u"1"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testtdf169825_vertical_layouts) -{ - createSdImpressDoc("pptx/tdf169825_vertical_layouts.pptx"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slides/_rels/slide1.xml.rels"_ustr); - CPPUNIT_ASSERT(pXmlDocRels); - // find layout XML for the slide from the relationship file - OUString sLayoutRelRelative - = getXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship", "Target"); - OUString sLayoutRelAbs = sLayoutRelRelative.replaceFirst("..", "ppt"); - xmlDocUniquePtr pXmlDocLayout = parseExport(sLayoutRelAbs); - CPPUNIT_ASSERT(pXmlDocLayout); - - // without the SlidePersist::getLayoutFromValueToken() part of the patch, - // this and the next layout types would both be exported as blank - assertXPath(pXmlDocLayout, "/p:sldLayout", "type", u"vertTitleAndTx"); - - pXmlDocRels = parseExport(u"ppt/slides/_rels/slide2.xml.rels"_ustr); - CPPUNIT_ASSERT(pXmlDocRels); - sLayoutRelRelative = getXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship", "Target"); - sLayoutRelAbs = sLayoutRelRelative.replaceFirst("..", "ppt"); - pXmlDocLayout = parseExport(sLayoutRelAbs); - CPPUNIT_ASSERT(pXmlDocLayout); - - assertXPath(pXmlDocLayout, "/p:sldLayout", "type", u"vertTx"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testtdf169825_vertical_layouts_from_scratch) -{ - createSdImpressDoc(); - - uno::Reference xDoc(mxComponent, uno::UNO_QUERY_THROW); - uno::Reference xPages = xDoc->getDrawPages(); - uno::Reference xPage(xPages->getByIndex(0), uno::UNO_QUERY); - uno::Reference xPageSet(xPage, uno::UNO_QUERY_THROW); - xPageSet->setPropertyValue( - "Layout", - uno::Any(static_cast(AutoLayout::AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT))); - - uno::Reference xPage2(xPages->insertNewByIndex(1), uno::UNO_SET_THROW); - uno::Reference xPageSet2(xPage2, uno::UNO_QUERY_THROW); - xPageSet2->setPropertyValue( - "Layout", uno::Any(static_cast(AutoLayout::AUTOLAYOUT_VTITLE_VCONTENT))); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slides/_rels/slide1.xml.rels"_ustr); - CPPUNIT_ASSERT(pXmlDocRels); - // find layout XML for the slide from the relationship file - OUString sLayoutRelRelative - = getXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship", "Target"); - OUString sLayoutRelAbs = sLayoutRelRelative.replaceFirst("..", "ppt"); - xmlDocUniquePtr pXmlDocLayout = parseExport(sLayoutRelAbs); - CPPUNIT_ASSERT(pXmlDocLayout); - - // without the fix in place this would be exported as "objTx" - assertXPath(pXmlDocLayout, "/p:sldLayout", "type", u"vertTitleAndTxOverChart"); - - pXmlDocRels = parseExport(u"ppt/slides/_rels/slide2.xml.rels"_ustr); - CPPUNIT_ASSERT(pXmlDocRels); - sLayoutRelRelative = getXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship", "Target"); - sLayoutRelAbs = sLayoutRelRelative.replaceFirst("..", "ppt"); - pXmlDocLayout = parseExport(sLayoutRelAbs); - CPPUNIT_ASSERT(pXmlDocLayout); - - // without the fix in place this would be exported as "picTx" - assertXPath(pXmlDocLayout, "/p:sldLayout", "type", u"vertTitleAndTx"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testtdf169825_layout_type) -{ - createSdImpressDoc("odp/tdf169825_layout_type.odp"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slides/_rels/slide1.xml.rels"_ustr); - CPPUNIT_ASSERT(pXmlDocRels); - // find layout XML for the slide from the relationship file - OUString sLayoutRelRelative - = getXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship", "Target"); - OUString sLayoutRelAbs = sLayoutRelRelative.replaceFirst("..", "ppt"); - xmlDocUniquePtr pXmlDocLayout = parseExport(sLayoutRelAbs); - CPPUNIT_ASSERT(pXmlDocLayout); - - // without the fix in place this would be exported as "vertTitleAndTxOverChart" - // while in the original ODP this was - still possibly bogus - notes layout - assertXPath(pXmlDocLayout, "/p:sldLayout", "type", u"blank"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testtdf170102_layout_type) -{ - createSdImpressDoc("odp/tdf170102_layout_type.odp"); - saveAndReload(TestFilter::PPTX); - - uno::Reference xDoc(mxComponent, uno::UNO_QUERY); - CPPUNIT_ASSERT(xDoc.is()); - sal_Int32 nMPCount = xDoc->getMasterPages()->getCount(); - // test roughly the same thing in document and in XML: no drawing object in master page/layout - for (sal_Int32 i = 0; i < nMPCount; i++) - { - uno::Reference xPage(xDoc->getMasterPages()->getByIndex(i), - uno::UNO_QUERY_THROW); - sal_Int32 nObjCount = xPage->getCount(); - for (sal_Int32 j = 0; j < nObjCount; j++) - { - uno::Reference xShapeInfo(xPage->getByIndex(j), - uno::UNO_QUERY_THROW); - // without the fix in place there would be a graphic shape placeholder - CPPUNIT_ASSERT_MESSAGE( - "Unexpected graphic object shape in exported master page", - !xShapeInfo->supportsService(u"com.sun.star.drawing.GraphicObjectShape"_ustr)); - } - - xmlDocUniquePtr pXmlDocLayout = parseExport(u"ppt/slideLayouts/slideLayout"_ustr - + OUString::number(i + 1) + u".xml"_ustr); - CPPUNIT_ASSERT(pXmlDocLayout); - // without the fix in place there would be a pic layout element for the placeholder - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "Unexpected \"pic\" element in exported PPTX slide layout", 0, - countXPathNodes(pXmlDocLayout, "/p:sldLayout/p:cSld/p:spTree/p:pic")); - } -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testFooterIdxConsistency) -{ - createSdImpressDoc("pptx/multiplelayoutfooter.pptx"); - save(TestFilter::PPTX); - - // slide1 points to slideLayout2 - xmlDocUniquePtr pRelsDoc = parseExport(u"ppt/slides/_rels/slide1.xml.rels"_ustr); - assertXPath(pRelsDoc, - "/rels:Relationships/rels:Relationship[@Type='http://" - "schemas.openxmlformats.org/officeDocument/2006/" - "relationships/slideLayout']", - "Target", u"../slideLayouts/slideLayout2.xml"); - - // And they agree on the idx of the footer: - xmlDocUniquePtr pSlide = parseExport(u"ppt/slides/slide1.xml"_ustr); - OUString aFtrIdx = getXPath(pSlide, "//p:sp/p:nvSpPr/p:nvPr/p:ph", "idx"); - xmlDocUniquePtr pLayout = parseExport(u"ppt/slideLayouts/slideLayout2.xml"_ustr); - assertXPath(pLayout, "//p:sp/p:nvSpPr/p:nvPr/p:ph", "idx", aFtrIdx); - // Without the fix it fails with: - // - Expected: 1 - // - Actual : 2 - // - In <>, attribute 'idx' of '//p:sp/p:nvSpPr/p:nvPr/p:ph' incorrect value. -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testOmitCanvasSlideExport) -{ - createSdImpressDoc("odp/canvas-slide.odp"); - - SdXImpressDocument* pXImpressDocument = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pXImpressDocument); - SdDrawDocument* pDoc = pXImpressDocument->GetDoc(); - CPPUNIT_ASSERT_MESSAGE("no document", pDoc != nullptr); - - // the document has 2 pages - one canvas page, and one normal page - CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), pDoc->GetSdPageCount(PageKind::Standard)); - CPPUNIT_ASSERT(pDoc->HasCanvasPage()); - - save(TestFilter::PPTX); - - // Verify that the canvas slide was omitted from the export - // It should have one master slide, and one slide - xmlDocUniquePtr pXmlDocContent = parseExport(u"ppt/presentation.xml"_ustr); - assertXPath(pXmlDocContent, "/p:presentation/p:sldMasterIdLst/p:sldMasterId", 1); - assertXPath(pXmlDocContent, "/p:presentation/p:sldIdLst/p:sldId", 1); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testParaAlignStartEnd) -{ - createSdImpressDoc("odp/para-align-start-end.fodp"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - - // PresentationML doesn't support start and end paragraph alignment. - // Paragraphs should be exported as left/right alignment, depending on para direction. - assertXPath(pDoc, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr[@algn='l']", 1); - assertXPath(pDoc, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr[@algn='r']", 1); - assertXPath(pDoc, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[3]/a:pPr[@algn='r']", 1); - assertXPath(pDoc, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[4]/a:pPr[@algn='l']", 1); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf169559) -{ - createSdImpressDoc("pptx/tdf169524.pptx"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slideMasters/slideMaster1.xml"_ustr); - assertXPath( - pXmlDoc, - "/p:sldMaster/p:cSld/p:spTree/p:sp[2]/p:txBody/a:lstStyle/a:lvl1pPr/a:spcAft/a:spcPts", - "val", u"1701"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf114443_PPSX) -{ - createSdImpressDoc("ppsx/tdf114443-6.ppsx"); - save(TestFilter::PPSX); - - xmlDocUniquePtr pXmlDoc = parseExport(u"[Content_Types].xml"_ustr); - - // Without the fix, this would have been: - // application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml - // which means the file loses its slideshow/autoplay nature and PowerPoint rejects it. - assertXPath(pXmlDoc, - "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']", - "ContentType", - u"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testConnectorShapeAnimationTarget) -{ - createSdImpressDoc("pptx/connector-shape-animations.pptx"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - - const OUString sConnectorId = getXPath( - pXmlDoc, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "id"); - - const OUString sShapeId = getXPath( - pXmlDoc, "/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id"); - - // Check connector and shape both have the same ID - CPPUNIT_ASSERT_EQUAL_MESSAGE("Connector and the shape doesn't have the same ID", sConnectorId, - sShapeId); - - // Check animation spid matches ShapeId - assertXPath(pXmlDoc, - "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/" - "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par[2]/p:cTn/p:childTnLst/p:set/" - "p:cBhvr/p:tgtEl/p:spTgt", - "spid", sShapeId); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testChartExExport) -{ - createSdImpressDoc("pptx/forum-mso-de-138303.pptx"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); - CPPUNIT_ASSERT(pDoc); - - const OString sPath1 = "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Fallback"_ostr; - assertXPath(pDoc, sPath1 + "/xdr:sp"_ostr, 0); - assertXPath(pDoc, sPath1 + "/p:sp"_ostr, 1); - assertXPath(pDoc, sPath1 + "/p:sp/p:nvSpPr/p:nvPr"_ostr, 1); - - pDoc = parseExport(u"ppt/charts/chartEx1.xml"_ustr); - CPPUNIT_ASSERT(pDoc); - - assertXPath(pDoc, "/cx:chartSpace/c:date1904", 0); -} - -// 1. Open PPTX with sections, re-export to PPTX, verify sections preserved -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testSlideSectionsPPTXImport) -{ - createSdImpressDoc("pptx/slide-section-test.pptx"); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/presentation.xml"_ustr); - - static constexpr OString sPath = "/p:presentation/p:extLst/p:ext/p14:sectionLst"_ostr; - assertXPath(pXmlDoc, sPath + "/p14:section", 3); - assertXPath(pXmlDoc, sPath + "/p14:section[1]", "name", u"Section-1"); - assertXPath(pXmlDoc, sPath + "/p14:section[2]", "name", u"Section-2"); - assertXPath(pXmlDoc, sPath + "/p14:section[3]", "name", u"Section-3"); - assertXPath(pXmlDoc, sPath + "/p14:section[1]/p14:sldIdLst/p14:sldId", 4); - assertXPath(pXmlDoc, sPath + "/p14:section[2]/p14:sldIdLst/p14:sldId", 7); - assertXPath(pXmlDoc, sPath + "/p14:section[3]/p14:sldIdLst/p14:sldId", 2); - - // GUIDs preserved - for (sal_Int32 i = 1; i <= 3; ++i) - { - OUString sId = getXPath(pXmlDoc, sPath + "/p14:section[" + OString::number(i) + "]", "id"); - CPPUNIT_ASSERT(!sId.isEmpty()); - CPPUNIT_ASSERT(sId.startsWith("{")); - } - - // Slide IDs non-zero - OUString sSldId = getXPath(pXmlDoc, sPath + "/p14:section[1]/p14:sldIdLst/p14:sldId[1]", "id"); - CPPUNIT_ASSERT(sSldId.toInt32() > 0); -} - -// 2. Export PPTX with sections to ODP -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testSlideSectionsPPTXToODP) -{ - createSdImpressDoc("pptx/slide-section-test.pptx"); - skipValidation(); - save(TestFilter::ODP); - - xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); - - static constexpr OString sPath - = "/office:document-content/office:body/office:presentation/loext:section-list"_ostr; - assertXPath(pXmlDoc, sPath + "/loext:section", 3); - assertXPath(pXmlDoc, sPath + "/loext:section[1]", "name", u"Section-1"); - assertXPath(pXmlDoc, sPath + "/loext:section[2]", "name", u"Section-2"); - assertXPath(pXmlDoc, sPath + "/loext:section[3]", "name", u"Section-3"); - assertXPath(pXmlDoc, sPath + "/loext:section[1]/loext:section-slide", 4); - assertXPath(pXmlDoc, sPath + "/loext:section[2]/loext:section-slide", 7); - assertXPath(pXmlDoc, sPath + "/loext:section[3]/loext:section-slide", 2); -} - -// 3. Open ODP with sections (PPTX -> ODP -> reload ODP) -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testSlideSectionsODPImport) -{ - createSdImpressDoc("pptx/slide-section-test.pptx"); - skipValidation(); - saveAndReload(TestFilter::ODP); - - // Verify the in-memory model loaded from ODP - auto* pXImpressDocument = dynamic_cast(mxComponent.get()); - CPPUNIT_ASSERT(pXImpressDocument); - SdDrawDocument* pDoc = pXImpressDocument->GetDoc(); - CPPUNIT_ASSERT(pDoc); - - sd::SlideSectionManager& rMgr = pDoc->GetSectionManager(); - CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rMgr.GetSectionCount()); - CPPUNIT_ASSERT_EQUAL(u"Section-1"_ustr, rMgr.GetSection(0).maName); - CPPUNIT_ASSERT_EQUAL(u"Section-2"_ustr, rMgr.GetSection(1).maName); - CPPUNIT_ASSERT_EQUAL(u"Section-3"_ustr, rMgr.GetSection(2).maName); -} - -// 4. Export ODP with sections to PPTX -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testSlideSectionsODPToPPTX) -{ - createSdImpressDoc("pptx/slide-section-test.pptx"); - skipValidation(); - saveAndReload(TestFilter::ODP); - save(TestFilter::PPTX); - - xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/presentation.xml"_ustr); - - static constexpr OString sPath = "/p:presentation/p:extLst/p:ext/p14:sectionLst"_ostr; - assertXPath(pXmlDoc, sPath + "/p14:section", 3); - assertXPath(pXmlDoc, sPath + "/p14:section[1]", "name", u"Section-1"); - assertXPath(pXmlDoc, sPath + "/p14:section[2]", "name", u"Section-2"); - assertXPath(pXmlDoc, sPath + "/p14:section[3]", "name", u"Section-3"); - assertXPath(pXmlDoc, sPath + "/p14:section[1]/p14:sldIdLst/p14:sldId", 4); - assertXPath(pXmlDoc, sPath + "/p14:section[2]/p14:sldIdLst/p14:sldId", 7); - assertXPath(pXmlDoc, sPath + "/p14:section[3]/p14:sldIdLst/p14:sldId", 2); - - // Slide IDs non-zero after ODP round-trip - OUString sSldId = getXPath(pXmlDoc, sPath + "/p14:section[1]/p14:sldIdLst/p14:sldId[1]", "id"); - CPPUNIT_ASSERT(sSldId.toInt32() > 0); - - // GUIDs survive ODP round-trip (generated if missing) - for (sal_Int32 i = 1; i <= 3; ++i) - { - OUString sId = getXPath(pXmlDoc, sPath + "/p14:section[" + OString::number(i) + "]", "id"); - CPPUNIT_ASSERT(!sId.isEmpty()); - } -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testCool16078_placeholderKeepsItsOutline) -{ - // Given a layout whose picture placeholder is clipped to an outline of two elements: - // a frame with two holes, one of them round, and a second path holding a triangle that crosses - // the round one: - createSdImpressDoc("pptx/custgeom-placeholder.pptx"); - save(TestFilter::PPTX); - - // The outline is written back as the placeholder's own geometry. Without it the placeholder - // saved as a plain rectangle, and its fill then hid both holes and what showed through. - xmlDocUniquePtr pLayout = parseExportedLayoutNamed(u"Picture placeholder, clipped outline"); - OString aPath - = "//p:sp[p:nvSpPr/p:nvPr/p:ph/@type='pic']/p:spPr/a:custGeom/a:pathLst/a:path"_ostr; - assertXPath(pLayout, aPath, 1); - // Three contours in one path, which is what subtracts the holes from the frame - the same three - // the ODF side writes. The second path is not one of them: it is filled rather than cut out, so - // the triangle it holds took a piece of the round hole back instead of adding a contour. - assertXPath(pLayout, aPath + "/a:moveTo", 3); - assertXPath(pLayout, aPath + "/a:close", 3); - // Four sides each for the two rectangles, the closing one included. - assertXPath(pLayout, aPath + "/a:lnTo", 8); - // What is left of the round hole is still curves, not a polygon flattened out of them. - assertXPath(pLayout, aPath + "/a:cubicBezTo", 6); - assertXPath(pLayout, aPath + "/a:cubicBezTo[1]/a:pt", 3); - // The frame's own corner, in the path's coordinates. - assertXPath(pLayout, aPath + "/a:moveTo[1]/a:pt", "x", u"0"); - assertXPath(pLayout, aPath + "/a:moveTo[1]/a:pt", "y", u"0"); - - // The preset rectangle it used to write would have claimed the whole frame. - assertXPath(pLayout, "//p:sp[p:nvSpPr/p:nvPr/p:ph/@type='pic']/p:spPr/a:prstGeom", 0); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testCool16080_masterKeepsItsPlaceholders) -{ - // Given a deck of one master and eleven layouts, so one Impress master page stands for the - // whole group: - createSdImpressDoc("pptx/master-and-eleven-layouts.pptx"); - save(TestFilter::PPTX); - - // The master part carries its own placeholders. Without the fix it held a shape tree with - // nothing in it, so PowerPoint offered an empty slide master: nothing to inherit from, and - // an edit meant for every layout had to be repeated on each of them. - xmlDocUniquePtr pMaster = parseExport(u"ppt/slideMasters/slideMaster1.xml"_ustr); - static constexpr OString aTree("/p:sldMaster/p:cSld/p:spTree"_ostr); - assertXPath(pMaster, aTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='title']", 1); - assertXPath(pMaster, aTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='dt']", 1); - assertXPath(pMaster, aTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='ftr']", 1); - assertXPath(pMaster, aTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='sldNum']", 1); - - // The body comes from the first layout that has one, since the page standing for the group is - // the Title Slide layout and has none. That layout inherits the master's geometry, so the - // placeholder lands where the master put it rather than where a layout would. - assertXPath(pMaster, aTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='body']", 1); - assertXPath(pMaster, aTree + "/p:sp[p:nvSpPr/p:nvPr/p:ph/@type='body']/p:spPr/a:xfrm/a:off", - "y", u"1825560"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testCool16080_layoutShapesStayOnTheirLayout) -{ - // Given a deck whose first layout paints the whole slide blue, and a slide on another layout, - // which is therefore white: - createSdImpressDoc("pptx/layout-own-background.pptx"); - saveAndReload(TestFilter::PPTX); - - utl::TempFileNamed aPng; - aPng.EnableKillingFile(); - uno::Sequence aFilterData{ - comphelper::makePropertyValue(u"PixelWidth"_ustr, sal_Int32(64)), - comphelper::makePropertyValue(u"PixelHeight"_ustr, sal_Int32(36)) - }; - uno::Sequence aDescriptor{ - comphelper::makePropertyValue(u"URL"_ustr, aPng.GetURL()), - comphelper::makePropertyValue(u"FilterName"_ustr, u"PNG"_ustr), - comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) - }; - auto xExporter = drawing::GraphicExportFilter::create(getComponentContext()); - xExporter->setSourceDocument(getPage(0).queryThrow()); - xExporter->filter(aDescriptor); - - SvFileStream aStream(aPng.GetURL(), StreamMode::READ); - Bitmap aSlide = vcl::PngImageReader(aStream).read(); - CPPUNIT_ASSERT_EQUAL(Size(64, 36), aSlide.GetSizePixel()); - - // The slide is still white. An imported master and layout collapse onto one Impress master - // page, so the page standing for the group holds the first layout's rectangle - and writing - // that page's shapes into the master part painted it under every slide of the deck. Sample - // the side margins, which no placeholder of this layout reaches. - // Without the fix in place, this test would have failed with - // - Expected: rgba[ffffffff] - // - Actual : rgba[0000ffff] - CPPUNIT_ASSERT_EQUAL(COL_WHITE, aSlide.GetPixelColor(2, 18)); - CPPUNIT_ASSERT_EQUAL(COL_WHITE, aSlide.GetPixelColor(61, 18)); - - // The layout it belongs to still paints it, which is what a slide of that layout inherits. - xmlDocUniquePtr pLayout = parseExportedLayoutNamed(u"Title Slide"); - assertXPath(pLayout, - "/p:sldLayout/p:cSld/p:spTree/p:sp[p:nvSpPr/p:cNvPr/@name='Blue background']" - "/p:spPr/a:solidFill/a:srgbClr", - "val", u"0000FF"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testCool16080_masterKeepsWhatItsLayoutsShare) -{ - // Given a deck of one master that draws a rule of its own across the top of the slide, in - // segments of colour, and seven layouts that draw nothing: - createSdImpressDoc("pptx/tdf157740.pptx"); - saveAndReload(TestFilter::PPTX); - - // The rule is on the slide master, so PowerPoint edits it once for every layout. The import - // gives each of the seven Impress master pages a copy, and the master used to get none. - // Without the fix in place, this test would have failed with - // - Expected: 1 - // - Actual : 0 - xmlDocUniquePtr pMaster = parseExport(u"ppt/slideMasters/slideMaster1.xml"_ustr); - assertXPath(pMaster, - "/p:sldMaster/p:cSld/p:spTree/p:grpSp[p:nvGrpSpPr/p:cNvPr/@name='Group 1']", 1); - - // It moved there rather than being written seven more times: a layout holds the three - // placeholders it inherits and nothing else. - xmlDocUniquePtr pLayout = parseExportedLayoutNamed(u"Title, Content over Content"); - static constexpr OString aLayoutTree("/p:sldLayout/p:cSld/p:spTree"_ostr); - assertXPath(pLayout, aLayoutTree + "/*[not(self::p:nvGrpSpPr) and not(self::p:grpSpPr)]", 3); - assertXPath(pLayout, aLayoutTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph", 3); - - // And the slide still shows the rule, wherever it is written - utl::TempFileNamed aPng; - aPng.EnableKillingFile(); - uno::Sequence aFilterData{ - comphelper::makePropertyValue(u"PixelWidth"_ustr, sal_Int32(1920)), - comphelper::makePropertyValue(u"PixelHeight"_ustr, sal_Int32(1080)) - }; - uno::Sequence aDescriptor{ - comphelper::makePropertyValue(u"URL"_ustr, aPng.GetURL()), - comphelper::makePropertyValue(u"FilterName"_ustr, u"PNG"_ustr), - comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) - }; - auto xExporter = drawing::GraphicExportFilter::create(getComponentContext()); - xExporter->setSourceDocument(getPage(0).queryThrow()); - xExporter->filter(aDescriptor); - - SvFileStream aStream(aPng.GetURL(), StreamMode::READ); - Bitmap aSlide = vcl::PngImageReader(aStream).read(); - CPPUNIT_ASSERT_EQUAL(Size(1920, 1080), aSlide.GetSizePixel()); - // 90EBCD is accent5 of the deck's theme, the fill of the rule's second segment - CPPUNIT_ASSERT_EQUAL(Color(0x90EBCD), aSlide.GetPixelColor(200, 5)); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testCool16082_layoutKeepsSubtitle) -{ - // Given a deck whose Title Slide layout carries a subtitle placeholder: - createSdImpressDoc("pptx/master-and-eleven-layouts.pptx"); - save(TestFilter::PPTX); - - // The layout keeps it. Without the fix every layout of a master holding more than one lost its - // subtitle, so a slide made from the layout afterwards had nowhere to put one. - xmlDocUniquePtr pLayout = parseExportedLayoutNamed(u"Title Slide"); - assertXPath(pLayout, "/p:sldLayout/p:cSld/p:spTree/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='subTitle']", - 1); - - // The slide master still gets none, which is what PowerPoint refuses the file over. - xmlDocUniquePtr pMaster = parseExport(u"ppt/slideMasters/slideMaster1.xml"_ustr); - assertXPath(pMaster, "/p:sldMaster/p:cSld/p:spTree/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='subTitle']", - 0); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testCool16079_dateTimeField) -{ - // Given a deck whose date placeholders hold an automatically updated date: - createSdImpressDoc("pptx/master-and-eleven-layouts.pptx"); - save(TestFilter::PPTX); - - // The placeholder keeps a field. Without the fix it held our own display string as literal - // text, so PowerPoint showed "" where the original showed a date. The type is the - // one that leaves the format to the reader, which is what a field holding none asks for - the - // alias PowerPoint writes here stands for a fixed MM/DD/YYYY. - xmlDocUniquePtr pLayout = parseExportedLayoutNamed(u"Title Slide"); - assertXPath(pLayout, "//p:sp[p:nvSpPr/p:nvPr/p:ph/@type='dt']/p:txBody/a:p/a:fld", "type", - u"datetime"); -} - -CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf166401_textGivenToAPicturePlaceholder) -{ - // Given a slide whose picture placeholder is given text without any editing, which is what a - // script does and what leaves the placeholder standing for itself rather than for the text: - createSdImpressDoc("pptx/picture-placeholder-custom-prompt.pptx"); - getShapeFromPage(0, 0).queryThrow()->setString( - u"Given to a picture placeholder"_ustr); - save(TestFilter::PPTX); - - // The placeholder is written with its text. It holds no image, so writing it as a picture wrote - // nothing at all and the text went with the shape. - xmlDocUniquePtr pSlide = parseExport(u"ppt/slides/slide1.xml"_ustr); - static constexpr OString aPlaceholder( - "/p:sld/p:cSld/p:spTree/p:sp[p:nvSpPr/p:nvPr/p:ph/@type='pic']"_ostr); - assertXPath(pSlide, aPlaceholder, 1); - assertXPathContent(pSlide, aPlaceholder + "/p:txBody/a:p/a:r/a:t", - u"Given to a picture placeholder"); -} - CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/export-tests-ooxml5.cxx b/sd/qa/unit/export-tests-ooxml5.cxx new file mode 100644 index 000000000000..a3291d04a5bc --- /dev/null +++ b/sd/qa/unit/export-tests-ooxml5.cxx @@ -0,0 +1,1380 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "sdmodeltestbase.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +class SdOOXMLExportTest5 : public SdModelTestBase +{ +public: + SdOOXMLExportTest5() + : SdModelTestBase(u"/sd/qa/unit/data/"_ustr) + { + } +}; + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf151622_oleIcon) +{ + createSdImpressDoc("odp/ole_icon.odp"); + + save(TestFilter::PPTX); + + xmlDocUniquePtr pXml = parseExport(u"ppt/slides/slide1.xml"_ustr); + + // Without the accompanying fix in place, this test would have failed with: + // - Expression: prop + // - In ..., XPath '//p:oleObj' no attribute 'showAsIcon' exist + // i.e. show as icon option wasn't exported. + assertXPath(pXml, "//p:oleObj", "showAsIcon", u"1"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf152436) +{ + createSdImpressDoc("pptx/ole-emf_min.pptx"); + saveAndReload(TestFilter::PPTX); + + // Check number of shapes after export. + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0)->getCount()); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testLinkedOLE) +{ + // The linked OLE object needs its link completed during load so it can + // be exported. Use FULL_UPDATE since the default test mode defers links. + uno::Sequence aParams = { + comphelper::makePropertyValue(u"UpdateDocMode"_ustr, + sal_Int16(css::document::UpdateDocMode::FULL_UPDATE)), + }; + loadFromFile(u"odp/linked_ole.odp", aParams); + + save(TestFilter::PPTX); + + xmlDocUniquePtr pXml = parseExport(u"ppt/slides/slide1.xml"_ustr); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 0 + // - In<>, XPath '//p:oleObj' number of nodes is incorrect + // i.e. the linked ole object wasn't exported. + assertXPath(pXml, "//p:oleObj", 1); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf102261_testParaTabStopDefaultDistance) +{ + createSdImpressDoc("pptx/tdf102261_testParaTabStopDefaultDistance.pptx"); + saveAndReload(TestFilter::PPTX); + + uno::Reference xShape(getShapeFromPage(0, 0)); + { + uno::Reference xPropSet(getParagraphFromShape(0, xShape), + uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL( + sal_Int32{ 1270 }, + xPropSet->getPropertyValue(u"ParaTabStopDefaultDistance"_ustr).get()); + } + { + uno::Reference xPropSet(getParagraphFromShape(1, xShape), + uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL( + sal_Int32{ 2540 }, + xPropSet->getPropertyValue(u"ParaTabStopDefaultDistance"_ustr).get()); + } +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testNotesAuthorDate) +{ + createSdImpressDoc("pptx/pres-with-notes.pptx"); + + using ScriptingCfg = officecfg::Office::Common::Security::Scripting; + ScopedConfigValue aCfg1(true); + { + // 1. Remove all personal info, but keep note info + ScopedConfigValue aCfg2(true); + + saveAndReload(TestFilter::PPTX); + + xmlDocUniquePtr pXml = parseExport(u"ppt/commentAuthors.xml"_ustr); + assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=0]", "name", u"Hans Wurst"); + assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=1]", "name", u"Max Muster"); + + pXml = parseExport(u"ppt/comments/comment1.xml"_ustr); + assertXPath(pXml, "/p:cmLst/p:cm", "dt", u"2024-06-13T12:03:08.000000000"); + } + + { + // 2. Remove all personal info + ScopedConfigValue aCfg2(false); + saveAndReload(TestFilter::PPTX); + + xmlDocUniquePtr pXml = parseExport(u"ppt/commentAuthors.xml"_ustr); + assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=0]", "name", u"Author1"); + assertXPath(pXml, "/p:cmAuthorLst/p:cmAuthor[@id=1]", "name", u"Author2"); + + pXml = parseExport(u"ppt/comments/comment1.xml"_ustr); + assertXPathNoAttribute(pXml, "/p:cmLst/p:cm", "dt"); + } +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTableCellVerticalPropertyRoundtrip) +{ + createSdImpressDoc("pptx/tcPr-vert-roundtrip.pptx"); + saveAndReload(TestFilter::PPTX); + + xmlDocUniquePtr pXml = parseExport(u"ppt/slides/slide1.xml"_ustr); + + assertXPath(pXml, "(//a:tcPr)[1]", "vert", u"vert"); + assertXPath(pXml, "(//a:tcPr)[2]", "vert", u"vert270"); + assertXPath(pXml, "(//a:tcPr)[3]", "vert", u"wordArtVert"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf157740_slideMasters) +{ + createSdImpressDoc("pptx/tdf157740.pptx"); + saveAndReload(TestFilter::PPTX); + + // The original file has 1 slide master and 7 slide layouts in that master + xmlDocUniquePtr pXmlDocContent = parseExport(u"ppt/presentation.xml"_ustr); + assertXPath(pXmlDocContent, "/p:presentation/p:sldMasterIdLst/p:sldMasterId", 1); + + pXmlDocContent = parseExport(u"ppt/slideMasters/slideMaster1.xml"_ustr); + assertXPath(pXmlDocContent, "/p:sldMaster/p:sldLayoutIdLst/p:sldLayoutId", 7); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testNotesMasterThemeNoAfterDeduplicatedMasters) +{ + createSdImpressDoc("n759180.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDocContent = parseExport(u"ppt/presentation.xml"_ustr); + assertXPath(pXmlDocContent, "/p:presentation/p:sldMasterIdLst/p:sldMasterId", 1); + + xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slideMasters/_rels/slideMaster1.xml.rels"_ustr); + assertXPath(pXmlDocRels, + "/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/" + "officeDocument/2006/relationships/theme']", + "Target", u"../theme/theme1.xml"); + + // The one slide master of this document has 12 layouts, which are imported as 12 master pages + // and written back as one slide master. The notes master theme takes the number after the slide + // master theme, as in the original file, without a gap for the master pages that were merged. + // Without the change in place, this test would have failed with: + // - Expected: ../theme/theme2.xml + // - Actual : ../theme/theme13.xml + pXmlDocRels = parseExport(u"ppt/notesMasters/_rels/notesMaster1.xml.rels"_ustr); + assertXPath(pXmlDocRels, + "/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/" + "officeDocument/2006/relationships/theme']", + "Target", u"../theme/theme2.xml"); + + uno::Reference xNameAccess + = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), + maTempFile.GetURL()); + CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess->hasByName(u"ppt/theme/theme2.xml"_ustr))); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf159931_slideLayouts) +{ + createSdImpressDoc("odp/repeatBitmapMode.odp"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDocRels1 = parseExport(u"ppt/slides/_rels/slide1.xml.rels"_ustr); + xmlDocUniquePtr pXmlDocRels2 = parseExport(u"ppt/slides/_rels/slide2.xml.rels"_ustr); + + assertXPath(pXmlDocRels1, "(/rels:Relationships/rels:Relationship[@Type='http://" + "schemas.openxmlformats.org/officeDocument/2006/relationships/" + "slideLayout'])"); + + // the relative target e.g. "../slideLayouts/slideLayout2.xml" + OUString sRelativeLayoutPath1 + = getXPathContent(pXmlDocRels1, "(/rels:Relationships/rels:Relationship[@Type='http://" + "schemas.openxmlformats.org/officeDocument/2006/" + "relationships/slideLayout'])/@Target"); + + assertXPath(pXmlDocRels2, "(/rels:Relationships/rels:Relationship[@Type='http://" + "schemas.openxmlformats.org/officeDocument/2006/relationships/" + "slideLayout'])"); + + // the relative target e.g. "../slideLayouts/slideLayout1.xml" + OUString sRelativeLayoutPath2 + = getXPathContent(pXmlDocRels2, "(/rels:Relationships/rels:Relationship[@Type='http://" + "schemas.openxmlformats.org/officeDocument/2006/" + "relationships/slideLayout'])/@Target"); + + uno::Reference xNameAccess + = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), + maTempFile.GetURL()); + + // Check that the referenced slideLayout files exist + // Without the accompanying fix in place, this test would have failed with: + // equality assertion failed + // - Expected: 1 + // - Actual : 0 + // i.e. the referenced slideLayout file was missing on export. + OUString sSlideLayoutName1 = sRelativeLayoutPath1.getToken(2, '/'); + OUString sSlideLayoutName2 = sRelativeLayoutPath2.getToken(2, '/'); + + CPPUNIT_ASSERT_EQUAL(true, + bool(xNameAccess->hasByName("ppt/slideLayouts/" + sSlideLayoutName1))); + CPPUNIT_ASSERT_EQUAL(true, + bool(xNameAccess->hasByName("ppt/slideLayouts/" + sSlideLayoutName2))); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf163483_export_math_fallback) +{ + createSdImpressDoc("odp/formula.fodp"); + + // Before export-and-reload, there is a formula on page. + { + auto xProps = getShapeFromPage(0, 0); + auto xInfo = xProps->getPropertyValue(u"Model"_ustr).queryThrow(); + CPPUNIT_ASSERT(xInfo->supportsService(u"com.sun.star.formula.FormulaProperties"_ustr)); + + // tdf#164101: check that the size is imported correctly + css::awt::Size formulaSize = xProps.queryThrow()->getSize(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1553), formulaSize.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(528), formulaSize.Height); + + CPPUNIT_ASSERT_THROW(getShapeFromPage(0, 1), + css::lang::IndexOutOfBoundsException); // Only one shape on page + } + + saveAndReload(TestFilter::PPTX); + + // After save-and-reload, there must still be a single shape; now it's a fallback image. + // When we start to import formulas from PPTX, that will be formula. + { + // Without the fix, this threw IndexOutOfBoundsException, because there was no fallback, + // and no shape got imported. + auto xInfo = getShapeFromPage(0, 0).queryThrow(); + CPPUNIT_ASSERT(xInfo->supportsService(u"com.sun.star.drawing.CustomShape"_ustr)); + + css::awt::Size formulaSize = xInfo.queryThrow()->getSize(); + // The fallback image size after the roundtrip may be a bit different - allow some tolerance + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1553), formulaSize.Width, 1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(528), formulaSize.Height, 1); + + CPPUNIT_ASSERT_THROW(getShapeFromPage(0, 1), + css::lang::IndexOutOfBoundsException); // Only one shape on page + } + + xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); + + const OUString cNvPr_id = getXPath( + pXmlDoc, "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:nvSpPr/p:cNvPr", + "id"); + + // Check that the alternate content is exported + assertXPath( + pXmlDoc, + "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Fallback/p:sp/p:spPr/a:blipFill/a:blip", + "embed", u"rId1"); + + // Its cNvPr_id must be the same + assertXPath(pXmlDoc, + "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Fallback/p:sp/p:nvSpPr/p:cNvPr", + "id", cNvPr_id); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf169979_missing_ppic) +{ + createSdImpressDoc("odp/tdf169979.odp"); + + save(TestFilter::PPTX); + + xmlDocUniquePtr pXml2 = parseExport(u"ppt/slides/slide2.xml"_ustr); + + // Without the fix in place, this test would have failed with + // - Expected: 1 + // - Actual : 0 + // - In <>, XPath '/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/p:oleObj/p:pic/p:nvPicPr/p:cNvPr' number of nodes is incorrect + assertXPath(pXml2, + "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/" + "a:graphicData/p:oleObj/p:pic/p:nvPicPr/p:cNvPr", + "name", u""); + + assertXPath(pXml2, + "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/" + "a:graphicData/p:oleObj/p:pic/p:nvPicPr/p:cNvPr", + "descr", u""); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testEmptyChildTnLstElement) +{ + createSdImpressDoc("odp/emptyChildTnLstElement.odp"); + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 4 + // - validation error in OOXML export: Errors: 4 + saveAndReload(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); + + // tdf#170202: Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 1 + CPPUNIT_ASSERT_EQUAL(0, countXPathNodes(pXmlDoc, "//p:sld/p:timing")); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf169941_internal_link_to_shapes) +{ + createSdImpressDoc("odp/tdf169941.odp"); + + save(TestFilter::PPTX); + + xmlDocUniquePtr pRelsDoc2 = parseExport(u"ppt/slides/_rels/slide2.xml.rels"_ustr); + + // Without the fix in place, this test would have failed with + // - Expected: slide1.xml + // - Actual : + assertXPath(pRelsDoc2, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", + u"slide1.xml"); + + xmlDocUniquePtr pRelsDoc3 = parseExport(u"ppt/slides/_rels/slide3.xml.rels"_ustr); + assertXPath(pRelsDoc3, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", + u"slide1.xml"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testEmptyAttrNameElement) +{ + createSdImpressDoc("odp/emptyChildTnLstElement.odp"); + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 2 + // - validation error in OOXML export: Errors: 2 + saveAndReload(TestFilter::PPTX); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testPlaceHolderFitHeightToText) +{ + createSdImpressDoc("pptx/tdf160487.pptx"); + saveAndReload(TestFilter::PPTX); + uno::Reference xShape(getShapeFromPage(1, 0)); + bool bTextAutoGrowHeight = false; + xShape->getPropertyValue(u"TextAutoGrowHeight"_ustr) >>= bTextAutoGrowHeight; + CPPUNIT_ASSERT_MESSAGE("PlaceHolder Fit height to text should be true.", bTextAutoGrowHeight); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testDeduplicateMasters) +{ + createSdImpressDoc("pptx/onemaster-twolayouts.pptx"); + saveAndReload(TestFilter::PPTX); + + // Check that the document still has one master and two layouts + xmlDocUniquePtr pXmlDocContent = parseExport("ppt/presentation.xml"); + assertXPath(pXmlDocContent, "/p:presentation/p:sldMasterIdLst/p:sldMasterId"_ostr, 1); + pXmlDocContent = parseExport("ppt/slideMasters/slideMaster1.xml"); + assertXPath(pXmlDocContent, "/p:sldMaster/p:sldLayoutIdLst/p:sldLayoutId"_ostr, 2); + + // Check that both background colors have been preserved + uno::Reference xDoc(mxComponent, uno::UNO_QUERY); + CPPUNIT_ASSERT(xDoc.is()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDoc->getMasterPages()->getCount()); + + uno::Reference xPage(xDoc->getMasterPages()->getByIndex(0), + uno::UNO_QUERY_THROW); + uno::Reference xPropSet(xPage, uno::UNO_QUERY); + uno::Any aAny = xPropSet->getPropertyValue("Background"); + CPPUNIT_ASSERT(aAny.hasValue()); + uno::Reference aXBackgroundPropSet; + aAny >>= aXBackgroundPropSet; + Color nColor; + CPPUNIT_ASSERT(aXBackgroundPropSet->getPropertyValue("FillColor") >>= nColor); + CPPUNIT_ASSERT_EQUAL(Color(0x0E2841), nColor); + + uno::Reference xPage1(xDoc->getMasterPages()->getByIndex(1), + uno::UNO_QUERY_THROW); + uno::Reference xPropSet1(xPage1, uno::UNO_QUERY); + aAny = xPropSet1->getPropertyValue("Background"); + CPPUNIT_ASSERT(aAny.hasValue()); + aAny >>= aXBackgroundPropSet; + CPPUNIT_ASSERT(aXBackgroundPropSet->getPropertyValue("FillColor") >>= nColor); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), nColor); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testInvalidAttributeValuesInSrcRect) +{ + createSdImpressDoc("odp/invalidAttributeValuesInSrcRect.odp"); + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 24 + // - validation error in OOXML export: Errors: 24 + saveAndReload(TestFilter::PPTX); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testInvalidBuAutoNumEnumValue) +{ + createSdImpressDoc("odp/invalidBuAutoNumEnumValue.odp"); + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 4 + // - validation error in OOXML export: Errors: 4 + saveAndReload(TestFilter::PPTX); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testInvalidCxAndCyAttribute) +{ + createSdImpressDoc("odp/invalidCxAndCyAttribute.odp"); + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 4 + // - validation error in OOXML export: Errors: 4 + saveAndReload(TestFilter::PPTX); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testBadPercentageValue) +{ + createSdImpressDoc("odp/badPercentageValue.odp"); + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 4 + // - validation error in OOXML export: Errors: 4 + saveAndReload(TestFilter::PPTX); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testInvalidAudio) +{ + createSdImpressDoc("odp/invalidAudio.odp"); + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 1 + // - validation error in OOXML export: Errors: 1 + saveAndReload(TestFilter::PPTX); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testInvalidPrstDashEnumValue) +{ + createSdImpressDoc("odp/invalidPrstDashEnumValue.odp"); + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 113 + // - validation error in OOXML export: Errors: 113 + saveAndReload(TestFilter::PPTX); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testInvalidXmlBy) +{ + createSdImpressDoc("odp/invalidXmlBy.odp"); + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 15 + // - validation error in OOXML export: Errors: 15 + saveAndReload(TestFilter::PPTX); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testConvertWithMasterDeduplication) +{ + createSdImpressDoc("odp/dupmastermultlayouts.odp"); + saveAndReload(TestFilter::PPTX); + + uno::Reference xNameAccess + = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), + maTempFile.GetURL()); + + // For each slide check that its layout exists + for (int i = 1; i <= 4; ++i) + { + xmlDocUniquePtr pXmlDocRels + = parseExport("ppt/slides/_rels/slide" + OUString::number(i) + ".xml.rels"); + + assertXPath( + pXmlDocRels, + "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])"_ostr); + // the relative target e.g. "../slideLayouts/slideLayout2.xml" + OUString sRelativeLayoutPath = getXPathContent( + pXmlDocRels, + "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])/@Target"_ostr); + + // Check that the referenced slideLayout files exist + // Without the accompanying fix in place, this test would have failed with: + // equality assertion failed + // - Expected: 1 + // - Actual : 0 + // i.e. the referenced slideLayout file was missing on export. + OUString sSlideLayoutName = sRelativeLayoutPath.getToken(2, '/'); + CPPUNIT_ASSERT_EQUAL(true, + bool(xNameAccess->hasByName("ppt/slideLayouts/" + sSlideLayoutName))); + } +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf162571HorzAnchor) +{ + createSdImpressDoc("pptx/tdf165261.pptx"); + saveAndReload(TestFilter::PPTX); + + uno::Reference xShape(getShapeFromPage(1, 0), uno::UNO_QUERY); + uno::Reference xProp(xShape, uno::UNO_QUERY); + + drawing::TextHorizontalAdjust eHori; + CPPUNIT_ASSERT(xProp->getPropertyValue(u"TextHorizontalAdjust"_ustr) >>= eHori); + CPPUNIT_ASSERT_EQUAL(drawing::TextHorizontalAdjust::TextHorizontalAdjust_LEFT, eHori); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf165261HorzAnchor) +{ + createSdImpressDoc("pptx/tdf165261.pptx"); + saveAndReload(TestFilter::PPTX); + + uno::Reference xGroupShape(getShapeFromPage(0, 0), uno::UNO_QUERY); + uno::Reference xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY); + + uno::Reference xProp(xShape, uno::UNO_QUERY); + drawing::TextHorizontalAdjust eHori; + CPPUNIT_ASSERT(xProp->getPropertyValue(u"TextHorizontalAdjust"_ustr) >>= eHori); + CPPUNIT_ASSERT_EQUAL(drawing::TextHorizontalAdjust::TextHorizontalAdjust_CENTER, eHori); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testCustomPromptTexts) +{ + createSdImpressDoc("pptx/tdf163239.pptx"); + saveAndReload(TestFilter::PPTX); + + const SdrPage* pPage1 = GetPage(1); + { + // subtitle placeholder text + SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage1->GetObj(0)); + CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong object type!", SdrObjKind::Text, + pTxtObj->GetObjIdentifier()); + const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); + OUString aText = aEdit.GetText(0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text!", + u"Click to edit customized Master Subtitle style"_ustr, aText); + + auto xShapeProps(getShapeFromPage(0, 0)); + CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"CustomPromptText"_ustr) >>= aText); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text was set!", + u"Click to edit customized Master Subtitle style"_ustr, aText); + } + + { + SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage1->GetObj(1)); + CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong object type!", SdrObjKind::TitleText, + pTxtObj->GetObjIdentifier()); + const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); + OUString aText = aEdit.GetText(0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text!", u"Custom Title 1"_ustr, aText); + + auto xShapeProps(getShapeFromPage(1, 0)); + CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"CustomPromptText"_ustr) >>= aText); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text was set!", u"Custom Title 1"_ustr, + aText); + } + + const SdrPage* pPage2 = GetPage(3); + { + // body placeholder text + SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage2->GetObj(0)); + CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong object type!", SdrObjKind::OutlineText, + pTxtObj->GetObjIdentifier()); + const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); + OUString aText = aEdit.GetText(0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text!", u"Text placeholder"_ustr, aText); + + auto xShapeProps(getShapeFromPage(0, 1)); + CPPUNIT_ASSERT(xShapeProps->getPropertyValue(u"CustomPromptText"_ustr) >>= aText); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong placeholder text was set!", u"Text placeholder"_ustr, + aText); + } +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testPresObjTextStyles) +{ + createSdImpressDoc("pptx/tdf163239_v2.pptx"); + saveAndReload(TestFilter::PPTX); + + uno::Reference xStyleFamiliesSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference xStyleFamilies + = xStyleFamiliesSupplier->getStyleFamilies(); + // 1st slide + uno::Reference xStyleFamily( + xStyleFamilies->getByName(u"Title Slide"_ustr), uno::UNO_QUERY); + { + // Title style + uno::Reference xStyle(xStyleFamily->getByName(u"title"_ustr), + uno::UNO_QUERY); + uno::Reference xPropSet(xStyle, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(60.0f, xPropSet->getPropertyValue(u"CharHeight"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), + xPropSet->getPropertyValue(u"ParaAdjust"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(u"Marianne"_ustr, + xPropSet->getPropertyValue(u"CharFontName"_ustr).get()); + } + // 2nd slide + xStyleFamily.set(xStyleFamilies->getByName(u"Title and Content"_ustr), uno::UNO_QUERY); + { + // Title style + uno::Reference xStyle(xStyleFamily->getByName(u"title"_ustr), + uno::UNO_QUERY); + uno::Reference xPropSet(xStyle, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(44.0f, xPropSet->getPropertyValue(u"CharHeight"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), + xPropSet->getPropertyValue(u"ParaAdjust"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(u"Marianne"_ustr, + xPropSet->getPropertyValue(u"CharFontName"_ustr).get()); + + // outline1 style + xStyle.set(xStyleFamily->getByName(u"outline1"_ustr), uno::UNO_QUERY); + xPropSet.set(xStyle, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(28.0f, xPropSet->getPropertyValue(u"CharHeight"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), + xPropSet->getPropertyValue(u"ParaAdjust"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(u"Marianne"_ustr, + xPropSet->getPropertyValue(u"CharFontName"_ustr).get()); + + // outline2 style + xStyle.set(xStyleFamily->getByName(u"outline2"_ustr), uno::UNO_QUERY); + xPropSet.set(xStyle, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(24.0f, xPropSet->getPropertyValue(u"CharHeight"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), + xPropSet->getPropertyValue(u"ParaAdjust"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(u"Marianne"_ustr, + xPropSet->getPropertyValue(u"CharFontName"_ustr).get()); + + // outline5 style + xStyle.set(xStyleFamily->getByName(u"outline5"_ustr), uno::UNO_QUERY); + xPropSet.set(xStyle, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(18.0f, xPropSet->getPropertyValue(u"CharHeight"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), + xPropSet->getPropertyValue(u"ParaAdjust"_ustr).get()); + CPPUNIT_ASSERT_EQUAL(u"Marianne"_ustr, + xPropSet->getPropertyValue(u"CharFontName"_ustr).get()); + } +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTextStylesXML) +{ + createSdImpressDoc("pptx/tdf163239_v2.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slideLayouts/slideLayout1.xml"_ustr); + + assertXPath(pXmlDocRels, "/p:sldLayout/p:cSld/p:spTree/p:sp[1]/p:txBody/a:lstStyle/a:lvl1pPr", + "algn", u"ctr"); + assertXPath(pXmlDocRels, + "/p:sldLayout/p:cSld/p:spTree/p:sp[1]/p:txBody/a:lstStyle/a:lvl1pPr/a:defRPr", "sz", + u"6000"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTextAlignLeft) +{ + createSdImpressDoc("pptx/presLeftAlign.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slides/slide1.xml"_ustr); + + assertXPath(pXmlDocRels, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:pPr", "algn", u"l"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testSubtitleNoBullets) +{ + createSdImpressDoc("odp/tdf170166.odp"); + saveAndReload(TestFilter::PPTX); + + const SdrPage* pPage1 = GetPage(1); + { + // subtitle placeholder object + SdrTextObj* pTxtObj = DynCastSdrTextObj(pPage1->GetObj(0)); + CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong object type!", SdrObjKind::Text, + pTxtObj->GetObjIdentifier()); + const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); + const SvxNumBulletItem* pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET); + // Without a fix, it will fail with numbering type: SVX_NUM_CHAR_SPECIAL + CPPUNIT_ASSERT(pNumFmt); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Bullet's numbering type is wrong!", SVX_NUM_NUMBER_NONE, + pNumFmt->GetNumRule().GetLevel(0).GetNumberingType()); + } +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testOLEObjectAnimationTarget) +{ + createSdImpressDoc("pptx/tdf169088.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); + + const OUString sOleId = getXPath( + pXmlDoc, "/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id"); + const OUString sPicId = getXPath(pXmlDoc, + "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/" + "a:graphicData/p:oleObj/p:pic/p:nvPicPr/p:cNvPr", + "id"); + + // Check OLE id is different from pic id + CPPUNIT_ASSERT_MESSAGE("OLE id is same as pic id", sOleId != sPicId); + + // Check animation target spid matches OLE object id + assertXPath(pXmlDoc, + "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/" + "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/" + "p:cBhvr/p:tgtEl/p:spTgt", + "spid", sOleId); + + assertXPath(pXmlDoc, + "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/" + "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animEffect/" + "p:cBhvr/p:tgtEl/p:spTgt", + "spid", sOleId); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testtdf169496_hidden_graphic) +{ + createSdImpressDoc("pptx/tdf169496_hidden_graphic.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); + + // Graphic 5 is hidden and Graphic 4 is visible, but their order might change in the XML + // Without the fix the hidden attribute wasn't exported + OUString sName1 + = getXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:nvPicPr/p:cNvPr", "name"); + OUString sName2 + = getXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:nvPicPr/p:cNvPr", "name"); + if (sName1 == "Graphic 5" && sName2 == "Graphic 4") + { + OUString aHidden + = getXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:nvPicPr/p:cNvPr", "hidden"); + bool bHidden = aHidden == u"true"_ustr || aHidden == u"1"; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Graphic 3 is supposed to be hidden", true, bHidden); + + assertXPathNoAttribute(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:nvPicPr/p:cNvPr", + "hidden"); + } + else if (sName1 == "Graphic 4" && sName2 == "Graphic 5") + { + assertXPathNoAttribute(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:nvPicPr/p:cNvPr", + "hidden"); + + OUString aHidden + = getXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:nvPicPr/p:cNvPr", "hidden"); + bool bHidden = aHidden == u"true"_ustr || aHidden == u"1"; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Graphic 4 is supposed to be hidden", true, bHidden); + } + else + CPPUNIT_FAIL("Names of graphics is incorrect"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testHiddenGroupShape) +{ + createSdImpressDoc("pptx/hidden_group_shape.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); + assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:grpSp/p:nvGrpSpPr/p:cNvPr", "hidden", u"1"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testtdf169825_vertical_layouts) +{ + createSdImpressDoc("pptx/tdf169825_vertical_layouts.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slides/_rels/slide1.xml.rels"_ustr); + CPPUNIT_ASSERT(pXmlDocRels); + // find layout XML for the slide from the relationship file + OUString sLayoutRelRelative + = getXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship", "Target"); + OUString sLayoutRelAbs = sLayoutRelRelative.replaceFirst("..", "ppt"); + xmlDocUniquePtr pXmlDocLayout = parseExport(sLayoutRelAbs); + CPPUNIT_ASSERT(pXmlDocLayout); + + // without the SlidePersist::getLayoutFromValueToken() part of the patch, + // this and the next layout types would both be exported as blank + assertXPath(pXmlDocLayout, "/p:sldLayout", "type", u"vertTitleAndTx"); + + pXmlDocRels = parseExport(u"ppt/slides/_rels/slide2.xml.rels"_ustr); + CPPUNIT_ASSERT(pXmlDocRels); + sLayoutRelRelative = getXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship", "Target"); + sLayoutRelAbs = sLayoutRelRelative.replaceFirst("..", "ppt"); + pXmlDocLayout = parseExport(sLayoutRelAbs); + CPPUNIT_ASSERT(pXmlDocLayout); + + assertXPath(pXmlDocLayout, "/p:sldLayout", "type", u"vertTx"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testtdf169825_vertical_layouts_from_scratch) +{ + createSdImpressDoc(); + + uno::Reference xDoc(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference xPages = xDoc->getDrawPages(); + uno::Reference xPage(xPages->getByIndex(0), uno::UNO_QUERY); + uno::Reference xPageSet(xPage, uno::UNO_QUERY_THROW); + xPageSet->setPropertyValue( + "Layout", + uno::Any(static_cast(AutoLayout::AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT))); + + uno::Reference xPage2(xPages->insertNewByIndex(1), uno::UNO_SET_THROW); + uno::Reference xPageSet2(xPage2, uno::UNO_QUERY_THROW); + xPageSet2->setPropertyValue( + "Layout", uno::Any(static_cast(AutoLayout::AUTOLAYOUT_VTITLE_VCONTENT))); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slides/_rels/slide1.xml.rels"_ustr); + CPPUNIT_ASSERT(pXmlDocRels); + // find layout XML for the slide from the relationship file + OUString sLayoutRelRelative + = getXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship", "Target"); + OUString sLayoutRelAbs = sLayoutRelRelative.replaceFirst("..", "ppt"); + xmlDocUniquePtr pXmlDocLayout = parseExport(sLayoutRelAbs); + CPPUNIT_ASSERT(pXmlDocLayout); + + // without the fix in place this would be exported as "objTx" + assertXPath(pXmlDocLayout, "/p:sldLayout", "type", u"vertTitleAndTxOverChart"); + + pXmlDocRels = parseExport(u"ppt/slides/_rels/slide2.xml.rels"_ustr); + CPPUNIT_ASSERT(pXmlDocRels); + sLayoutRelRelative = getXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship", "Target"); + sLayoutRelAbs = sLayoutRelRelative.replaceFirst("..", "ppt"); + pXmlDocLayout = parseExport(sLayoutRelAbs); + CPPUNIT_ASSERT(pXmlDocLayout); + + // without the fix in place this would be exported as "picTx" + assertXPath(pXmlDocLayout, "/p:sldLayout", "type", u"vertTitleAndTx"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testtdf169825_layout_type) +{ + createSdImpressDoc("odp/tdf169825_layout_type.odp"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slides/_rels/slide1.xml.rels"_ustr); + CPPUNIT_ASSERT(pXmlDocRels); + // find layout XML for the slide from the relationship file + OUString sLayoutRelRelative + = getXPath(pXmlDocRels, "/rels:Relationships/rels:Relationship", "Target"); + OUString sLayoutRelAbs = sLayoutRelRelative.replaceFirst("..", "ppt"); + xmlDocUniquePtr pXmlDocLayout = parseExport(sLayoutRelAbs); + CPPUNIT_ASSERT(pXmlDocLayout); + + // without the fix in place this would be exported as "vertTitleAndTxOverChart" + // while in the original ODP this was - still possibly bogus - notes layout + assertXPath(pXmlDocLayout, "/p:sldLayout", "type", u"blank"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testtdf170102_layout_type) +{ + createSdImpressDoc("odp/tdf170102_layout_type.odp"); + saveAndReload(TestFilter::PPTX); + + uno::Reference xDoc(mxComponent, uno::UNO_QUERY); + CPPUNIT_ASSERT(xDoc.is()); + sal_Int32 nMPCount = xDoc->getMasterPages()->getCount(); + // test roughly the same thing in document and in XML: no drawing object in master page/layout + for (sal_Int32 i = 0; i < nMPCount; i++) + { + uno::Reference xPage(xDoc->getMasterPages()->getByIndex(i), + uno::UNO_QUERY_THROW); + sal_Int32 nObjCount = xPage->getCount(); + for (sal_Int32 j = 0; j < nObjCount; j++) + { + uno::Reference xShapeInfo(xPage->getByIndex(j), + uno::UNO_QUERY_THROW); + // without the fix in place there would be a graphic shape placeholder + CPPUNIT_ASSERT_MESSAGE( + "Unexpected graphic object shape in exported master page", + !xShapeInfo->supportsService(u"com.sun.star.drawing.GraphicObjectShape"_ustr)); + } + + xmlDocUniquePtr pXmlDocLayout = parseExport(u"ppt/slideLayouts/slideLayout"_ustr + + OUString::number(i + 1) + u".xml"_ustr); + CPPUNIT_ASSERT(pXmlDocLayout); + // without the fix in place there would be a pic layout element for the placeholder + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Unexpected \"pic\" element in exported PPTX slide layout", 0, + countXPathNodes(pXmlDocLayout, "/p:sldLayout/p:cSld/p:spTree/p:pic")); + } +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testFooterIdxConsistency) +{ + createSdImpressDoc("pptx/multiplelayoutfooter.pptx"); + save(TestFilter::PPTX); + + // slide1 points to slideLayout2 + xmlDocUniquePtr pRelsDoc = parseExport(u"ppt/slides/_rels/slide1.xml.rels"_ustr); + assertXPath(pRelsDoc, + "/rels:Relationships/rels:Relationship[@Type='http://" + "schemas.openxmlformats.org/officeDocument/2006/" + "relationships/slideLayout']", + "Target", u"../slideLayouts/slideLayout2.xml"); + + // And they agree on the idx of the footer: + xmlDocUniquePtr pSlide = parseExport(u"ppt/slides/slide1.xml"_ustr); + OUString aFtrIdx = getXPath(pSlide, "//p:sp/p:nvSpPr/p:nvPr/p:ph", "idx"); + xmlDocUniquePtr pLayout = parseExport(u"ppt/slideLayouts/slideLayout2.xml"_ustr); + assertXPath(pLayout, "//p:sp/p:nvSpPr/p:nvPr/p:ph", "idx", aFtrIdx); + // Without the fix it fails with: + // - Expected: 1 + // - Actual : 2 + // - In <>, attribute 'idx' of '//p:sp/p:nvSpPr/p:nvPr/p:ph' incorrect value. +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testOmitCanvasSlideExport) +{ + createSdImpressDoc("odp/canvas-slide.odp"); + + SdXImpressDocument* pXImpressDocument = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pXImpressDocument); + SdDrawDocument* pDoc = pXImpressDocument->GetDoc(); + CPPUNIT_ASSERT_MESSAGE("no document", pDoc != nullptr); + + // the document has 2 pages - one canvas page, and one normal page + CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), pDoc->GetSdPageCount(PageKind::Standard)); + CPPUNIT_ASSERT(pDoc->HasCanvasPage()); + + save(TestFilter::PPTX); + + // Verify that the canvas slide was omitted from the export + // It should have one master slide, and one slide + xmlDocUniquePtr pXmlDocContent = parseExport(u"ppt/presentation.xml"_ustr); + assertXPath(pXmlDocContent, "/p:presentation/p:sldMasterIdLst/p:sldMasterId", 1); + assertXPath(pXmlDocContent, "/p:presentation/p:sldIdLst/p:sldId", 1); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testParaAlignStartEnd) +{ + createSdImpressDoc("odp/para-align-start-end.fodp"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); + + // PresentationML doesn't support start and end paragraph alignment. + // Paragraphs should be exported as left/right alignment, depending on para direction. + assertXPath(pDoc, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[1]/a:pPr[@algn='l']", 1); + assertXPath(pDoc, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr[@algn='r']", 1); + assertXPath(pDoc, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[3]/a:pPr[@algn='r']", 1); + assertXPath(pDoc, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[4]/a:pPr[@algn='l']", 1); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf169559) +{ + createSdImpressDoc("pptx/tdf169524.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slideMasters/slideMaster1.xml"_ustr); + assertXPath( + pXmlDoc, + "/p:sldMaster/p:cSld/p:spTree/p:sp[2]/p:txBody/a:lstStyle/a:lvl1pPr/a:spcAft/a:spcPts", + "val", u"1701"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf114443_PPSX) +{ + createSdImpressDoc("ppsx/tdf114443-6.ppsx"); + save(TestFilter::PPSX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"[Content_Types].xml"_ustr); + + // Without the fix, this would have been: + // application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml + // which means the file loses its slideshow/autoplay nature and PowerPoint rejects it. + assertXPath(pXmlDoc, + "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']", + "ContentType", + u"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testConnectorShapeAnimationTarget) +{ + createSdImpressDoc("pptx/connector-shape-animations.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); + + const OUString sConnectorId = getXPath( + pXmlDoc, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "id"); + + const OUString sShapeId = getXPath( + pXmlDoc, "/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id"); + + // Check connector and shape both have the same ID + CPPUNIT_ASSERT_EQUAL_MESSAGE("Connector and the shape doesn't have the same ID", sConnectorId, + sShapeId); + + // Check animation spid matches ShapeId + assertXPath(pXmlDoc, + "/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/" + "p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par[2]/p:cTn/p:childTnLst/p:set/" + "p:cBhvr/p:tgtEl/p:spTgt", + "spid", sShapeId); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testChartExExport) +{ + createSdImpressDoc("pptx/forum-mso-de-138303.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pDoc = parseExport(u"ppt/slides/slide1.xml"_ustr); + CPPUNIT_ASSERT(pDoc); + + const OString sPath1 = "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Fallback"_ostr; + assertXPath(pDoc, sPath1 + "/xdr:sp"_ostr, 0); + assertXPath(pDoc, sPath1 + "/p:sp"_ostr, 1); + assertXPath(pDoc, sPath1 + "/p:sp/p:nvSpPr/p:nvPr"_ostr, 1); + + pDoc = parseExport(u"ppt/charts/chartEx1.xml"_ustr); + CPPUNIT_ASSERT(pDoc); + + assertXPath(pDoc, "/cx:chartSpace/c:date1904", 0); +} + +// 1. Open PPTX with sections, re-export to PPTX, verify sections preserved +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testSlideSectionsPPTXImport) +{ + createSdImpressDoc("pptx/slide-section-test.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/presentation.xml"_ustr); + + static constexpr OString sPath = "/p:presentation/p:extLst/p:ext/p14:sectionLst"_ostr; + assertXPath(pXmlDoc, sPath + "/p14:section", 3); + assertXPath(pXmlDoc, sPath + "/p14:section[1]", "name", u"Section-1"); + assertXPath(pXmlDoc, sPath + "/p14:section[2]", "name", u"Section-2"); + assertXPath(pXmlDoc, sPath + "/p14:section[3]", "name", u"Section-3"); + assertXPath(pXmlDoc, sPath + "/p14:section[1]/p14:sldIdLst/p14:sldId", 4); + assertXPath(pXmlDoc, sPath + "/p14:section[2]/p14:sldIdLst/p14:sldId", 7); + assertXPath(pXmlDoc, sPath + "/p14:section[3]/p14:sldIdLst/p14:sldId", 2); + + // GUIDs preserved + for (sal_Int32 i = 1; i <= 3; ++i) + { + OUString sId = getXPath(pXmlDoc, sPath + "/p14:section[" + OString::number(i) + "]", "id"); + CPPUNIT_ASSERT(!sId.isEmpty()); + CPPUNIT_ASSERT(sId.startsWith("{")); + } + + // Slide IDs non-zero + OUString sSldId = getXPath(pXmlDoc, sPath + "/p14:section[1]/p14:sldIdLst/p14:sldId[1]", "id"); + CPPUNIT_ASSERT(sSldId.toInt32() > 0); +} + +// 2. Export PPTX with sections to ODP +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testSlideSectionsPPTXToODP) +{ + createSdImpressDoc("pptx/slide-section-test.pptx"); + skipValidation(); + save(TestFilter::ODP); + + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); + + static constexpr OString sPath + = "/office:document-content/office:body/office:presentation/loext:section-list"_ostr; + assertXPath(pXmlDoc, sPath + "/loext:section", 3); + assertXPath(pXmlDoc, sPath + "/loext:section[1]", "name", u"Section-1"); + assertXPath(pXmlDoc, sPath + "/loext:section[2]", "name", u"Section-2"); + assertXPath(pXmlDoc, sPath + "/loext:section[3]", "name", u"Section-3"); + assertXPath(pXmlDoc, sPath + "/loext:section[1]/loext:section-slide", 4); + assertXPath(pXmlDoc, sPath + "/loext:section[2]/loext:section-slide", 7); + assertXPath(pXmlDoc, sPath + "/loext:section[3]/loext:section-slide", 2); +} + +// 3. Open ODP with sections (PPTX -> ODP -> reload ODP) +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testSlideSectionsODPImport) +{ + createSdImpressDoc("pptx/slide-section-test.pptx"); + skipValidation(); + saveAndReload(TestFilter::ODP); + + // Verify the in-memory model loaded from ODP + auto* pXImpressDocument = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pXImpressDocument); + SdDrawDocument* pDoc = pXImpressDocument->GetDoc(); + CPPUNIT_ASSERT(pDoc); + + sd::SlideSectionManager& rMgr = pDoc->GetSectionManager(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rMgr.GetSectionCount()); + CPPUNIT_ASSERT_EQUAL(u"Section-1"_ustr, rMgr.GetSection(0).maName); + CPPUNIT_ASSERT_EQUAL(u"Section-2"_ustr, rMgr.GetSection(1).maName); + CPPUNIT_ASSERT_EQUAL(u"Section-3"_ustr, rMgr.GetSection(2).maName); +} + +// 4. Export ODP with sections to PPTX +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testSlideSectionsODPToPPTX) +{ + createSdImpressDoc("pptx/slide-section-test.pptx"); + skipValidation(); + saveAndReload(TestFilter::ODP); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/presentation.xml"_ustr); + + static constexpr OString sPath = "/p:presentation/p:extLst/p:ext/p14:sectionLst"_ostr; + assertXPath(pXmlDoc, sPath + "/p14:section", 3); + assertXPath(pXmlDoc, sPath + "/p14:section[1]", "name", u"Section-1"); + assertXPath(pXmlDoc, sPath + "/p14:section[2]", "name", u"Section-2"); + assertXPath(pXmlDoc, sPath + "/p14:section[3]", "name", u"Section-3"); + assertXPath(pXmlDoc, sPath + "/p14:section[1]/p14:sldIdLst/p14:sldId", 4); + assertXPath(pXmlDoc, sPath + "/p14:section[2]/p14:sldIdLst/p14:sldId", 7); + assertXPath(pXmlDoc, sPath + "/p14:section[3]/p14:sldIdLst/p14:sldId", 2); + + // Slide IDs non-zero after ODP round-trip + OUString sSldId = getXPath(pXmlDoc, sPath + "/p14:section[1]/p14:sldIdLst/p14:sldId[1]", "id"); + CPPUNIT_ASSERT(sSldId.toInt32() > 0); + + // GUIDs survive ODP round-trip (generated if missing) + for (sal_Int32 i = 1; i <= 3; ++i) + { + OUString sId = getXPath(pXmlDoc, sPath + "/p14:section[" + OString::number(i) + "]", "id"); + CPPUNIT_ASSERT(!sId.isEmpty()); + } +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testCool16078_placeholderKeepsItsOutline) +{ + // Given a layout whose picture placeholder is clipped to an outline of two elements: + // a frame with two holes, one of them round, and a second path holding a triangle that crosses + // the round one: + createSdImpressDoc("pptx/custgeom-placeholder.pptx"); + save(TestFilter::PPTX); + + // The outline is written back as the placeholder's own geometry. Without it the placeholder + // saved as a plain rectangle, and its fill then hid both holes and what showed through. + xmlDocUniquePtr pLayout = parseExportedLayoutNamed(u"Picture placeholder, clipped outline"); + OString aPath + = "//p:sp[p:nvSpPr/p:nvPr/p:ph/@type='pic']/p:spPr/a:custGeom/a:pathLst/a:path"_ostr; + assertXPath(pLayout, aPath, 1); + // Three contours in one path, which is what subtracts the holes from the frame - the same three + // the ODF side writes. The second path is not one of them: it is filled rather than cut out, so + // the triangle it holds took a piece of the round hole back instead of adding a contour. + assertXPath(pLayout, aPath + "/a:moveTo", 3); + assertXPath(pLayout, aPath + "/a:close", 3); + // Four sides each for the two rectangles, the closing one included. + assertXPath(pLayout, aPath + "/a:lnTo", 8); + // What is left of the round hole is still curves, not a polygon flattened out of them. + assertXPath(pLayout, aPath + "/a:cubicBezTo", 6); + assertXPath(pLayout, aPath + "/a:cubicBezTo[1]/a:pt", 3); + // The frame's own corner, in the path's coordinates. + assertXPath(pLayout, aPath + "/a:moveTo[1]/a:pt", "x", u"0"); + assertXPath(pLayout, aPath + "/a:moveTo[1]/a:pt", "y", u"0"); + + // The preset rectangle it used to write would have claimed the whole frame. + assertXPath(pLayout, "//p:sp[p:nvSpPr/p:nvPr/p:ph/@type='pic']/p:spPr/a:prstGeom", 0); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testCool16080_masterKeepsItsPlaceholders) +{ + // Given a deck of one master and eleven layouts, so one Impress master page stands for the + // whole group: + createSdImpressDoc("pptx/master-and-eleven-layouts.pptx"); + save(TestFilter::PPTX); + + // The master part carries its own placeholders. Without the fix it held a shape tree with + // nothing in it, so PowerPoint offered an empty slide master: nothing to inherit from, and + // an edit meant for every layout had to be repeated on each of them. + xmlDocUniquePtr pMaster = parseExport(u"ppt/slideMasters/slideMaster1.xml"_ustr); + static constexpr OString aTree("/p:sldMaster/p:cSld/p:spTree"_ostr); + assertXPath(pMaster, aTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='title']", 1); + assertXPath(pMaster, aTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='dt']", 1); + assertXPath(pMaster, aTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='ftr']", 1); + assertXPath(pMaster, aTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='sldNum']", 1); + + // The body comes from the first layout that has one, since the page standing for the group is + // the Title Slide layout and has none. That layout inherits the master's geometry, so the + // placeholder lands where the master put it rather than where a layout would. + assertXPath(pMaster, aTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='body']", 1); + assertXPath(pMaster, aTree + "/p:sp[p:nvSpPr/p:nvPr/p:ph/@type='body']/p:spPr/a:xfrm/a:off", + "y", u"1825560"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testCool16080_layoutShapesStayOnTheirLayout) +{ + // Given a deck whose first layout paints the whole slide blue, and a slide on another layout, + // which is therefore white: + createSdImpressDoc("pptx/layout-own-background.pptx"); + saveAndReload(TestFilter::PPTX); + + utl::TempFileNamed aPng; + aPng.EnableKillingFile(); + uno::Sequence aFilterData{ + comphelper::makePropertyValue(u"PixelWidth"_ustr, sal_Int32(64)), + comphelper::makePropertyValue(u"PixelHeight"_ustr, sal_Int32(36)) + }; + uno::Sequence aDescriptor{ + comphelper::makePropertyValue(u"URL"_ustr, aPng.GetURL()), + comphelper::makePropertyValue(u"FilterName"_ustr, u"PNG"_ustr), + comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) + }; + auto xExporter = drawing::GraphicExportFilter::create(getComponentContext()); + xExporter->setSourceDocument(getPage(0).queryThrow()); + xExporter->filter(aDescriptor); + + SvFileStream aStream(aPng.GetURL(), StreamMode::READ); + Bitmap aSlide = vcl::PngImageReader(aStream).read(); + CPPUNIT_ASSERT_EQUAL(Size(64, 36), aSlide.GetSizePixel()); + + // The slide is still white. An imported master and layout collapse onto one Impress master + // page, so the page standing for the group holds the first layout's rectangle - and writing + // that page's shapes into the master part painted it under every slide of the deck. Sample + // the side margins, which no placeholder of this layout reaches. + // Without the fix in place, this test would have failed with + // - Expected: rgba[ffffffff] + // - Actual : rgba[0000ffff] + CPPUNIT_ASSERT_EQUAL(COL_WHITE, aSlide.GetPixelColor(2, 18)); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, aSlide.GetPixelColor(61, 18)); + + // The layout it belongs to still paints it, which is what a slide of that layout inherits. + xmlDocUniquePtr pLayout = parseExportedLayoutNamed(u"Title Slide"); + assertXPath(pLayout, + "/p:sldLayout/p:cSld/p:spTree/p:sp[p:nvSpPr/p:cNvPr/@name='Blue background']" + "/p:spPr/a:solidFill/a:srgbClr", + "val", u"0000FF"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testCool16080_masterKeepsWhatItsLayoutsShare) +{ + // Given a deck of one master that draws a rule of its own across the top of the slide, in + // segments of colour, and seven layouts that draw nothing: + createSdImpressDoc("pptx/tdf157740.pptx"); + saveAndReload(TestFilter::PPTX); + + // The rule is on the slide master, so PowerPoint edits it once for every layout. The import + // gives each of the seven Impress master pages a copy, and the master used to get none. + // Without the fix in place, this test would have failed with + // - Expected: 1 + // - Actual : 0 + xmlDocUniquePtr pMaster = parseExport(u"ppt/slideMasters/slideMaster1.xml"_ustr); + assertXPath(pMaster, + "/p:sldMaster/p:cSld/p:spTree/p:grpSp[p:nvGrpSpPr/p:cNvPr/@name='Group 1']", 1); + + // It moved there rather than being written seven more times: a layout holds the three + // placeholders it inherits and nothing else. + xmlDocUniquePtr pLayout = parseExportedLayoutNamed(u"Title, Content over Content"); + static constexpr OString aLayoutTree("/p:sldLayout/p:cSld/p:spTree"_ostr); + assertXPath(pLayout, aLayoutTree + "/*[not(self::p:nvGrpSpPr) and not(self::p:grpSpPr)]", 3); + assertXPath(pLayout, aLayoutTree + "/p:sp/p:nvSpPr/p:nvPr/p:ph", 3); + + // And the slide still shows the rule, wherever it is written + utl::TempFileNamed aPng; + aPng.EnableKillingFile(); + uno::Sequence aFilterData{ + comphelper::makePropertyValue(u"PixelWidth"_ustr, sal_Int32(1920)), + comphelper::makePropertyValue(u"PixelHeight"_ustr, sal_Int32(1080)) + }; + uno::Sequence aDescriptor{ + comphelper::makePropertyValue(u"URL"_ustr, aPng.GetURL()), + comphelper::makePropertyValue(u"FilterName"_ustr, u"PNG"_ustr), + comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) + }; + auto xExporter = drawing::GraphicExportFilter::create(getComponentContext()); + xExporter->setSourceDocument(getPage(0).queryThrow()); + xExporter->filter(aDescriptor); + + SvFileStream aStream(aPng.GetURL(), StreamMode::READ); + Bitmap aSlide = vcl::PngImageReader(aStream).read(); + CPPUNIT_ASSERT_EQUAL(Size(1920, 1080), aSlide.GetSizePixel()); + // 90EBCD is accent5 of the deck's theme, the fill of the rule's second segment + CPPUNIT_ASSERT_EQUAL(Color(0x90EBCD), aSlide.GetPixelColor(200, 5)); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testCool16082_layoutKeepsSubtitle) +{ + // Given a deck whose Title Slide layout carries a subtitle placeholder: + createSdImpressDoc("pptx/master-and-eleven-layouts.pptx"); + save(TestFilter::PPTX); + + // The layout keeps it. Without the fix every layout of a master holding more than one lost its + // subtitle, so a slide made from the layout afterwards had nowhere to put one. + xmlDocUniquePtr pLayout = parseExportedLayoutNamed(u"Title Slide"); + assertXPath(pLayout, "/p:sldLayout/p:cSld/p:spTree/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='subTitle']", + 1); + + // The slide master still gets none, which is what PowerPoint refuses the file over. + xmlDocUniquePtr pMaster = parseExport(u"ppt/slideMasters/slideMaster1.xml"_ustr); + assertXPath(pMaster, "/p:sldMaster/p:cSld/p:spTree/p:sp/p:nvSpPr/p:nvPr/p:ph[@type='subTitle']", + 0); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testCool16079_dateTimeField) +{ + // Given a deck whose date placeholders hold an automatically updated date: + createSdImpressDoc("pptx/master-and-eleven-layouts.pptx"); + save(TestFilter::PPTX); + + // The placeholder keeps a field. Without the fix it held our own display string as literal + // text, so PowerPoint showed "" where the original showed a date. The type is the + // one that leaves the format to the reader, which is what a field holding none asks for - the + // alias PowerPoint writes here stands for a fixed MM/DD/YYYY. + xmlDocUniquePtr pLayout = parseExportedLayoutNamed(u"Title Slide"); + assertXPath(pLayout, "//p:sp[p:nvSpPr/p:nvPr/p:ph/@type='dt']/p:txBody/a:p/a:fld", "type", + u"datetime"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testThemeKeepColorTransforms) +{ + createSdImpressDoc("pptx/empty-title-placeholder.pptx"); + save(TestFilter::PPTX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/theme/theme1.xml"_ustr); + const OString sBasePath = "/a:theme/a:themeElements/a:fmtScheme/a:bgFillStyleLst/a:gradFill[1]" + "/a:gsLst/a:gs[@pos='40000']/a:schemeClr"_ostr; + + // Without the fix satMod would end up negative + assertXPath(pXmlDoc, sBasePath, "val", u"phClr"); + assertXPathChildren(pXmlDoc, sBasePath, 3); + assertXPath(pXmlDoc, sBasePath + "/a:tint", "val", u"45000"); + assertXPath(pXmlDoc, sBasePath + "/a:shade", "val", u"99000"); + assertXPath(pXmlDoc, sBasePath + "/a:satMod", "val", u"350000"); +} + +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest5, testTdf166401_textGivenToAPicturePlaceholder) +{ + // Given a slide whose picture placeholder is given text without any editing, which is what a + // script does and what leaves the placeholder standing for itself rather than for the text: + createSdImpressDoc("pptx/picture-placeholder-custom-prompt.pptx"); + getShapeFromPage(0, 0).queryThrow()->setString( + u"Given to a picture placeholder"_ustr); + save(TestFilter::PPTX); + + // The placeholder is written with its text. It holds no image, so writing it as a picture wrote + // nothing at all and the text went with the shape. + xmlDocUniquePtr pSlide = parseExport(u"ppt/slides/slide1.xml"_ustr); + static constexpr OString aPlaceholder( + "/p:sld/p:cSld/p:spTree/p:sp[p:nvSpPr/p:nvPr/p:ph/@type='pic']"_ostr); + assertXPath(pSlide, aPlaceholder, 1); + assertXPathContent(pSlide, aPlaceholder + "/p:txBody/a:p/a:r/a:t", + u"Given to a picture placeholder"); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index bd44d3b41be3..d6012c0cbc9d 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -1881,6 +1881,39 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testCool16083_contentPlaceholderStaysEmpty) } } +CPPUNIT_TEST_FIXTURE(SdImportTest2, testCool16279_LayoutPlaceholderKeepsMasterAutofit) +{ + // The slide master autofits the text of its title and body, and the Title and Content + // layout's placeholders have an empty bodyPr, so they inherit that + createSdImpressDoc("pptx/master-and-eleven-layouts.pptx"); + + uno::Reference xDoc(mxComponent, uno::UNO_QUERY); + CPPUNIT_ASSERT(xDoc.is()); + uno::Reference xLayout(xDoc->getMasterPages()->getByIndex(1), + uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(u"Title and Content"_ustr, + xLayout.queryThrow()->getName()); + + static constexpr std::u16string_view aPlaceholders[] = { u"Title 1", u"Content Placeholder 2" }; + for (const std::u16string_view& aName : aPlaceholders) + { + uno::Reference xShape; + for (sal_Int32 i = 0; i < xLayout->getCount() && !xShape; i++) + { + if (xLayout->getByIndex(i).queryThrow()->getName() == aName) + xShape.set(xLayout->getByIndex(i), uno::UNO_QUERY_THROW); + } + CPPUNIT_ASSERT(xShape); + + // Without the fix in place, this test would have failed with: + // - Expected: 3 (TextFitToSizeType_AUTOFIT) + // - Actual : 0 (TextFitToSizeType_NONE) + CPPUNIT_ASSERT_EQUAL_MESSAGE( + OUString(aName).toUtf8().getStr(), drawing::TextFitToSizeType_AUTOFIT, + xShape->getPropertyValue(u"TextFitToSize"_ustr).get()); + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx index 0aa0cd82a927..9434c9aaaef3 100644 --- a/sd/qa/unit/layout-tests.cxx +++ b/sd/qa/unit/layout-tests.cxx @@ -8,6 +8,7 @@ */ #include "sdmodeltestbase.hxx" +#include #include #include #include @@ -31,6 +32,28 @@ public: CPPUNIT_ASSERT(pDoc); return pDoc; } + + // Item texts ("A1", "B2", ...) of the layout, each with the label drawn before it + OUString getNumberedItems() + { + xmlDocUniquePtr pXmlDoc = parseLayout(); + OUStringBuffer aItems; + OUString aLabel; + const int nCount = countXPathNodes(pXmlDoc, "//textarray"); + for (int i = 1; i <= nCount; ++i) + { + const OUString aText + = getXPathContent(pXmlDoc, "(//textarray)[" + OString::number(i) + "]/text"); + if (aText.endsWith(".")) + aLabel = aText; + else if (aText.getLength() == 2 && rtl::isAsciiDigit(aText[1])) + { + aItems.append(aLabel + aText + " "); + aLabel.clear(); + } + } + return aItems.makeStringAndClear(); + } }; CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf104722) @@ -302,6 +325,47 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, numberedList) } } +CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf173712) +{ + // Sixteen text boxes with numbered lists; the expected numbers are those PowerPoint shows + createSdImpressDoc("pptx/tdf173712.pptx"); + + // Without the fix in place, e.g. every item of A (startAt="2" on each) was numbered "2." + CPPUNIT_ASSERT_EQUAL( + u"2.A1 3.A2 4.A3 5.A4 " // startAt="2" on every item + "1.B1 2.B2 5.B3 6.B4 " // no startAt, then startAt="5" + "2.C1 3.C2 4.C3 5.C4 " // startAt="2", then startAt="4" + "1.D1 2.D2 3.D3 4.D4 " // no startAt, then startAt="1" + "2.E1 3.E2 E3 2.E4 3.E5 " // plain paragraph between + "2.F1 3.F2 F3 2.F4 3.F5 " // buNone paragraph between + "1.G1 2.G2 I.G3 II.G4 " // arabicPeriod, then romanUcPeriod + "3.H1 4.H2 a.H3 b.H4 5.H5 a.H6 6.H7 " // nested, outer startAt="3" + "1.I1 2.I2 3.I3 2.I4 2.I5 3.I6 " // nested, inner startAt="2" + "2.J1 3.J2 J3 4.J4 5.J5 " // unnumbered lvl="1" paragraph between + "1.K1 a.K2 b.K3 K4 a.K5 2.K6 " // unnumbered paragraph inside the inner list + "2.L1 2.L2 3.L3 2.L4 3.L5 " // startAt="2" on both levels + "2.M1 3.M2 M3 2.M4 3.M5 " // paragraph without a:pPr between + "2.N1 3.N2 1.N3 2.N4 " // startAt="2", then no startAt + "5.O1 6.O2 2.O3 3.O4 " // startAt="5", then startAt="2" + "1.R1 2.R2 R3 1.R4 2.R5 "_ustr, // paragraph without a:pPr, no startAt + getNumberedItems()); +} + +CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf173712_listStyle) +{ + // a:lstStyle has for level 1, but no startAt in Z + createSdImpressDoc("pptx/tdf173712-liststyle.pptx"); + + // Without the fix in place, every item was numbered "2." + CPPUNIT_ASSERT_EQUAL( + u"2.U1 3.U2 4.U3 5.U4 " // no a:pPr + "2.V1 3.V2 4.V3 5.V4 " // a:pPr without a bullet + "2.W1 3.W2 4.W3 5.W4 " // own buAutoNum with startAt="2" too + "2.Y1 3.Y2 4.Y3 5.Y4 " // from the list style, own, own, from the list style + "1.Z1 2.Z2 Z3 1.Z4 2.Z5 "_ustr, // no startAt, buNone paragraph between + getNumberedItems()); +} + CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf146731) { createSdImpressDoc("pptx/tdf146731.pptx"); diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index 1335ed4f8fea..e49a8b1e42ec 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -66,6 +66,8 @@ #include #include #include +#include +#include #include #include #include @@ -93,8 +95,54 @@ public: sd::slidesorter::SlideSorterViewShell* getSlideSorterViewShell(const css::uno::Reference& xComp = nullptr); void lcl_search(const OUString& rKey, bool bFindAll = false, bool bBackwards = false); + // Opens a new presentation in Outline view, with one slide per title. + OutlinerView* createOutlineView(std::initializer_list aTitles); + // Sends keys to the Outline view, where postKeyEvent() does not reach. + void typeOutlineKey(sal_uInt16 nKey); + void typeOutlineString(std::u16string_view aStr); }; +void SdUiImpressTest::typeOutlineKey(sal_uInt16 nKey) +{ + auto pImpressDocument = dynamic_cast(mxComponent.get()); + sd::ViewShell* pViewShell = pImpressDocument->GetDocShell()->GetViewShell(); + pViewShell->KeyInput(KeyEvent(0, vcl::KeyCode(nKey)), pViewShell->GetActiveWindow()); + Scheduler::ProcessEventsToIdle(); +} + +void SdUiImpressTest::typeOutlineString(std::u16string_view aStr) +{ + auto pImpressDocument = dynamic_cast(mxComponent.get()); + sd::ViewShell* pViewShell = pImpressDocument->GetDocShell()->GetViewShell(); + for (const char16_t c : aStr) + pViewShell->KeyInput(KeyEvent(c, vcl::KeyCode()), pViewShell->GetActiveWindow()); + Scheduler::ProcessEventsToIdle(); +} + +OutlinerView* SdUiImpressTest::createOutlineView(std::initializer_list aTitles) +{ + createSdImpressDoc(); + dispatchCommand(mxComponent, u".uno:OutlineMode"_ustr, {}); + auto pImpressDocument = dynamic_cast(mxComponent.get()); + CPPUNIT_ASSERT(pImpressDocument); + sd::ViewShell* pViewShell = pImpressDocument->GetDocShell()->GetViewShell(); + CPPUNIT_ASSERT_EQUAL(sd::ViewShell::ST_OUTLINE, pViewShell->GetShellType()); + auto pView = static_cast(pViewShell->GetView()); + OutlinerView* pOutlinerView = pView->GetViewByWindow(pViewShell->GetActiveWindow()); + CPPUNIT_ASSERT(pOutlinerView); + + bool bFirst = true; + for (const std::u16string_view& aTitle : aTitles) + { + if (!std::exchange(bFirst, false)) + typeOutlineKey(KEY_RETURN); + typeOutlineString(aTitle); + } + CPPUNIT_ASSERT_EQUAL(sal_uInt16(aTitles.size()), + pImpressDocument->GetDoc()->GetSdPageCount(PageKind::Standard)); + return pOutlinerView; +} + void SdUiImpressTest::checkCurrentPageNumber(sal_uInt16 nNum) { uno::Reference xModel(mxComponent, uno::UNO_QUERY); @@ -801,7 +849,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf96708) const sal_uInt16 nMasterPageCnt2 = pDoc->GetMasterSdPageCount(PageKind::Standard); //FIXME: tdf#151802: Number of master pages should be 4, it's 5 instead - //CPPUNIT_ASSERT_EQUAL(nMasterPageCnt1, nMasterPageCnt2); + // CPPUNIT_ASSERT_EQUAL(nMasterPageCnt1, nMasterPageCnt2); CPPUNIT_ASSERT_EQUAL(sal_uInt16(5), nMasterPageCnt2); } @@ -2734,6 +2782,91 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf166401_anEditElsewhereIsLeftAlone) pView->SdrEndTextEdit(); } +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testOutlineDemoteTitle) +{ + OutlinerView* pOutlinerView = createOutlineView({ u"A", u"B" }); + auto pImpressDocument = dynamic_cast(mxComponent.get()); + + // Tab in front of "B" turns the title of the second slide into a paragraph of the first. + pOutlinerView->SetSelection(ESelection(1, 0, 1, 0)); + typeOutlineKey(KEY_TAB); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), + pImpressDocument->GetDoc()->GetSdPageCount(PageKind::Standard)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pOutlinerView->GetOutliner().GetParagraphCount()); +} + +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testOutlineSelectedPages) +{ + createOutlineView({ u"A", u"B" }); + auto pImpressDocument = dynamic_cast(mxComponent.get()); + SdDrawDocument* pDoc = pImpressDocument->GetDoc(); + pDoc->GetSdPage(0, PageKind::Standard)->SetSelected(false); + pDoc->GetSdPage(1, PageKind::Standard)->SetSelected(false); + + // The state of the summary slide command marks the slide of the cursor as selected. + SfxPoolItemHolder aState; + pImpressDocument->GetDocShell()->GetViewShell()->GetViewFrame()->GetDispatcher()->QueryState( + SID_SUMMARY_PAGE, aState); + CPPUNIT_ASSERT(!pDoc->GetSdPage(0, PageKind::Standard)->IsSelected()); + CPPUNIT_ASSERT(pDoc->GetSdPage(1, PageKind::Standard)->IsSelected()); +} + +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testOutlineDeleteAcrossSlides) +{ + // Slides "A" with the body paragraph "x", "B" and "C". + createSdImpressDoc(); + auto pImpressDocument = dynamic_cast(mxComponent.get()); + SdDrawDocument* pDoc = pImpressDocument->GetDoc(); + auto xDrawPages = mxComponent.queryThrow()->getDrawPages(); + xDrawPages->insertNewByIndex(0); + xDrawPages->insertNewByIndex(1); + const std::u16string_view aTitles[] = { u"A", u"B", u"C" }; + for (sal_uInt16 i = 0; i < std::size(aTitles); ++i) + { + SdPage* pPage = pDoc->GetSdPage(i, PageKind::Standard); + pPage->SetAutoLayout(AUTOLAYOUT_TITLE_CONTENT, true); + auto pTitle = static_cast(pPage->GetPresObj(PresObjKind::Title)); + pTitle->SetText(OUString(aTitles[i])); + pTitle->SetEmptyPresObj(false); + } + auto pBody = static_cast( + pDoc->GetSdPage(0, PageKind::Standard)->GetPresObj(PresObjKind::Outline)); + pBody->SetText(u"x"_ustr); + pBody->SetEmptyPresObj(false); + + dispatchCommand(mxComponent, u".uno:OutlineMode"_ustr, {}); + sd::ViewShell* pViewShell = pImpressDocument->GetDocShell()->GetViewShell(); + CPPUNIT_ASSERT_EQUAL(sd::ViewShell::ST_OUTLINE, pViewShell->GetShellType()); + auto pView = static_cast(pViewShell->GetView()); + OutlinerView* pOutlinerView = pView->GetViewByWindow(pViewShell->GetActiveWindow()); + CPPUNIT_ASSERT(pOutlinerView); + Outliner& rOutliner = pOutlinerView->GetOutliner(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), rOutliner.GetParagraphCount()); + + // Deleting from the end of "A" to the end of "B" removes the second slide only. + pOutlinerView->SetSelection(ESelection(0, 1, 2, 1)); + typeOutlineKey(KEY_DELETE); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), rOutliner.GetParagraphCount()); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), pDoc->GetSdPageCount(PageKind::Standard)); +} + +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testOutlineMoveTitleUp) +{ + OutlinerView* pOutlinerView = createOutlineView({ u"A", u"B", u"C" }); + auto pImpressDocument = dynamic_cast(mxComponent.get()); + SdDrawDocument* pDoc = pImpressDocument->GetDoc(); + SdPage* pPageB = pDoc->GetSdPage(1, PageKind::Standard); + SdPage* pPageC = pDoc->GetSdPage(2, PageKind::Standard); + + // Moving "C" up moves its slide in front of the slide of "B". + pOutlinerView->SetSelection(ESelection(2, 0, 2, 1)); + dispatchCommand(mxComponent, u".uno:OutlineUp"_ustr, {}); + CPPUNIT_ASSERT_EQUAL(u"C"_ustr, pOutlinerView->GetOutliner().GetText( + pOutlinerView->GetOutliner().GetParagraph(1))); + CPPUNIT_ASSERT_EQUAL(pPageC, pDoc->GetSdPage(1, PageKind::Standard)); + CPPUNIT_ASSERT_EQUAL(pPageB, pDoc->GetSdPage(2, PageKind::Standard)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index c319561f74a1..c765e9eb423b 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -30,6 +30,8 @@ #include #include +#include +#include #include #include #include @@ -1035,15 +1037,59 @@ void SdDrawDocument::renameObjectStylesIfNeeded(sal_uInt32 nInsertPos, try { for (sal_uInt32 p = nInsertPos; p < nInsertPos + nBMSdPageCount ; p++) { - if (SdPage* pPage = static_cast(GetPage(p))) { - for (const rtl::Reference& pObj : *pPage) + if (SdPage* pPage = static_cast(GetPage(p))) + { + // iterate over ALL SdrObjects, including GroupContent + SdrObjListIter aObjIter(pPage); + + for (SdrObject* pObject(aObjIter.Next()); pObject; pObject = aObjIter.Next()) { - if (pObj->GetStyleSheet()) + if (pObject->GetStyleSheet()) { - OUString aStyleName = pObj->GetStyleSheet()->GetName(); - SfxStyleSheet* pSheet = lcl_findStyle(rStyleContext.aGraphicStyles, Concat2View(aStyleName + rStyleContext.aRenameString)); + const OUString& rStyleName(pObject->GetStyleSheet()->GetName()); + SfxStyleSheet* pSheet = lcl_findStyle(rStyleContext.aGraphicStyles, Concat2View(rStyleName + rStyleContext.aRenameString)); + if (pSheet) - pObj->SetStyleSheet(pSheet, true); + { + // for whatever reason this change of StyleSheet *changes* the look of SdrObjects, + // which is not wanted. I am not sure if these are just the 'wrong' StyleSheets that + // got copied or something else. It may happen when slides from more than two sources + // get copied to a document: The newly imported styles get 'extended' names following + // a naming scheme. When pasting from a 2nd document, the *same* names for slides get + // created using that naming scheme, so before these were re-used here assuming they + // have the same content - which is wrong. + // To just *ensure* that the objects look will not change, compare previous ItemValues + // with those ItemValues after changing the style, that guarantees equal look - for the + // cost of some more hard-set attributes, but less StyleSheets. + // i see that these corrections *are* done, so that is a clear hint that re-setting + // these Styles in this whole import has basic errors, I have to correct the values. + + // To do so: create a copy of the current state of all Items with the original + // state, as hard attribute, in a temporary SfxItemSet, using deep-detection (bParent == true) + SfxItemSet aCopyOfOrig(*pObject->GetMergedItemSet().GetPool(), pObject->GetMergedItemSet().GetRanges()); + SfxWhichIter aWhichIter(pObject->GetMergedItemSet()); + for (sal_uInt16 nWhich = aWhichIter.FirstWhich(); nWhich; nWhich = aWhichIter.NextWhich()) + aCopyOfOrig.Put(pObject->GetMergedItem(nWhich)); + + // set new style + pObject->SetStyleSheet(pSheet, true); + + // iterate over Items after StyleSheet change, also deep-detection (bParent == true) + for (sal_uInt16 nWhich = aWhichIter.FirstWhich(); nWhich; nWhich = aWhichIter.NextWhich()) + { + const SfxPoolItem& rOld(aCopyOfOrig.Get(nWhich)); + const SfxPoolItem& rNew(pObject->GetMergedItem(nWhich)); + + // if that Item *changed* from the SdrObject's perspective + // *including* the newly applied Style, it is wrong. + // Set that Item to original as hard/direct Item to get that + // value reliably back. + // NOTE: When looking at some cases this needed to be done for + // about eight to twelve Items, not too much + if (!SfxPoolItem::areSame(rOld, rNew)) + pObject->SetMergedItem(rOld); + } + } } } } diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 9843f5ed8785..4a7152993130 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -3330,12 +3330,12 @@ void PowerPointExport::WriteNotesMaster() auto pTheme = std::make_shared("Office Theme"); pTheme->setColorSet(std::make_shared(*pDefaultColorSet)); - WriteTheme(mnMasterPages - static_cast(mbHasCanvasPage), pTheme.get()); + WriteTheme(mnThemeIdMax, pTheme.get()); // add implicit relation to the presentation theme addRelation(pFS->getOutputStream(), oox::getRelationship(Relationship::THEME), - Concat2View("../theme/theme" + OUString::number(mnMasterPages + 1 - static_cast(mbHasCanvasPage)) + ".xml")); + Concat2View("../theme/theme" + OUString::number(++mnThemeIdMax) + ".xml")); } pFS->startElementNS(XML_p, XML_notesMaster, presentationNamespaces(*this)); diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index 218d9018447e..a67ab29670c0 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -379,7 +379,7 @@ OUString StringToHTMLString( std::u16string_view rString ) } // converts a paragraph of the outliner to html -OUString ParagraphToHTMLString( SdrOutliner const * pOutliner, sal_Int32 nPara ) +OUString ParagraphToHTMLString( SdrOutliner* pOutliner, sal_Int32 nPara ) { OUStringBuffer aStr; @@ -387,7 +387,7 @@ OUString ParagraphToHTMLString( SdrOutliner const * pOutliner, sal_Int32 nPara ) return OUString(); // TODO: MALTE!!! - EditEngine& rEditEngine = *const_cast(&pOutliner->GetEditEngine()); + EditEngine& rEditEngine = pOutliner->GetEditEngine(); bool bOldUpdateMode = rEditEngine.SetUpdateLayout(true); Paragraph* pPara = pOutliner->GetParagraph(nPara); diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 06e8f4176f70..0b1ebc87128d 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -233,7 +233,7 @@ bool ImplSdPPTImport::Import() SdrOutliner& rOutl = mrDoc.GetDrawOutliner(); EEControlBits nControlWord = rOutl.GetEditEngine().GetControlWord(); nControlWord |= EEControlBits::ULSPACESUMMATION; - const_cast(rOutl.GetEditEngine()).SetControlWord( nControlWord ); + rOutl.GetEditEngine().SetControlWord( nControlWord ); SdrLayerAdmin& rAdmin = mrDoc.GetLayerAdmin(); mnBackgroundObjectsLayerID = rAdmin.GetLayerID( sUNO_LayerName_background_objects ); diff --git a/sd/source/ui/annotations/AnnotationPopup.cxx b/sd/source/ui/annotations/AnnotationPopup.cxx index f1589001befd..79cd5eb61f35 100644 --- a/sd/source/ui/annotations/AnnotationPopup.cxx +++ b/sd/source/ui/annotations/AnnotationPopup.cxx @@ -60,6 +60,21 @@ void AnnotationPopup::closePopup() { mpAnnotationWindow->SaveToDocument(); mpAnnotationWindow.reset(); + + sd::DrawDocShell* pDocShell = dynamic_cast(SfxObjectShell::Current()); + if (pDocShell) + { + sd::ViewShell* pViewShell = pDocShell->GetViewShell(); + if (pViewShell) + { + const auto pAnnotation = mxAnnotation->findAnnotationObject(); + if (pAnnotation) + { + pViewShell->GetView()->MarkObj(pAnnotation, + pViewShell->GetView()->GetSdrPageView(), true); + } + } + } } } diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx index f46f53c20c35..845d7d0bfc4f 100644 --- a/sd/source/ui/controller/slidelayoutcontroller.cxx +++ b/sd/source/ui/controller/slidelayoutcontroller.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -36,7 +37,6 @@ #include #include -#include #include @@ -61,24 +61,19 @@ class LayoutToolbarMenu : public WeldToolbarPopup { public: LayoutToolbarMenu(SlideLayoutController* pController, weld::Widget* pParent, const bool bInsertPage, const OUString& rCommand); - virtual void GrabFocus() override - { - mxLayoutSet1->GrabFocus(); - } + virtual void GrabFocus() override { mxLayoutIconView1->grab_focus(); } protected: DECL_LINK(SelectToolbarMenuHdl, weld::Button&, void); - DECL_LINK(SelectValueSetHdl, ValueSet*, void); + DECL_LINK(IconViewItemActivatedHdl, const weld::TreeIter&, bool); void SelectHdl(AutoLayout eLayout); private: rtl::Reference mxControl; bool const mbInsertPage; std::unique_ptr mxFrame1; - std::unique_ptr mxLayoutSet1; - std::unique_ptr mxLayoutSetWin1; + std::unique_ptr mxLayoutIconView1; std::unique_ptr mxFrame2; - std::unique_ptr mxLayoutSet2; - std::unique_ptr mxLayoutSetWin2; + std::unique_ptr mxLayoutIconView2; std::unique_ptr mxMoreButton; }; @@ -137,28 +132,21 @@ constexpr snew_slide_value_info_layout v_standard[] = {EMPTY, {}, AUTOLAYOUT_NONE} }; -static void fillLayoutValueSet( ValueSet* pValue, const snew_slide_value_info_layout* pInfo ) +static void fillLayoutIconView(weld::IconView& rView, const snew_slide_value_info_layout* pInfo) { Size aLayoutItemSize; for( ; pInfo->mpStrResId; pInfo++ ) { OUString aText(SdResId(pInfo->mpStrResId)); - Image aImg(StockImage::Yes, pInfo->msBmpResId); - pValue->InsertItem(static_cast(pInfo->maAutoLayout)+1, aImg, aText); + Bitmap aImg = Image(StockImage::Yes, pInfo->msBmpResId).GetBitmap(); + const int nIndex = rView.n_children(); + const OUString sId = OUString::number(pInfo->maAutoLayout); + rView.insert(nIndex, nullptr, &sId, &aImg, nullptr); + rView.set_item_accessible_name(nIndex, aText); + rView.set_item_tooltip_text(nIndex, aText); aLayoutItemSize.setWidth( std::max( aLayoutItemSize.Width(), aImg.GetSizePixel().Width() ) ); aLayoutItemSize.setHeight( std::max( aLayoutItemSize.Height(), aImg.GetSizePixel().Height() ) ); } - - aLayoutItemSize = pValue->CalcItemSizePixel( aLayoutItemSize ); - Size aSize(pValue->CalcWindowSizePixel(aLayoutItemSize)); - - const sal_Int32 LAYOUT_BORDER_PIX = 7; - - aSize.AdjustWidth((pValue->GetColCount() + 1) * LAYOUT_BORDER_PIX); - aSize.AdjustHeight((pValue->GetLineCount() +1) * LAYOUT_BORDER_PIX); - - pValue->GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height()); - pValue->SetOutputSizePixel(aSize); } LayoutToolbarMenu::LayoutToolbarMenu(SlideLayoutController* pControl, weld::Widget* pParent, const bool bInsertPage, const OUString& rCommand) @@ -166,16 +154,11 @@ LayoutToolbarMenu::LayoutToolbarMenu(SlideLayoutController* pControl, weld::Widg , mxControl(pControl) , mbInsertPage(bInsertPage) , mxFrame1(m_xBuilder->weld_frame(u"horiframe"_ustr)) - , mxLayoutSet1(new ValueSet(nullptr)) - , mxLayoutSetWin1(new weld::CustomWeld(*m_xBuilder, u"valueset1"_ustr, *mxLayoutSet1)) + , mxLayoutIconView1(m_xBuilder->weld_icon_view(u"iconview1"_ustr)) , mxFrame2(m_xBuilder->weld_frame(u"vertframe"_ustr)) - , mxLayoutSet2(new ValueSet(nullptr)) - , mxLayoutSetWin2(new weld::CustomWeld(*m_xBuilder, u"valueset2"_ustr, *mxLayoutSet2)) + , mxLayoutIconView2(m_xBuilder->weld_icon_view(u"iconview2"_ustr)) , mxMoreButton(m_xBuilder->weld_button(u"more"_ustr)) { - mxLayoutSet1->SetStyle(WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT); - mxLayoutSet2->SetStyle(WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT); - DrawViewMode eMode = DrawViewMode_DRAW; // find out which view is running @@ -191,21 +174,19 @@ LayoutToolbarMenu::LayoutToolbarMenu(SlideLayoutController* pControl, weld::Widg const bool bVerticalEnabled = SvtCJKOptions::IsVerticalTextEnabled(); - mxLayoutSet1->SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectValueSetHdl ) ); + mxLayoutIconView1->connect_item_activated( + LINK(this, LayoutToolbarMenu, IconViewItemActivatedHdl)); const snew_slide_value_info_layout* pInfo = nullptr; - sal_Int16 nColCount = 4; switch( eMode ) { case DrawViewMode_DRAW: pInfo = &standard[0]; break; - case DrawViewMode_HANDOUT: pInfo = &handout[0]; nColCount = 2; break; - case DrawViewMode_NOTES: pInfo = ¬es[0]; nColCount = 1; break; + case DrawViewMode_HANDOUT: pInfo = &handout[0]; break; + case DrawViewMode_NOTES: pInfo = ¬es[0]; break; default: assert(false); // can't happen, will crash later otherwise } - mxLayoutSet1->SetColCount( nColCount ); - - fillLayoutValueSet( mxLayoutSet1.get(), pInfo ); + fillLayoutIconView(*mxLayoutIconView1, pInfo); bool bUseUILabel = (bVerticalEnabled && eMode == DrawViewMode_DRAW); if (!bUseUILabel) @@ -216,11 +197,10 @@ LayoutToolbarMenu::LayoutToolbarMenu(SlideLayoutController* pControl, weld::Widg if (bVerticalEnabled && eMode == DrawViewMode_DRAW) { - mxLayoutSet2->SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectValueSetHdl ) ); - mxLayoutSet2->SetColCount( 4 ); - mxLayoutSet2->EnableFullItemMode( false ); + mxLayoutIconView2->connect_item_activated( + LINK(this, LayoutToolbarMenu, IconViewItemActivatedHdl)); - fillLayoutValueSet( mxLayoutSet2.get(), &v_standard[0] ); + fillLayoutIconView(*mxLayoutIconView2, &v_standard[0]); mxFrame2->show(); } @@ -255,9 +235,11 @@ LayoutToolbarMenu::LayoutToolbarMenu(SlideLayoutController* pControl, weld::Widg mxMoreButton->show(); } -IMPL_LINK(LayoutToolbarMenu, SelectValueSetHdl, ValueSet*, pLayoutSet, void) +IMPL_LINK(LayoutToolbarMenu, IconViewItemActivatedHdl, const weld::TreeIter&, rIter, bool) { - SelectHdl(static_cast(pLayoutSet->GetSelectedItemId()-1)); + SelectHdl(static_cast(rIter.getItemView().get_id(rIter).toInt32())); + + return true; } IMPL_LINK_NOARG(LayoutToolbarMenu, SelectToolbarMenuHdl, weld::Button&, void) diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index eefb8a45f38b..caa428724efb 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -570,7 +570,7 @@ bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool pOutl->Init( OutlinerMode::TextObject ); OutlinerMode nOutlMode = pOutl->GetOutlinerMode(); - EditEngine* pEdit = const_cast< EditEngine* >(&pOutl->GetEditEngine()); + EditEngine& rEdit = pOutl->GetEditEngine(); OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); if( pOPO ) @@ -579,10 +579,10 @@ bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool EPaM aDateFieldPosition; bool bHasDateFieldItem = false; - sal_Int32 nParaCount = pEdit->GetParagraphCount(); + sal_Int32 nParaCount = rEdit.GetParagraphCount(); for (sal_Int32 nPara = 0; (nPara < nParaCount) && !bHasDateFieldItem; ++nPara) { - for (const EFieldInfo& rFieldInfo : pEdit->GetFieldInfo(nPara)) + for (const EFieldInfo& rFieldInfo : rEdit.GetFieldInfo(nPara)) { if (rFieldInfo.pFieldItem) { @@ -602,7 +602,7 @@ bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool { if( bSet ) { - SfxItemSet aSet(pEdit->GetAttribs(aDateFieldPosition.nPara, + SfxItemSet aSet(rEdit.GetAttribs(aDateFieldPosition.nPara, aDateFieldPosition.nIndex, aDateFieldPosition.nIndex+1, GetAttribsFlags::CHARATTRIBS)); @@ -618,7 +618,7 @@ bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool ESelection aSel(aDateFieldPosition.nPara, aDateFieldPosition.nIndex, aDateFieldPosition.nPara, aDateFieldPosition.nIndex+1 ); - pEdit->QuickSetAttribs( aSet, aSel ); + rEdit.QuickSetAttribs( aSet, aSel ); pObj->SetOutlinerParaObject( pOutl->CreateParaObject() ); pOutl->UpdateFields(); diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 766631be8f90..bf87e290ad62 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -424,7 +424,7 @@ bool DrawDocShell::ImportFrom(SfxMedium &rMedium, SdrOutliner& rOutl = mpDoc->GetDrawOutliner(); EEControlBits nControlWord = rOutl.GetEditEngine().GetControlWord(); nControlWord |= EEControlBits::ULSPACESUMMATION; - const_cast(rOutl.GetEditEngine()).SetControlWord( nControlWord ); + rOutl.GetEditEngine().SetControlWord( nControlWord ); mpDoc->SetSummationOfParagraphs(); diff --git a/sd/source/ui/func/fuprlout.cxx b/sd/source/ui/func/fuprlout.cxx index 82e1124e3803..459c2c1ad7d8 100644 --- a/sd/source/ui/func/fuprlout.cxx +++ b/sd/source/ui/func/fuprlout.cxx @@ -38,6 +38,7 @@ #include #include #include +#include namespace sd { @@ -187,6 +188,16 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) if (bError) return; + // tdf#111085 - exchanging the master page already updates all slides using the same master, + // so it is enough to update one selected slide per master + std::vector aPageNumsToChange; + std::unordered_set aHandledLayouts; + for (size_t i = 0; i < aSelectedPages.size(); ++i) + { + if (!bMasterPage || aHandledLayouts.insert(aSelectedPages[i]->GetLayoutName()).second) + aPageNumsToChange.push_back(aSelectedPageNums[i]); + } + mpDocSh->SetWaitCursor( true ); /* Here, we only exchange masterpages, therefore the current page @@ -210,14 +221,14 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) OUString aLayoutName; if( pTempDoc ) aLayoutName = aFile.getToken(0, DOCUMENT_TOKEN, nIdx); - for (auto nSelectedPage : aSelectedPageNums) + for (auto nSelectedPage : aPageNumsToChange) mrDoc.SetMasterPage(nSelectedPage, aLayoutName, pTempDoc, bMasterPage, bCheckMasters); mrDoc.CloseBookmarkDoc(); } else { // use master page with the layout name aFile from current Doc - for (auto nSelectedPage : aSelectedPageNums) + for (auto nSelectedPage : aPageNumsToChange) mrDoc.SetMasterPage(nSelectedPage, aFile, &mrDoc, bMasterPage, bCheckMasters); } diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx index 0cacbe32c0b2..a3c41f9692bc 100644 --- a/sd/source/ui/func/futransf.cxx +++ b/sd/source/ui/func/futransf.cxx @@ -83,7 +83,6 @@ void FuTransform::DoExecute( SfxRequest& rReq ) SfxItemSet aSet( mpView->GetGeoAttrFromMarked() ); VclPtr pDlg; - bool bWelded = false; SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); if( rMarkList.GetMarkCount() == 1 && pObj->GetObjInventor() == SdrInventor::Default && @@ -105,7 +104,6 @@ void FuTransform::DoExecute( SfxRequest& rReq ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); pDlg.reset(pFact->CreateSvxTransformTabDialog(mrViewShell.GetFrameWeld(), &aSet, mpView)); - bWelded = true; } assert(pDlg && "there must be a dialog at this point"); @@ -113,7 +111,7 @@ void FuTransform::DoExecute( SfxRequest& rReq ) auto xRequest = std::make_shared(rReq); rReq.Ignore(); // the 'old' request is not relevant any more - pDlg->StartExecuteAsync([bWelded, pDlg, xRequest=std::move(xRequest), this](sal_Int32 nResult){ + pDlg->StartExecuteAsync([pDlg, xRequest=std::move(xRequest), this](sal_Int32 nResult){ if (nResult == RET_OK) { xRequest->Done(*(pDlg->GetOutputItemSet())); @@ -124,8 +122,7 @@ void FuTransform::DoExecute( SfxRequest& rReq ) // deferred until the dialog ends mrViewShell.Invalidate(SID_RULER_OBJECT); mrViewShell.Cancel(); - if (bWelded) - pDlg->disposeOnce(); + pDlg->disposeOnce(); }); } diff --git a/sd/source/ui/inc/TableDesignPane.hxx b/sd/source/ui/inc/TableDesignPane.hxx index 27e7971b5c62..c067e78fe5e2 100644 --- a/sd/source/ui/inc/TableDesignPane.hxx +++ b/sd/source/ui/inc/TableDesignPane.hxx @@ -54,7 +54,6 @@ enum TableCheckBox : sal_uInt16 class TableValueSet final : public ValueSet { private: - bool m_bModal; Link maContextMenuHandler; public: TableValueSet(std::unique_ptr pScrolledWindow); @@ -62,7 +61,6 @@ public: virtual void Resize() override; virtual void StyleUpdated() override; void updateSettings(); - void setModal(bool bModal) { m_bModal = bModal; } void SetContextMenuHandler(const Link& rLink) { maContextMenuHandler = rLink; } static constexpr int getMaxRowCount() { return 3; } }; diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx index 23ac8e9aa4b2..8652225be7db 100644 --- a/sd/source/ui/remotecontrol/Receiver.cxx +++ b/sd/source/ui/remotecontrol/Receiver.cxx @@ -148,7 +148,7 @@ void Receiver::executeCommand( const std::vector &aCommand ) { try { - // std::cerr << "pointer_coordination in the is" << std::endl; + // std::cerr << "pointer_coordination is" << std::endl; xSlideShow->setProperty(beans::PropertyValue(u"PointerPosition"_ustr, -1, Any(pos), beans::PropertyState_DIRECT_VALUE)); } diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 9183885bf78f..1f6f962c3e11 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -110,7 +110,6 @@ TableDesignWidget::TableDesignWidget(weld::Builder& rBuilder, ViewShellBase& rBa { m_xValueSet->SetStyle(m_xValueSet->GetStyle() | WB_NO_DIRECTSELECT | WB_FLATVALUESET | WB_ITEMBORDER); m_xValueSet->SetExtraSpacing(8); - m_xValueSet->setModal(false); m_xValueSet->SetColor(); m_xValueSet->SetSelectHdl(LINK(this, TableDesignWidget, implValueSetHdl)); m_xValueSet->SetContextMenuHandler(LINK(this, TableDesignWidget, implContextMenuHandler)); @@ -622,20 +621,16 @@ void TableValueSet::Resize() SetColCount (static_cast(nColumnCount)); SetLineCount (static_cast(nVisibleRowCount)); - if( !m_bModal ) + WinBits nStyle = GetStyle() & ~WB_VSCROLL; + if (nRowCount > nVisibleRowCount) { - WinBits nStyle = GetStyle() & ~WB_VSCROLL; - if( nRowCount > nVisibleRowCount ) - { - nStyle |= WB_VSCROLL; - } - SetStyle( nStyle ); + nStyle |= WB_VSCROLL; } + SetStyle(nStyle); } TableValueSet::TableValueSet(std::unique_ptr pScrolledWindow) : ValueSet(std::move(pScrolledWindow)) - , m_bModal(false) { } @@ -646,12 +641,9 @@ void TableValueSet::StyleUpdated() void TableValueSet::updateSettings() { - if( !m_bModal ) - { - Color aColor = Application::GetSettings().GetStyleSettings().GetWindowColor(); - SetColor(aColor); - SetExtraSpacing(8); - } + Color aColor = Application::GetSettings().GetStyleSettings().GetWindowColor(); + SetColor(aColor); + SetExtraSpacing(8); } void TableDesignWidget::updateControls() diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 0bce2d465715..eb03188bd87d 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -197,6 +197,8 @@ using namespace ::cppu; using namespace ::com::sun::star; using namespace ::sd; +namespace +{ const TranslateId aTypeResIds[SdLinkTargetType::Count] = { STR_SD_PAGE, // SdLinkTargetType::Page @@ -205,25 +207,34 @@ const TranslateId aTypeResIds[SdLinkTargetType::Count] = STR_MASTERPAGE_NAME, // SdLinkTargetType::MasterPage }; +const TranslateId aClickActionResIds[] = +{ + STR_CLICK_ACTION_NONE, // ClickAction_NONE + STR_CLICK_ACTION_PREVPAGE, // ClickAction_PREVPAGE + STR_CLICK_ACTION_NEXTPAGE, // ClickAction_NEXTPAGE + STR_CLICK_ACTION_FIRSTPAGE, // ClickAction_FIRSTPAGE + STR_CLICK_ACTION_LASTPAGE, // ClickAction_LASTPAGE + STR_CLICK_ACTION_BOOKMARK, // ClickAction_BOOKMARK + STR_CLICK_ACTION_DOCUMENT, // ClickAction_DOCUMENT + STR_CLICK_ACTION_INVISIBLE, // ClickAction_INVISIBLE + STR_CLICK_ACTION_SOUND, // ClickAction_SOUND + STR_CLICK_ACTION_VERB, // ClickAction_VERB + STR_CLICK_ACTION_VANISH, // ClickAction_VANISH + STR_CLICK_ACTION_PROGRAM, // ClickAction_PROGRAM + STR_CLICK_ACTION_MACRO, // ClickAction_MACRO + STR_CLICK_ACTION_STOPPRESENTATION, // ClickAction_STOPPRESENTATION +}; + +static_assert(SAL_N_ELEMENTS(aClickActionResIds) + == static_cast(presentation::ClickAction_STOPPRESENTATION) + 1, + "aClickActionResIds is missing an entry for a presentation::ClickAction value"); +} + TranslateId SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA ) { - switch( eCA ) - { - case presentation::ClickAction_NONE: return STR_CLICK_ACTION_NONE; - case presentation::ClickAction_PREVPAGE: return STR_CLICK_ACTION_PREVPAGE; - case presentation::ClickAction_NEXTPAGE: return STR_CLICK_ACTION_NEXTPAGE; - case presentation::ClickAction_FIRSTPAGE: return STR_CLICK_ACTION_FIRSTPAGE; - case presentation::ClickAction_LASTPAGE: return STR_CLICK_ACTION_LASTPAGE; - case presentation::ClickAction_BOOKMARK: return STR_CLICK_ACTION_BOOKMARK; - case presentation::ClickAction_DOCUMENT: return STR_CLICK_ACTION_DOCUMENT; - case presentation::ClickAction_PROGRAM: return STR_CLICK_ACTION_PROGRAM; - case presentation::ClickAction_MACRO: return STR_CLICK_ACTION_MACRO; - case presentation::ClickAction_SOUND: return STR_CLICK_ACTION_SOUND; - case presentation::ClickAction_VERB: return STR_CLICK_ACTION_VERB; - case presentation::ClickAction_STOPPRESENTATION: return STR_CLICK_ACTION_STOPPRESENTATION; - default: OSL_FAIL( "No StringResource for ClickAction available!" ); - } - return {}; + auto nIndex = static_cast(eCA); + assert(nIndex < SAL_N_ELEMENTS(aClickActionResIds) && "ClickAction out of range"); + return aClickActionResIds[nIndex]; } class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable, diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index a1408a486f0d..6b982c84735f 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -1751,7 +1751,7 @@ IMPL_LINK(OutlineView, PaintingFirstLineHdl, PaintFirstLineInfo*, pInfo, void) return; Paragraph* pPara = mrOutliner.GetParagraph( pInfo->mnPara ); - EditEngine& rEditEngine = const_cast< EditEngine& >( mrOutliner.GetEditEngine() ); + EditEngine& rEditEngine = mrOutliner.GetEditEngine(); Size aImageSize( pInfo->mpOutDev->PixelToLogic( maSlideImage.GetSizePixel() ) ); Size aOffset( 100, 100 ); diff --git a/sd/uiconfig/simpress/ui/layoutwindow.ui b/sd/uiconfig/simpress/ui/layoutwindow.ui index 108cf7c92b25..c8324a8bfd34 100644 --- a/sd/uiconfig/simpress/ui/layoutwindow.ui +++ b/sd/uiconfig/simpress/ui/layoutwindow.ui @@ -1,7 +1,27 @@ - + + + + + + + + + + + + + + + + + + + + + True False @@ -27,30 +47,16 @@ 0 none - + True True - 6 - True + 6 True - never - never - in - - - True - False - - - True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - True - True - - - - + iconview1_model + 4 + 0 + 2 + True @@ -79,30 +85,16 @@ 0 none - + True True - 6 - True + 6 True - never - never - in - - - True - False - - - True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - True - True - - - - + iconview2_model1 + 4 + 0 + 2 + True diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx index 1f8c96bbfe4a..c02066ea6f23 100644 --- a/sfx2/source/appl/appbaslib.cxx +++ b/sfx2/source/appl/appbaslib.cxx @@ -51,6 +51,11 @@ void SfxBasicManagerHolder::Notify(SfxBroadcaster& rBC, SfxHint const& rHint) void SfxBasicManagerHolder::reset( BasicManager* _pBasicManager ) { + // A document's Basic manager can be handed over a second time while it is still being + // created. The holder already listens to it and holds its containers, so it stays as it is. + if ( _pBasicManager == mpBasicManager ) + return; + impl_releaseContainers(); #if !HAVE_FEATURE_SCRIPTING diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 8baf9c72bba7..6b7863160e98 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -590,6 +590,9 @@ OUString SfxHelp::GetHelpText(const OUString& aCommandURL) // add some debug information? if ( bIsDebug ) { + if (sHelpText.isEmpty()) + sHelpText = vcl::CommandInfoProvider::GetTooltipLabelForCommand(aProperties); + sHelpText += "\n-------------\n" + sModuleName + ": " + aCommandURL; } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 706918d42384..8659ecbd0b10 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1742,6 +1742,11 @@ bool SfxObjectShell::AdjustMacroMode() return pImpl->aMacroMode.adjustMacroMode( xInteraction ); } +bool SfxObjectShell::IsMacroExecutionAllowed() const +{ + return pImpl->getCurrentMacroExecMode() == MacroExecMode::ALWAYS_EXECUTE_NO_WARN; +} + css::uno::Reference SfxObjectShell::GetDialogParent( SfxMedium const * pLoadingMedium ) { css::uno::Reference xWindow; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 1a95305b05c7..c3b988a14177 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -93,6 +94,8 @@ #include #include #include +#include +#include #include #include #include @@ -1230,6 +1233,22 @@ bool SfxObjectShell::IsPackageStorageFormat_Impl(const SfxMedium &rMedium) } +#if HAVE_FEATURE_SCRIPTING +namespace +{ +// A loaded library is stored through the document BasicManager, and an unloaded one is copied +// from the old storage. +bool lcl_isAnyLibraryLoaded( const uno::Reference< script::XStorageBasedLibraryContainer >& xContainer ) +{ + if ( !xContainer.is() ) + return false; + const uno::Sequence< OUString > aNames = xContainer->getElementNames(); + return std::any_of( aNames.begin(), aNames.end(), + [&xContainer]( const OUString& rName ) { return xContainer->isLibraryLoaded( rName ); } ); +} +} +#endif + bool SfxObjectShell::DoSave() // DoSave is only invoked for OLE. Save your own documents in the SFX through // DoSave_Impl order to allow for the creation of backups. @@ -1275,7 +1294,7 @@ bool SfxObjectShell::DoSave() bOk = true; } #if HAVE_FEATURE_SCRIPTING - if ( HasBasic() ) + if ( !pImpl->m_bNoBasicCapabilities ) { try { @@ -1294,16 +1313,21 @@ bool SfxObjectShell::DoSave() if ( GetMedium()->GetStorage()->hasByName( aDialogsStorageName ) ) GetMedium()->GetStorage()->copyElementTo( aDialogsStorageName, xTmpStorage, aDialogsStorageName ); - GetBasicManager(); - - // disconnect from the current storage - pImpl->aBasicManager.setStorage( xTmpStorage ); - - // store to the current storage - pImpl->aBasicManager.storeLibrariesToStorage( GetMedium()->GetStorage() ); - - // connect to the current storage back - pImpl->aBasicManager.setStorage( GetMedium()->GetStorage() ); + const uno::Reference< script::XStorageBasedLibraryContainer > aContainers[] + = { GetBasicContainer(), GetDialogContainer() }; + if ( lcl_isAnyLibraryLoaded( aContainers[0] ) ) + GetBasicManager(); + for ( const auto& xContainer : aContainers ) + { + if ( !xContainer.is() ) + continue; + // disconnect from the current storage + xContainer->setRootStorage( xTmpStorage ); + // store to the current storage + xContainer->storeLibrariesToStorage( GetMedium()->GetStorage() ); + // connect to the current storage back + xContainer->setRootStorage( GetMedium()->GetStorage() ); + } } catch( uno::Exception& ) { @@ -2576,6 +2600,12 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium, aArgs[u"InsertMode"_ustr] <<= true; aArgs[u"TextInsertModeRange"_ustr] <<= xInsertPosition; } + else + { + // Links stay un-updated during import, as when loading our own format, until + // UpdateLinks settles them. + GetEmbeddedObjectContainer().setUserAllowsLinkUpdate(false); + } // #i119492# During loading, some OLE objects like chart will be set // modified flag, so needs to reset the flag to false after loading @@ -2845,7 +2875,7 @@ bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs ) pSet->ClearItem( SID_VERSION ); pSet->ClearItem( SID_DOC_BASEURL ); - // copy the version comment and major items for the checkin only + // copy the version comment and major items for the check-in only if ( pRetrMedium->IsInCheckIn( ) ) { const SfxPoolItem* pMajor = pArgs->GetItem( SID_DOCINFO_MAJOR ); @@ -3473,13 +3503,17 @@ bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium ) SetupStorage( xStorage, nVersion, bTemplate ); #if HAVE_FEATURE_SCRIPTING - if ( HasBasic() ) + if ( !pImpl->m_bNoBasicCapabilities ) { - // Initialize Basic - GetBasicManager(); - // Save dialog/script container - pImpl->aBasicManager.storeLibrariesToStorage( xStorage ); + if ( uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries = GetBasicContainer() ) + { + if ( lcl_isAnyLibraryLoaded( xBasicLibraries ) ) + GetBasicManager(); + xBasicLibraries->storeLibrariesToStorage( xStorage ); + } + if ( uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries = GetDialogContainer() ) + xDialogLibraries->storeLibrariesToStorage( xStorage ); } #endif @@ -4063,15 +4097,20 @@ bool SfxObjectShell::QuerySaveSizeExceededModules_Impl( const uno::Reference< ta #if !HAVE_FEATURE_SCRIPTING (void) xHandler; #else - if ( !HasBasic() ) + if ( pImpl->m_bNoBasicCapabilities ) + return true; + + // Only a loaded password-protected library has modules to check, and one is loaded only + // through an existing BasicManager. + BasicManager* pBasicManager + = basic::BasicManagerRepository::getExistingDocumentBasicManager( GetModel() ); + if ( !pBasicManager ) return true; - if ( !pImpl->aBasicManager.isValid() ) - GetBasicManager(); std::vector< OUString > sModules; if ( xHandler.is() ) { - if( pImpl->aBasicManager.ImgVersion12PsswdBinaryLimitExceeded( sModules ) ) + if( pBasicManager->ImgVersion12PsswdBinaryLimitExceeded( sModules ) ) { rtl::Reference pReq = new ModuleSizeExceeded( sModules ); xHandler->handle( pReq ); diff --git a/shell/source/unix/misc/senddoc.sh b/shell/source/unix/misc/senddoc.sh index 65ade8426d1f..dd2ee8144d54 100755 --- a/shell/source/unix/misc/senddoc.sh +++ b/shell/source/unix/misc/senddoc.sh @@ -277,7 +277,11 @@ case $MAILER_TYPE in generic-mailto | xdg-email) - while [ "$1" != "" ]; do + # The loop shifts options off the front of "$@" while the mail client's arguments are + # appended to the back. The marker separates the two. + set -- "$@" "--end-of-arguments" + + while [ "$1" != "--end-of-arguments" ]; do case $1 in --to) if [ "${TO}" != "" ]; then @@ -309,7 +313,7 @@ case $MAILER_TYPE in MAILTO="${MAILTO:+${MAILTO}&}attach=${ATTACH_URL}&attachment=${ATTACH_URL}" if [ "$MAILER_TYPE" = "xdg-email" ]; then # Also add the argument: see https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/177 - ATTACH="${ATTACH:+${ATTACH} }--attach \"$2\"" + set -- "$@" --attach "$2" fi shift ;; @@ -318,9 +322,10 @@ case $MAILER_TYPE in esac shift; done + shift MAILTO="mailto:${TO}?${MAILTO}" - eval "${MAILER} ${ATTACH} \"${MAILTO}\"" & + ${MAILER} "$@" "${MAILTO}" & ;; dtmail) diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index 9a1dacbc5789..4a3ff84e2a89 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -84,6 +84,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \ compilerplugins/clang/test/simplifydynamiccast \ compilerplugins/clang/test/simplifypointertobool \ compilerplugins/clang/test/singlevalfields \ + compilerplugins/clang/test/smartpointerderefaddress \ compilerplugins/clang/test/staticconstexpr \ compilerplugins/clang/test/staticconstfield \ compilerplugins/clang/test/staticdynamic \ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 610f50f09120..f63a20146753 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -3163,8 +3163,9 @@ editeng/inc/editattr.hxx editeng/inc/editdoc.hxx editeng/inc/edtspell.hxx editeng/inc/eerdll2.hxx -editeng/inc/outleeng.hxx +editeng/inc/outlundo.hxx editeng/inc/unomodel.hxx +editeng/inc/paralist.hxx editeng/qa/items/borderline_test.cxx editeng/qa/lookuptree/lookuptree_test.cxx editeng/qa/unit/core-test.cxx @@ -3248,11 +3249,9 @@ editeng/source/outliner/outlin2.cxx editeng/source/outliner/outliner.cxx editeng/source/outliner/outlobj.cxx editeng/source/outliner/outlundo.cxx -editeng/source/outliner/outlundo.hxx editeng/source/outliner/outlvw.cxx editeng/source/outliner/overflowingtxt.cxx editeng/source/outliner/paralist.cxx -editeng/source/outliner/paralist.hxx editeng/source/rtf/rtfitem.cxx editeng/source/rtf/svxrtf.cxx editeng/source/uno/UnoForbiddenCharsTable.cxx @@ -5766,7 +5765,6 @@ include/svx/xdash.hxx include/svx/xdef.hxx include/svx/xenum.hxx include/svx/xfillit0.hxx -include/svx/xflasit.hxx include/svx/xflbckit.hxx include/svx/xflbmpit.hxx include/svx/xflbmsli.hxx @@ -5792,7 +5790,6 @@ include/svx/xhatch.hxx include/svx/xit.hxx include/svx/xlineit0.hxx include/svx/xlinjoit.hxx -include/svx/xlnasit.hxx include/svx/xlncapit.hxx include/svx/xlnclit.hxx include/svx/xlndsit.hxx @@ -11358,8 +11355,6 @@ svx/source/sidebar/graphic/GraphicPropertyPanel.hxx svx/source/sidebar/line/LinePropertyPanel.cxx svx/source/sidebar/line/LinePropertyPanel.hxx svx/source/sidebar/line/LinePropertyPanelBase.cxx -svx/source/sidebar/line/LineWidthValueSet.cxx -svx/source/sidebar/line/LineWidthValueSet.hxx svx/source/sidebar/media/MediaPlaybackPanel.cxx svx/source/sidebar/media/MediaPlaybackPanel.hxx svx/source/sidebar/nbdtmg.cxx diff --git a/solenv/gbuild/Jar.mk b/solenv/gbuild/Jar.mk index d69e784dbe36..be63820c21ea 100644 --- a/solenv/gbuild/Jar.mk +++ b/solenv/gbuild/Jar.mk @@ -19,7 +19,7 @@ # Jar class -gb_Jar_JARCOMMAND := jar $(if $(SOURCE_DATE_EPOCH),--date="$(shell date $(if $(filter $(OS),MACOSX),-r ,-d @)$(SOURCE_DATE_EPOCH) -u +'%FT%T+00:00')") +gb_Jar_JARCOMMAND := jar $(if $(SOURCE_DATE_EPOCH),--date="$(shell date $(if $(filter $(OS),DRAGONFLY FREEBSD MACOSX NETBSD OPENBSD),-r ,-d @)$(SOURCE_DATE_EPOCH) -u +'%FT%T+00:00')") gb_Jar_LAYER_DIRS := \ URE:$(INSTROOT)/$(LIBO_URE_SHARE_JAVA_FOLDER) \ diff --git a/solenv/sanitizers/ui/modules/scalc.suppr b/solenv/sanitizers/ui/modules/scalc.suppr index e8d96743e968..7e1e5efaf612 100644 --- a/solenv/sanitizers/ui/modules/scalc.suppr +++ b/solenv/sanitizers/ui/modules/scalc.suppr @@ -542,7 +542,7 @@ sc/uiconfig/scalc/ui/notebookbar.ui://GtkToolButton[@id='btnReviewRedactDoc'] bu sc/uiconfig/scalc/ui/notebookbar.ui://GtkToolButton[@id='btnReviewAcceptChanges'] button-no-label sc/uiconfig/scalc/ui/notebookbar.ui://GtkToolButton[@id='btnViewViewColumnRowHighlighting'] button-no-label sc/uiconfig/scalc/ui/notebookbar.ui://GtkToolButton[@id='btnViewViewHiddenColRow'] button-no-label -sc/uiconfig/scalc/ui/notebookbar.ui://GtkToolButton[@id='btnInsertFunctionBox1'] button-no-label +sc/uiconfig/scalc/ui/notebookbar.ui://GtkToolButton[@id='btnInsertDesignerDialog'] button-no-label sc/uiconfig/scalc/ui/notebookbar.ui://GtkToolButton[@id='btnViewViewValueHighlighting'] button-no-label sc/uiconfig/scalc/ui/notebookbar.ui://GtkToolButton[@id='btnViewToggleFormula'] button-no-label sc/uiconfig/scalc/ui/notebookbar.ui://GtkToolButton[@id='btnViewChangeTheme'] button-no-label diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx index a4d06eb55d5a..23f133c70e9b 100644 --- a/sot/source/sdstor/stgelem.cxx +++ b/sot/source/sdstor/stgelem.cxx @@ -193,9 +193,11 @@ static bool isKnownSpecial(sal_Int32 nLocation) // Perform thorough checks also on unknown variables bool StgHeader::Check() { + constexpr sal_Int16 SECTOR_SHIFT_V3 = 9; // 2^9 = 512 bytes per sector + constexpr sal_Int16 SECTOR_SHIFT_V4 = 12; // 2^12 = 4096 bytes per sector + short version = static_cast( m_nVersion >> 16 ); return memcmp( m_cSignature, cStgSignature, 8 ) == 0 - && static_cast( m_nVersion >> 16 ) == 3 - && m_nPageSize == 9 + && ((version == 3 && m_nPageSize == SECTOR_SHIFT_V3) || (version == 4 && m_nPageSize == SECTOR_SHIFT_V4)) && lcl_wontoverflow(m_nPageSize) && lcl_wontoverflow(m_nDataPageSize) && m_nFATSize > 0 diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index c73723a434d0..7e7f00442364 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -93,6 +93,8 @@ class SM_DLLPUBLIC SmDocShell final : public SfxObjectShell, public SfxListener sal_uInt16 mnModifyCount; bool mbFormulaArranged; sal_Int16 mnSmSyntaxVersion; + /// Font size in half points that the OOXML markup gave for the formula, 0 when it gave none. + sal_Int32 mnOoxmlFontSizeInHalfPoints = 0; std::unique_ptr maParser; std::unique_ptr mpCursor; std::set< OUString > maUsedSymbols; // to export used symbols only when saving @@ -215,6 +217,12 @@ public: const sal_Int8 nAlign); void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding); void readFormulaOoxml( oox::formulaimport::XmlStream& stream ); + /** The font size in half points that the OOXML markup gave for the formula, or 0 when the + markup carried no size of its own. */ + sal_Int32 GetOoxmlFontSizeInHalfPoints() const { return mnOoxmlFontSizeInHalfPoints; } + /** Draw the formula at the given size, in half points. The size becomes the base size and + the size of each of the fonts. A size of zero or less leaves the formula as it is. */ + void SetFontSizeInHalfPoints(sal_Int32 nFontSize); void UpdateEditEngineDefaultFonts(); diff --git a/starmath/inc/format.hxx b/starmath/inc/format.hxx index bcb052e6d4a9..d5f0cf189fdf 100644 --- a/starmath/inc/format.hxx +++ b/starmath/inc/format.hxx @@ -107,6 +107,8 @@ public: const Size & GetBaseSize() const { return aBaseSize; } void SetBaseSize(const Size &rSize) { aBaseSize = rSize; } + /// Sets the base size and gives each of the fonts that same size. + void SetBaseSizeAndFonts(const Size &rSize); const SmFace & GetFont(sal_uInt16 nIdent) const { return vFont[nIdent]; } void SetFont(sal_uInt16 nIdent, const SmFace &rFont, bool bDefault = false); diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 9c60ce96b288..90b4bd933ee3 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -183,6 +183,7 @@ public: * @return font attributes */ FontAttribute &Attributes() { return mnAttributes; } + const FontAttribute &Attributes() const { return mnAttributes; } /** * Checks if it is a visible node rendered invisible. @@ -462,10 +463,10 @@ private: }; -/** Abstract baseclass for all composite node +/** Abstract base class for all composite nodes * - * Subclasses of this class can have subnodes. Nodes that doesn't derivate from - * this class does not have subnodes. + * Subclasses of this class can have subnodes. Nodes that don't derive from + * this class do not have subnodes. */ class SmStructureNode : public SmNode { @@ -588,9 +589,9 @@ private: }; -/** Abstract base class for all visible node +/** Abstract base class for all visible nodes * - * Nodes that doesn't derivate from this class doesn't draw anything, but their + * Nodes that don't derive from this class don't draw anything, but their * children. */ class SmVisibleNode : public SmNode diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx index e2edbfa651a3..af5068d006b8 100644 --- a/starmath/inc/unomodel.hxx +++ b/starmath/inc/unomodel.hxx @@ -91,6 +91,8 @@ public: virtual void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding) override; virtual void readFormulaOoxml( oox::formulaimport::XmlStream& stream ) override; virtual Size getFormulaSize() const override; + virtual sal_Int32 getFormulaFontSizeInHalfPoints() const override; + virtual void setFormulaFontSizeInHalfPoints(sal_Int32 nFontSize) override; private: OUString msOldWindowState; // imported window state diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index a53081c75f0b..af018b914e19 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -521,7 +521,7 @@ void SmFontSizeDialog::ReadFrom(const SmFormat &rFormat) void SmFontSizeDialog::WriteTo(SmFormat &rFormat) const { - rFormat.SetBaseSize( Size(0, o3tl::convert(m_xBaseSize->get_value(FieldUnit::NONE), o3tl::Length::pt, SmO3tlLengthUnit())) ); + rFormat.SetBaseSizeAndFonts( Size(0, o3tl::convert(m_xBaseSize->get_value(FieldUnit::NONE), o3tl::Length::pt, SmO3tlLengthUnit())) ); rFormat.SetRelSize(SIZ_TEXT, sal::static_int_cast(m_xTextSize->get_value(FieldUnit::NONE))); rFormat.SetRelSize(SIZ_INDEX, sal::static_int_cast(m_xIndexSize->get_value(FieldUnit::NONE))); @@ -529,10 +529,6 @@ void SmFontSizeDialog::WriteTo(SmFormat &rFormat) const rFormat.SetRelSize(SIZ_OPERATOR, sal::static_int_cast(m_xOperatorSize->get_value(FieldUnit::NONE))); rFormat.SetRelSize(SIZ_LIMITS, sal::static_int_cast(m_xBorderSize->get_value(FieldUnit::NONE))); - const Size aTmp (rFormat.GetBaseSize()); - for (sal_uInt16 i = FNT_BEGIN; i <= FNT_END; i++) - rFormat.SetFontSize(i, aTmp); - rFormat.RequestApplyChanges(); } diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index fc7e0af42e19..f1b5b2fa4f21 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -835,7 +835,9 @@ void SmDocShell::writeFormulaOoxml( Parse(); if( mpTree ) ArrangeFormula(); - SmOoxmlExport aEquation(mpTree.get(), version, documentType); + SmOoxmlExport aEquation(mpTree.get(), version, documentType, + o3tl::convert(maFormat.GetBaseSize().Height() * 2, SmO3tlLengthUnit(), + o3tl::Length::pt)); if(documentType == oox::drawingml::DOCUMENT_DOCX) aEquation.ConvertFromStarMath( pSerializer, nAlign); else @@ -856,6 +858,19 @@ void SmDocShell::readFormulaOoxml( oox::formulaimport::XmlStream& stream ) { SmOoxmlImport aEquation( stream ); SetText( aEquation.ConvertToStarMath()); + mnOoxmlFontSizeInHalfPoints = aEquation.GetFontSizeInHalfPoints(); + SetFontSizeInHalfPoints(mnOoxmlFontSizeInHalfPoints); +} + +void SmDocShell::SetFontSizeInHalfPoints(sal_Int32 nFontSize) +{ + if (nFontSize <= 0) + return; + SmFormat aFormat(GetFormat()); + Size aSize(aFormat.GetBaseSize()); + aSize.setHeight(o3tl::convert(nFontSize, o3tl::Length::pt, SmO3tlLengthUnit()) / 2); + aFormat.SetBaseSizeAndFonts(aSize); + SetFormat(aFormat); } void SmDocShell::Execute(SfxRequest& rReq) diff --git a/starmath/source/format.cxx b/starmath/source/format.cxx index a5e7b76437b6..6a8d57a01e34 100644 --- a/starmath/source/format.cxx +++ b/starmath/source/format.cxx @@ -89,6 +89,13 @@ SmFormat::SmFormat() } +void SmFormat::SetBaseSizeAndFonts(const Size &rSize) +{ + SetBaseSize(rSize); + for (sal_uInt16 nFont = FNT_BEGIN; nFont <= FNT_END; ++nFont) + SetFontSize(nFont, rSize); +} + void SmFormat::SetFont(sal_uInt16 nIdent, const SmFace &rFont, bool bDefault ) { vFont[nIdent] = rFont; diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx index 878bd3dca654..bbb352c04958 100644 --- a/starmath/source/ooxmlexport.cxx +++ b/starmath/source/ooxmlexport.cxx @@ -15,15 +15,18 @@ #include #include #include +#include +#include using namespace oox; using namespace oox::core; SmOoxmlExport::SmOoxmlExport(const SmNode *const pIn, OoxmlVersion const v, - drawingml::DocumentType const documentType) + drawingml::DocumentType const documentType, sal_Int32 const nFontSizeInHalfPoints) : SmWordExportBase( pIn ) , version( v ) , m_DocumentType(documentType) +, m_nFontSizeInHalfPoints(nFontSizeInHalfPoints) { } @@ -82,31 +85,85 @@ void SmOoxmlExport::ConvertFromStarMath( const ::sax_fastparser::FSHelperPtr& se // part of the ooxml math stuff. // The w prefix is bound in a DOCX and nowhere else. A formula in a presentation or a -// spreadsheet goes out inside a slide or a sheet, which never declare it, so a color -// there would leave the prefix unbound. -bool SmOoxmlExport::HasOwnColor( const SmNode* pNode ) const +// spreadsheet goes out inside a slide or a sheet, which never declares it, so run +// properties there would leave the prefix unbound. +bool SmOoxmlExport::WritesRunProperties() const { - return drawingml::DOCUMENT_DOCX == m_DocumentType - && pNode->GetFont().GetColor() != COL_AUTO; + return drawingml::DOCUMENT_DOCX == m_DocumentType; +} + +// Only a color command around a node sets a color on it. +bool SmOoxmlExport::HasOwnColor( const SmNode* pNode ) +{ + return pNode->GetFont().GetColor() != COL_AUTO; +} + +// The size belongs on every run and on every control property of the formula, which is +// where the markup carries it. +void SmOoxmlExport::WriteFontSize() +{ + const OString sFontSize( OString::number( m_nFontSizeInHalfPoints )); + m_pSerializer->singleElementNS( XML_w, XML_sz, FSNS( XML_w, XML_val ), sFontSize ); + m_pSerializer->singleElementNS( XML_w, XML_szCs, FSNS( XML_w, XML_val ), sFontSize ); } // A construct such as a fraction or a pair of brackets draws part of itself, and the -// color of that part travels in the m:ctrlPr of the construct's property element. -void SmOoxmlExport::WriteCtrlPrColor( const SmNode* pNode ) +// format of that part travels in the m:ctrlPr of the construct's property element. +void SmOoxmlExport::WriteCtrlPr( const SmNode* pNode ) { - if( !HasOwnColor( pNode )) + if( !WritesRunProperties()) return; m_pSerializer->startElementNS( XML_m, XML_ctrlPr ); m_pSerializer->startElementNS( XML_w, XML_rPr ); - m_pSerializer->singleElementNS( XML_w, XML_color, FSNS( XML_w, XML_val ), - msfilter::util::ConvertColorOU( pNode->GetFont().GetColor())); + if( pNode->Attributes() & FontAttribute::Bold ) + m_pSerializer->singleElementNS( XML_w, XML_b ); + if( pNode->Attributes() & FontAttribute::Italic ) + m_pSerializer->singleElementNS( XML_w, XML_i ); + if( HasOwnColor( pNode )) + m_pSerializer->singleElementNS( XML_w, XML_color, FSNS( XML_w, XML_val ), + msfilter::util::ConvertColorOU( pNode->GetFont().GetColor())); + WriteFontSize(); m_pSerializer->endElementNS( XML_w, XML_rPr ); m_pSerializer->endElementNS( XML_m, XML_ctrlPr ); } +// A property element that a construct carries only to hold its control properties. +void SmOoxmlExport::WritePropertiesElement( sal_Int32 nElement, const SmNode* pNode ) +{ + if( !WritesRunProperties()) + return; + m_pSerializer->startElementNS( XML_m, nElement ); + WriteCtrlPr( pNode ); + m_pSerializer->endElementNS( XML_m, nElement ); +} + +static bool lcl_HasLetter( const OUString& rText ) +{ + for( sal_Int32 nIndex = 0; nIndex < rText.getLength(); ) + if( u_isalpha( rText.iterateCodePoints( &nIndex ))) + return true; + return false; +} + +// The m:sty that makes Word draw the run the way StarMath does. Without one Word draws +// letters italic and digits upright, as StarMath does. A function name is read back as +// upright unless it says otherwise. +static const char* lcl_GetOoxmlStyle( bool bBold, bool bItalic, const OUString& rText, + bool bFunctionName ) +{ + if( bBold ) + return bItalic ? "bi" : "b"; + if( bItalic ) + return bFunctionName ? "i" : nullptr; + if( lcl_HasLetter( rText )) + return "p"; + return nullptr; +} + void SmOoxmlExport::HandleVerticalStack( const SmNode* pNode, int nLevel ) { m_pSerializer->startElementNS(XML_m, XML_eqArr); + WritePropertiesElement( XML_eqArrPr, pNode ); int size = pNode->GetNumSubNodes(); for( int i = 0; i < size; @@ -123,35 +180,47 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/) { m_pSerializer->startElementNS(XML_m, XML_r); - if( pNode->GetToken().eType == TTEXT ) // literal text (in quotes) + const SmTextNode* pTemp = static_cast(pNode); + const bool bBold = IsBold( pNode->GetFont()); + const bool bItalic = IsItalic( pNode->GetFont()); + const bool bLiteral = pNode->GetToken().eType == TTEXT; + if( bLiteral ) // literal text (in quotes) { m_pSerializer->startElementNS(XML_m, XML_rPr); m_pSerializer->singleElementNS(XML_m, XML_lit); m_pSerializer->singleElementNS(XML_m, XML_nor); m_pSerializer->endElementNS( XML_m, XML_rPr ); } - const bool bWriteFont - = drawingml::DOCUMENT_DOCX == m_DocumentType && ECMA_376_1ST_EDITION == version; - // A surrounding color command has already reached this node. - const Color aColor = pNode->GetFont().GetColor(); - const bool bWriteColor - = drawingml::DOCUMENT_DOCX == m_DocumentType && aColor != COL_AUTO; - if( bWriteFont || bWriteColor ) + // m:nor and m:sty exclude each other, so normal text keeps its bold and italic in + // the w:rPr + else if( const char* pStyle = lcl_GetOoxmlStyle( bBold, bItalic, pTemp->GetText(), + pTemp->GetFontDesc() == FNT_FUNCTION )) + { + m_pSerializer->startElementNS(XML_m, XML_rPr); + m_pSerializer->singleElementNS(XML_m, XML_sty, FSNS(XML_m, XML_val), pStyle); + m_pSerializer->endElementNS( XML_m, XML_rPr ); + } + if( WritesRunProperties()) { m_pSerializer->startElementNS(XML_w, XML_rPr); - if( bWriteFont ) - // HACK: MSOffice2007 does not import characters properly unless this font is - // explicitly given + if( ECMA_376_1ST_EDITION == version ) + // Readers of the first OOXML edition get the characters wrong unless the font + // is named here. m_pSerializer->singleElementNS( XML_w, XML_rFonts, FSNS( XML_w, XML_ascii ), "Cambria Math", FSNS( XML_w, XML_hAnsi ), "Cambria Math" ); - if( bWriteColor ) + // A surrounding color, bold or italic command has already reached this node. + if( bLiteral && bBold ) + m_pSerializer->singleElementNS( XML_w, XML_b ); + if( bLiteral && bItalic ) + m_pSerializer->singleElementNS( XML_w, XML_i ); + if( HasOwnColor( pNode )) m_pSerializer->singleElementNS( XML_w, XML_color, FSNS( XML_w, XML_val ), - msfilter::util::ConvertColorOU( aColor )); + msfilter::util::ConvertColorOU( pNode->GetFont().GetColor())); + WriteFontSize(); m_pSerializer->endElementNS( XML_w, XML_rPr ); } m_pSerializer->startElementNS(XML_m, XML_t, FSNS(XML_xml, XML_space), "preserve"); - const SmTextNode* pTemp = static_cast(pNode); SAL_INFO( "starmath.ooxml", "Text:" << pTemp->GetText()); OUStringBuffer buf(pTemp->GetText()); for(sal_Int32 i=0;iGetText().getLength();i++) @@ -212,12 +281,12 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/) void SmOoxmlExport::HandleFractions( const SmNode* pNode, int nLevel, const char* type ) { m_pSerializer->startElementNS(XML_m, XML_f); - if( type != nullptr || HasOwnColor( pNode )) + if( type != nullptr || WritesRunProperties()) { m_pSerializer->startElementNS(XML_m, XML_fPr); if( type != nullptr ) m_pSerializer->singleElementNS(XML_m, XML_type, FSNS(XML_m, XML_val), type); - WriteCtrlPrColor( pNode ); + WriteCtrlPr( pNode ); m_pSerializer->endElementNS( XML_m, XML_fPr ); } assert( pNode->GetNumSubNodes() == 3 ); @@ -257,7 +326,7 @@ void SmOoxmlExport::HandleAttribute( const SmAttributeNode* pNode, int nLevel ) m_pSerializer->startElementNS(XML_m, XML_accPr); OString value = OUStringToOString(pNode->Attribute()->GetToken().cMathChar, RTL_TEXTENCODING_UTF8 ); m_pSerializer->singleElementNS(XML_m, XML_chr, FSNS(XML_m, XML_val), value); - WriteCtrlPrColor( pNode ); + WriteCtrlPr( pNode ); m_pSerializer->endElementNS( XML_m, XML_accPr ); m_pSerializer->startElementNS(XML_m, XML_e); HandleNode( pNode->Body(), nLevel + 1 ); @@ -271,7 +340,7 @@ void SmOoxmlExport::HandleAttribute( const SmAttributeNode* pNode, int nLevel ) m_pSerializer->startElementNS(XML_m, XML_barPr); m_pSerializer->singleElementNS( XML_m, XML_pos, FSNS( XML_m, XML_val ), ( pNode->Attribute()->GetToken().eType == TUNDERLINE ) ? "bot" : "top" ); - WriteCtrlPrColor( pNode ); + WriteCtrlPr( pNode ); m_pSerializer->endElementNS( XML_m, XML_barPr ); m_pSerializer->startElementNS(XML_m, XML_e); HandleNode( pNode->Body(), nLevel + 1 ); @@ -286,7 +355,7 @@ void SmOoxmlExport::HandleAttribute( const SmAttributeNode* pNode, int nLevel ) m_pSerializer->singleElementNS(XML_m, XML_hideLeft, FSNS(XML_m, XML_val), "1"); m_pSerializer->singleElementNS(XML_m, XML_hideRight, FSNS(XML_m, XML_val), "1"); m_pSerializer->singleElementNS(XML_m, XML_strikeH, FSNS(XML_m, XML_val), "1"); - WriteCtrlPrColor( pNode ); + WriteCtrlPr( pNode ); m_pSerializer->endElementNS( XML_m, XML_borderBoxPr ); m_pSerializer->startElementNS(XML_m, XML_e); HandleNode( pNode->Body(), nLevel + 1 ); @@ -301,27 +370,24 @@ void SmOoxmlExport::HandleAttribute( const SmAttributeNode* pNode, int nLevel ) void SmOoxmlExport::HandleRoot( const SmRootNode* pNode, int nLevel ) { + const SmNode* pArgument = pNode->Argument(); m_pSerializer->startElementNS(XML_m, XML_rad); - if( const SmNode* argument = pNode->Argument()) + if( pArgument == nullptr || WritesRunProperties()) + { + m_pSerializer->startElementNS(XML_m, XML_radPr); + if( pArgument == nullptr ) + m_pSerializer->singleElementNS(XML_m, XML_degHide, FSNS(XML_m, XML_val), "1"); + WriteCtrlPr( pNode ); + m_pSerializer->endElementNS( XML_m, XML_radPr ); + } + if( pArgument != nullptr ) { - if( HasOwnColor( pNode )) - { - m_pSerializer->startElementNS(XML_m, XML_radPr); - WriteCtrlPrColor( pNode ); - m_pSerializer->endElementNS( XML_m, XML_radPr ); - } m_pSerializer->startElementNS(XML_m, XML_deg); - HandleNode( argument, nLevel + 1 ); + HandleNode( pArgument, nLevel + 1 ); m_pSerializer->endElementNS( XML_m, XML_deg ); } else - { - m_pSerializer->startElementNS(XML_m, XML_radPr); - m_pSerializer->singleElementNS(XML_m, XML_degHide, FSNS(XML_m, XML_val), "1"); - WriteCtrlPrColor( pNode ); - m_pSerializer->endElementNS( XML_m, XML_radPr ); m_pSerializer->singleElementNS(XML_m, XML_deg); // empty but present - } m_pSerializer->startElementNS(XML_m, XML_e); HandleNode( pNode->Body(), nLevel + 1 ); m_pSerializer->endElementNS( XML_m, XML_e ); @@ -364,7 +430,7 @@ void SmOoxmlExport::HandleOperator( const SmOperNode* pNode, int nLevel ) m_pSerializer->singleElementNS(XML_m, XML_subHide, FSNS(XML_m, XML_val), "1"); if( subsup == nullptr || subsup->GetSubSup( CSUP ) == nullptr ) m_pSerializer->singleElementNS(XML_m, XML_supHide, FSNS(XML_m, XML_val), "1"); - WriteCtrlPrColor( pNode ); + WriteCtrlPr( pNode ); m_pSerializer->endElementNS( XML_m, XML_naryPr ); if( subsup == nullptr || subsup->GetSubSup( CSUB ) == nullptr ) m_pSerializer->singleElementNS(XML_m, XML_sub); @@ -390,8 +456,10 @@ void SmOoxmlExport::HandleOperator( const SmOperNode* pNode, int nLevel ) } case TLIM: m_pSerializer->startElementNS(XML_m, XML_func); + WritePropertiesElement( XML_funcPr, pNode ); m_pSerializer->startElementNS(XML_m, XML_fName); m_pSerializer->startElementNS(XML_m, XML_limLow); + WritePropertiesElement( XML_limLowPr, pNode ); m_pSerializer->startElementNS(XML_m, XML_e); HandleNode( pNode->GetSymbol(), nLevel + 1 ); m_pSerializer->endElementNS( XML_m, XML_e ); @@ -426,6 +494,7 @@ void SmOoxmlExport::HandleSubSupScriptInternal( const SmSubSupNode* pNode, int n if(( flags & ( 1 << RSUP | 1 << RSUB )) == ( 1 << RSUP | 1 << RSUB )) { // m:sSubSup m_pSerializer->startElementNS(XML_m, XML_sSubSup); + WritePropertiesElement( XML_sSubSupPr, pNode ); m_pSerializer->startElementNS(XML_m, XML_e); flags &= ~( 1 << RSUP | 1 << RSUB ); if( flags == 0 ) @@ -444,6 +513,7 @@ void SmOoxmlExport::HandleSubSupScriptInternal( const SmSubSupNode* pNode, int n else if(( flags & ( 1 << RSUB )) == 1 << RSUB ) { // m:sSub m_pSerializer->startElementNS(XML_m, XML_sSub); + WritePropertiesElement( XML_sSubPr, pNode ); m_pSerializer->startElementNS(XML_m, XML_e); flags &= ~( 1 << RSUB ); if( flags == 0 ) @@ -459,6 +529,7 @@ void SmOoxmlExport::HandleSubSupScriptInternal( const SmSubSupNode* pNode, int n else if(( flags & ( 1 << RSUP )) == 1 << RSUP ) { // m:sSup m_pSerializer->startElementNS(XML_m, XML_sSup); + WritePropertiesElement( XML_sSupPr, pNode ); m_pSerializer->startElementNS(XML_m, XML_e); flags &= ~( 1 << RSUP ); if( flags == 0 ) @@ -474,6 +545,7 @@ void SmOoxmlExport::HandleSubSupScriptInternal( const SmSubSupNode* pNode, int n else if(( flags & ( 1 << LSUP | 1 << LSUB )) == ( 1 << LSUP | 1 << LSUB )) { // m:sPre m_pSerializer->startElementNS(XML_m, XML_sPre); + WritePropertiesElement( XML_sPrePr, pNode ); m_pSerializer->startElementNS(XML_m, XML_sub); HandleNode( pNode->GetSubSup( LSUB ), nLevel + 1 ); m_pSerializer->endElementNS( XML_m, XML_sub ); @@ -492,6 +564,7 @@ void SmOoxmlExport::HandleSubSupScriptInternal( const SmSubSupNode* pNode, int n else if(( flags & ( 1 << CSUB )) == ( 1 << CSUB )) { // m:limLow looks like a good element for central superscript m_pSerializer->startElementNS(XML_m, XML_limLow); + WritePropertiesElement( XML_limLowPr, pNode ); m_pSerializer->startElementNS(XML_m, XML_e); flags &= ~( 1 << CSUB ); if( flags == 0 ) @@ -507,6 +580,7 @@ void SmOoxmlExport::HandleSubSupScriptInternal( const SmSubSupNode* pNode, int n else if(( flags & ( 1 << CSUP )) == ( 1 << CSUP )) { // m:limUpp looks like a good element for central superscript m_pSerializer->startElementNS(XML_m, XML_limUpp); + WritePropertiesElement( XML_limUppPr, pNode ); m_pSerializer->startElementNS(XML_m, XML_e); flags &= ~( 1 << CSUP ); if( flags == 0 ) @@ -530,6 +604,7 @@ void SmOoxmlExport::HandleSubSupScriptInternal( const SmSubSupNode* pNode, int n void SmOoxmlExport::HandleMatrix( const SmMatrixNode* pNode, int nLevel ) { m_pSerializer->startElementNS(XML_m, XML_m); + WritePropertiesElement( XML_mPr, pNode ); for (size_t row = 0; row < pNode->GetNumRows(); ++row) { m_pSerializer->startElementNS(XML_m, XML_mr); @@ -588,7 +663,7 @@ void SmOoxmlExport::HandleBrace( const SmBraceNode* pNode, int nLevel ) m_pSerializer->singleElementNS( XML_m, XML_endChr, FSNS( XML_m, XML_val ), mathSymbolToString(pNode->ClosingBrace()) ); - WriteCtrlPrColor( pNode ); + WriteCtrlPr( pNode ); m_pSerializer->endElementNS( XML_m, XML_dPr ); if (subnodes.empty()) { @@ -617,6 +692,7 @@ void SmOoxmlExport::HandleVerticalBrace( const SmVerticalBraceNode* pNode, int n { bool top = ( pNode->GetToken().eType == TOVERBRACE ); m_pSerializer->startElementNS(XML_m, top ? XML_limUpp : XML_limLow); + WritePropertiesElement( top ? XML_limUppPr : XML_limLowPr, pNode ); m_pSerializer->startElementNS(XML_m, XML_e); m_pSerializer->startElementNS(XML_m, XML_groupChr); m_pSerializer->startElementNS(XML_m, XML_groupChrPr); @@ -627,7 +703,7 @@ void SmOoxmlExport::HandleVerticalBrace( const SmVerticalBraceNode* pNode, int n FSNS( XML_m, XML_val ), top ? "top" : "bot" ); m_pSerializer->singleElementNS(XML_m, XML_vertJc, FSNS(XML_m, XML_val), top ? "bot" : "top"); - WriteCtrlPrColor( pNode ); + WriteCtrlPr( pNode ); m_pSerializer->endElementNS( XML_m, XML_groupChrPr ); m_pSerializer->startElementNS(XML_m, XML_e); HandleNode( pNode->Body(), nLevel + 1 ); @@ -650,6 +726,13 @@ void SmOoxmlExport::HandleVerticalBrace( const SmVerticalBraceNode* pNode, int n void SmOoxmlExport::HandleBlank() { m_pSerializer->startElementNS(XML_m, XML_r); + // A blank draws no glyph, so the size is all it carries. + if( WritesRunProperties()) + { + m_pSerializer->startElementNS( XML_w, XML_rPr ); + WriteFontSize(); + m_pSerializer->endElementNS( XML_w, XML_rPr ); + } m_pSerializer->startElementNS(XML_m, XML_t, FSNS(XML_xml, XML_space), "preserve"); m_pSerializer->write( " " ); m_pSerializer->endElementNS( XML_m, XML_t ); diff --git a/starmath/source/ooxmlexport.hxx b/starmath/source/ooxmlexport.hxx index 2d0b182e1b99..a8209f58fc65 100644 --- a/starmath/source/ooxmlexport.hxx +++ b/starmath/source/ooxmlexport.hxx @@ -22,7 +22,7 @@ class SmOoxmlExport : public SmWordExportBase { public: SmOoxmlExport(const SmNode* pIn, oox::core::OoxmlVersion version, - oox::drawingml::DocumentType documentType); + oox::drawingml::DocumentType documentType, sal_Int32 nFontSizeInHalfPoints); void ConvertFromStarMath(const ::sax_fastparser::FSHelperPtr& m_pSerializer, const sal_Int8); private: @@ -37,15 +37,23 @@ private: void HandleBrace(const SmBraceNode* pNode, int nLevel) override; void HandleVerticalBrace(const SmVerticalBraceNode* pNode, int nLevel) override; void HandleBlank() override; - /// Writes the m:ctrlPr carrying the color of the parts a construct draws itself. - void WriteCtrlPrColor(const SmNode* pNode); - /// True when the color of the node is written out, which needs a color other than - /// the default and a DOCX. - bool HasOwnColor(const SmNode* pNode) const; + /// True when the run properties are written out, which needs a DOCX. + bool WritesRunProperties() const; + /// True when the node has a color of its own rather than the default one. + static bool HasOwnColor(const SmNode* pNode); + /// Writes the w:sz and w:szCs carrying the size the formula is drawn at. + void WriteFontSize(); + /// Writes the m:ctrlPr carrying the size, color, bold and italic of the parts a + /// construct draws itself. + void WriteCtrlPr(const SmNode* pNode); + /// Writes a property element that a construct carries only to hold its control properties. + void WritePropertiesElement(sal_Int32 nElement, const SmNode* pNode); ::sax_fastparser::FSHelperPtr m_pSerializer; oox::core::OoxmlVersion version; /// needed to determine markup for nested run properties oox::drawingml::DocumentType const m_DocumentType; + /// The size the formula is drawn at, in half points. + sal_Int32 const m_nFontSizeInHalfPoints; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index 4a294c7450e2..b33e9bedf720 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -9,6 +9,7 @@ #include +#include #include #include "ooxmlimport.hxx" @@ -23,6 +24,7 @@ #include #include #include +#include #include #include @@ -71,18 +73,58 @@ static OUString lcl_ApplyColorCommand( const OUString& rText, std::u16string_vie // A run holds whatever text the document put in it, which need not be an expression. A // run of operators is written as a literal, because that is an expression and it keeps -// the color. Anything else that does not parse keeps the color off, so that the formula -// reads as it did before the color was carried over at all. -static OUString lcl_ApplyRunColorCommand( SmParser5& rParser, const OUString& rText, - std::u16string_view sColorCommand, std::u16string_view sInEffect ) +// the command. Anything else that does not parse keeps the command off, so that the +// formula reads as it did before the command was carried over at all. +static OUString lcl_ApplyRunCommand( SmParser5& rParser, const OUString& rText, + std::u16string_view sCommand, std::u16string_view sInEffect ) { - if( sColorCommand.empty() || sColorCommand == sInEffect || rText.isEmpty()) + if( sCommand.empty() || sCommand == sInEffect || rText.isEmpty()) return rText; if( lcl_IsAllMathOperators( rText )) - return OUString::Concat( sColorCommand ) + " {\"" + rText + "\"}"; + return OUString::Concat( sCommand ) + " {\"" + rText + "\"}"; if( !lcl_ParsesAsExpression( rParser, rText )) return rText; - return OUString::Concat( sColorCommand ) + " {" + rText + "}"; + return OUString::Concat( sCommand ) + " {" + rText + "}"; +} + +static bool lcl_HasLetter( const OUString& rText ) +{ + for( sal_Int32 nIndex = 0; nIndex < rText.getLength(); ) + if( u_isalpha( rText.iterateCodePoints( &nIndex ))) + return true; + return false; +} + +static bool lcl_IsFunctionName( std::u16string_view sText ) +{ + const SmTokenTableEntry* pEntry = GetTokenTableEntry( OUString( o3tl::trim( sText ))); + return pEntry != nullptr && ( pEntry->nGroup & TG::Function ); +} + +// An m:sty value is p, b, i or bi, and italic when there is none. Word and StarMath both +// draw letters italic and a function name upright by default, so only a difference from +// that needs a command. A digit stays upright whatever the style says, because the +// Unicode math alphanumerics have no italic digits. +static OUString lcl_FontCommandFromOoxmlStyle( std::u16string_view sStyle, bool bHasLetter, + bool bFunctionName ) +{ + if( bFunctionName ) + { + if( sStyle == u"bi" ) + return u"bold ital"_ustr; + if( sStyle == u"b" ) + return u"bold"_ustr; + if( sStyle == u"i" ) + return u"ital"_ustr; + return OUString(); + } + if( sStyle == u"bi" ) + return u"bold"_ustr; + if( sStyle == u"b" ) + return bHasLetter ? u"bold nitalic"_ustr : u"bold"_ustr; + if( sStyle == u"p" && bHasLetter ) + return u"nitalic"_ustr; + return OUString(); } namespace @@ -160,6 +202,22 @@ OUString SmOoxmlImport::ConvertToStarMath() return handleStream(); } +sal_Int32 SmOoxmlImport::GetFontSizeInHalfPoints() const +{ + // A formula is drawn at a single size, and the runs of a formula that names a size all + // carry it. Where they differ, the largest one is the size of the body: a smaller one + // belongs to a part the author shrank, such as a limit or a script. A value that is not + // a positive number of half points counts as no size at all, and so does a formula whose + // runs name none, which then takes the size of the text around it. + sal_Int32 nFontSize = 0; + for( const OUString& rValue : m_rStream.tagAttributesWithin( + M_TOKEN( r ), W_TOKEN( sz ), W_TOKEN( val ))) + { + nFontSize = std::max( nFontSize, rValue.toInt32()); + } + return nFontSize; +} + // "toplevel" of reading, there will be oMath (if there was oMathPara, that was // up to the parent component to handle) @@ -562,7 +620,19 @@ OUString SmOoxmlImport::handleFunc() { //lim from{x rightarrow 1} x m_rStream.ensureOpeningTag( M_TOKEN( func )); + OUString sNameStyle; + if( m_rStream.checkOpeningTag( M_TOKEN( funcPr ))) + { + sNameStyle = readCtrlPrStyle(); + m_rStream.ensureClosingTag( M_TOKEN( funcPr )); + } + const bool bWasInFunctionName = m_bInFunctionName; + const OUString sPreviousNameStyle = m_sFunctionNameStyle; + m_bInFunctionName = true; + m_sFunctionNameStyle = sNameStyle; OUString fname = readOMathArgInElement( M_TOKEN( fName )); + m_bInFunctionName = bWasInFunctionName; + m_sFunctionNameStyle = sPreviousNameStyle; // fix the various functions if( fname.startsWith( "lim csub {" )) fname = OUString::Concat("lim from {") + fname.subView( 10 ); @@ -743,6 +813,33 @@ OUString SmOoxmlImport::readCtrlPrColorCommand() return sRet; } +OUString SmOoxmlImport::readCtrlPrStyle() +{ + bool bBold = false; + bool bItalic = false; + if( m_rStream.checkOpeningTag( M_TOKEN( ctrlPr ))) + { + if( m_rStream.checkOpeningTag( W_TOKEN( rPr ))) + { + if( XmlStream::Tag aBoldTag = m_rStream.checkOpeningTag( W_TOKEN( b ))) + { + bBold = aBoldTag.attribute( W_TOKEN( val ), true ); + m_rStream.ensureClosingTag( W_TOKEN( b )); + } + if( XmlStream::Tag aItalicTag = m_rStream.checkOpeningTag( W_TOKEN( i ))) + { + bItalic = aItalicTag.attribute( W_TOKEN( val ), true ); + m_rStream.ensureClosingTag( W_TOKEN( i )); + } + m_rStream.ensureClosingTag( W_TOKEN( rPr )); + } + m_rStream.ensureClosingTag( M_TOKEN( ctrlPr )); + } + if( bBold ) + return bItalic ? u"bi"_ustr : u"b"_ustr; + return bItalic ? u"i"_ustr : OUString(); +} + // NOT complete OUString SmOoxmlImport::handleR() { @@ -750,7 +847,10 @@ OUString SmOoxmlImport::handleR() bool normal = false; bool literal = false; OUString scrString; + OUString styString; OUString sColorCommand; + bool bTextBold = false; + bool bTextItalic = false; if( XmlStream::Tag rPr = m_rStream.checkOpeningTag( M_TOKEN( rPr ))) { if( XmlStream::Tag litTag = m_rStream.checkOpeningTag( M_TOKEN( lit ))) @@ -768,8 +868,17 @@ OUString SmOoxmlImport::handleR() scrString = srcTag.attribute( M_TOKEN( val ), scrString ); m_rStream.ensureClosingTag( M_TOKEN( scr )); } + if( XmlStream::Tag styTag = m_rStream.checkOpeningTag( M_TOKEN( sty ))) + { + styString = styTag.attribute( M_TOKEN( val ), styString ); + m_rStream.ensureClosingTag( M_TOKEN( sty )); + } m_rStream.ensureClosingTag( M_TOKEN( rPr )); } + // Word keeps the style of a whole function name in the m:ctrlPr of the function, + // and a run of the name with a style of its own overrides it + if( m_bInFunctionName && styString.isEmpty()) + styString = m_sFunctionNameStyle; OUStringBuffer text; bool isTagT = false; while( !m_rStream.atEnd() && m_rStream.currentToken() != CLOSING( m_rStream.currentToken())) @@ -777,10 +886,21 @@ OUString SmOoxmlImport::handleR() switch( m_rStream.currentToken()) { // A run has two property elements. The math one m:rPr is read above. - // This is the text one w:rPr and it holds the font color. + // This is the text one w:rPr and it holds the font color, and the bold + // and italic of a normal text run. case OPENING( W_TOKEN( rPr )): { m_rStream.ensureOpeningTag( W_TOKEN( rPr )); + if( XmlStream::Tag aBoldTag = m_rStream.checkOpeningTag( W_TOKEN( b ))) + { + bTextBold = aBoldTag.attribute( W_TOKEN( val ), true ); + m_rStream.ensureClosingTag( W_TOKEN( b )); + } + if( XmlStream::Tag aItalicTag = m_rStream.checkOpeningTag( W_TOKEN( i ))) + { + bTextItalic = aItalicTag.attribute( W_TOKEN( val ), true ); + m_rStream.ensureClosingTag( W_TOKEN( i )); + } if( XmlStream::Tag aColorTag = m_rStream.checkOpeningTag( W_TOKEN( color ))) { sColorCommand @@ -811,12 +931,28 @@ OUString SmOoxmlImport::handleR() } } m_rStream.ensureClosingTag( M_TOKEN( r )); + const OUString sText = text.makeStringAndClear(); + OUString sFontCommand; + if( normal ) + { + if( bTextBold ) + sFontCommand = u"bold"_ustr; + if( bTextItalic ) + sFontCommand += sFontCommand.isEmpty() ? u"ital"_ustr : u" ital"_ustr; + } + else + sFontCommand = lcl_FontCommandFromOoxmlStyle( styString, lcl_HasLetter( sText ), + m_bInFunctionName || lcl_IsFunctionName( sText )); + // Bold or italic shows nothing on a run of spaces + if( o3tl::trim( sText ).empty()) + sFontCommand.clear(); OUString sRet; if (scrString.isEmpty() && (normal || literal || isTagT)) - sRet = encloseOrEscapeLiteral(text.makeStringAndClear(), normal || literal); + sRet = encloseOrEscapeLiteral(sText, normal || literal); else - sRet = text.makeStringAndClear(); - return lcl_ApplyRunColorCommand( getParser(), sRet, sColorCommand, m_sColorCommandInEffect ); + sRet = sText; + sRet = lcl_ApplyRunCommand( getParser(), sRet, sFontCommand, std::u16string_view()); + return lcl_ApplyRunCommand( getParser(), sRet, sColorCommand, m_sColorCommandInEffect ); } OUString SmOoxmlImport::handleSetString(const OUString& setOUstring) diff --git a/starmath/source/ooxmlimport.hxx b/starmath/source/ooxmlimport.hxx index 9c1e64ab5391..a3fe8c6f1828 100644 --- a/starmath/source/ooxmlimport.hxx +++ b/starmath/source/ooxmlimport.hxx @@ -10,6 +10,7 @@ #pragma once #include +#include #include @@ -25,6 +26,9 @@ public: explicit SmOoxmlImport( oox::formulaimport::XmlStream& stream ); ~SmOoxmlImport(); OUString ConvertToStarMath(); + /** The font size the markup gives for the formula, in half points, or 0 when the markup + carries no size of its own and the formula takes the size of the text around it. */ + sal_Int32 GetFontSizeInHalfPoints() const; private: /// The parser that tells whether a run's text stands as an expression of its own. SmParser5& getParser(); @@ -49,6 +53,7 @@ private: OUString handleSsubsup(); OUString handleSsup(); OUString readCtrlPrColorCommand(); + OUString readCtrlPrStyle(); OUString readOMathArg( int stoptoken ); OUString readOMathArgInElement( int token ); static OUString handleSetString(const OUString& setOUstring); @@ -57,6 +62,9 @@ private: // The color command that applies to the part of the formula being read now, or // an empty string for the default color. OUString m_sColorCommandInEffect; + // Set while the name of a function is read + bool m_bInFunctionName = false; + OUString m_sFunctionNameStyle; // Built on first use, because constructing one creates a character classification // service, and most formulas never need it. std::unique_ptr m_pParser; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 5693a73ec172..2097566a4fe8 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -480,12 +480,12 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* throw IllegalArgumentException(); Size aSize = aFormat.GetBaseSize(); aSize.setHeight(o3tl::convert(nVal, o3tl::Length::pt, SmO3tlLengthUnit())); - aFormat.SetBaseSize(aSize); + aFormat.SetBaseSizeAndFonts(aSize); - // apply base size to fonts - const Size aTmp( aFormat.GetBaseSize() ); - for (sal_uInt16 i = FNT_BEGIN; i <= FNT_END; i++) - maFonts[i].SetSize(aTmp); + // A font that this same call names is merged in below, from a copy that + // needs the new size too. + for (sal_uInt16 nFont = FNT_BEGIN; nFont <= FNT_END; nFont++) + maFonts[nFont].SetSize(aSize); } break; case HANDLE_RELATIVE_FONT_HEIGHT_TEXT : @@ -1112,6 +1112,16 @@ void SmModel::readFormulaOoxml( oox::formulaimport::XmlStream& stream ) GetSmDocShell()->readFormulaOoxml(stream); } +sal_Int32 SmModel::getFormulaFontSizeInHalfPoints() const +{ + return GetSmDocShell()->GetOoxmlFontSizeInHalfPoints(); +} + +void SmModel::setFormulaFontSizeInHalfPoints( sal_Int32 nFontSize ) +{ + GetSmDocShell()->SetFontSizeInHalfPoints(nFontSize); +} + Size SmModel::getFormulaSize() const { return o3tl::convert(GetSmDocShell()->GetSize(), SmO3tlLengthUnit(), o3tl::Length::mm100); diff --git a/store/source/storbase.cxx b/store/source/storbase.cxx index 013862e681d3..c0b67835d0a3 100644 --- a/store/source/storbase.cxx +++ b/store/source/storbase.cxx @@ -110,7 +110,7 @@ storeError PageData::Allocator::createInstance (rtl::Reference< PageData::Allocator > & rxAllocator, sal_uInt16 nPageSize) { rtl::Reference< PageData::Allocator_Impl > xAllocator (new PageData::Allocator_Impl()); - rxAllocator = &*xAllocator; + rxAllocator = xAllocator.get(); return xAllocator->initialize (nPageSize); } diff --git a/store/source/store.cxx b/store/source/store.cxx index 24439a4e2a81..8bf5de2a875f 100644 --- a/store/source/store.cxx +++ b/store/source/store.cxx @@ -105,7 +105,7 @@ storeError store_createMemoryFile ( Reference xManager (new OStorePageManager()); eErrCode = xManager->initialize ( - &*xLockBytes, storeAccessMode::Create, nPageSize); + xLockBytes.get(), storeAccessMode::Create, nPageSize); if (eErrCode != store_E_None) return eErrCode; @@ -137,7 +137,7 @@ storeError store_openFile ( Reference xManager (new OStorePageManager()); eErrCode = xManager->initialize ( - &*xLockBytes, eAccessMode, nPageSize); + xLockBytes.get(), eAccessMode, nPageSize); if (eErrCode != store_E_None) return eErrCode; @@ -201,7 +201,7 @@ storeError store_openDirectory ( OString aPath (pPath->buffer, pPath->length, RTL_TEXTENCODING_UTF8); OString aName (pName->buffer, pName->length, RTL_TEXTENCODING_UTF8); - eErrCode = xDirectory->create (&*xManager, aPath.pData, aName.pData, eAccessMode); + eErrCode = xDirectory->create (xManager.get(), aPath.pData, aName.pData, eAccessMode); if (eErrCode != store_E_None) return eErrCode; @@ -279,7 +279,7 @@ storeError store_openStream ( OString aPath (pPath->buffer, pPath->length, RTL_TEXTENCODING_UTF8); OString aName (pName->buffer, pName->length, RTL_TEXTENCODING_UTF8); - eErrCode = xLockBytes->create (&*xManager, aPath.pData, aName.pData, eAccessMode); + eErrCode = xLockBytes->create (xManager.get(), aPath.pData, aName.pData, eAccessMode); if (eErrCode != store_E_None) return eErrCode; diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index b2a8ad0e6f24..6798bcbdeed5 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -218,6 +218,7 @@ SfxItemSet::SfxItemSet(SfxItemPool& rPool) , m_nRegister(0) #ifdef DBG_UTIL , m_nRegisteredSfxItemIter(0) +, m_bDeleted(false) #endif , m_aWhichRanges(rPool.GetMergedIdRanges()) , m_aPoolItemMap() @@ -235,6 +236,7 @@ SfxItemSet::SfxItemSet(SfxItemPool& pool, WhichRangesContainer wids) , m_nRegister(0) #ifdef DBG_UTIL , m_nRegisteredSfxItemIter(0) +, m_bDeleted(false) #endif , m_aWhichRanges(std::move(wids)) , m_aPoolItemMap() @@ -253,6 +255,7 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet ) , m_nRegister( 0 ) #ifdef DBG_UTIL , m_nRegisteredSfxItemIter(0) +, m_bDeleted(false) #endif , m_aWhichRanges( rASet.m_aWhichRanges ) , m_aPoolItemMap() @@ -281,6 +284,7 @@ SfxItemSet::SfxItemSet(SfxItemSet&& rASet) noexcept , m_nRegister( rASet.m_nRegister ) #ifdef DBG_UTIL , m_nRegisteredSfxItemIter(0) +, m_bDeleted(false) #endif , m_aWhichRanges( std::move(rASet.m_aWhichRanges) ) , m_aPoolItemMap( std::move(rASet.m_aPoolItemMap) ) @@ -319,6 +323,9 @@ SfxItemSet::~SfxItemSet() // for invariant-testing m_aWhichRanges.reset(); +#ifdef DBG_UTIL + m_bDeleted = true; +#endif } diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 1749eb0f4759..2762c38f51b3 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -226,6 +226,8 @@ bool SfxStyleSheetBase::SetParent( const OUString& rName ) void SfxStyleSheetBase::SetHidden( bool hidden ) { + if (bHidden == hidden) + return; bHidden = hidden; m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *this ) ); } @@ -248,8 +250,8 @@ bool SfxStyleSheetBase::SetFollow( const OUString& rName ) return false; } aFollow = rName; + m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *this ) ); } - m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *this ) ); return true; } diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index c818c6f9bc53..7663f61ca3b1 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -533,8 +533,8 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry, int nMod) { COL_BLACK, COL_BLACK }, // FONTCOLOR { COL_BLUE, Color(0x1D99F3) }, // LINKS { Color(0x0000cc), Color(0x9B59B6) }, // LINKSVISITED - { COL_LIGHTRED, Color(0xC9211E) }, // SPELL - { COL_LIGHTBLUE, Color(0x729FCF) }, // GRAMMAR + { Color(0xf10d0c), Color(0xf10d0c) }, // SPELL (Dark Red 1) + { Color(0x3465a4), Color(0x3465a4) }, // GRAMMAR (Dark Blue 1) { COL_LIGHTMAGENTA, Color(0x780373) }, // SMARTTAGS { COL_GRAY, Color(0x1C1C1C) }, // SHADOWCOLOR { COL_GRAY7, COL_GRAY7 }, // WRITERTEXTGRID diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 19a468d1ae25..2c52e094f940 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -466,19 +466,19 @@ void FontNameBox::SaveMRUEntries(const OUString& aFontMRUEntriesFile) const aStream.WriteLine( "" ); } -void FontNameBox::LoadMRUEntries( const OUString& aFontMRUEntriesFile ) +std::vector FontNameBox::LoadMRUEntries(const OUString& aFontMRUEntriesFile) { if (aFontMRUEntriesFile.isEmpty()) - return; + return {}; if (!officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::get()) - return; + return {}; SvFileStream aStream( aFontMRUEntriesFile, StreamMode::READ ); if( ! aStream.IsOpen() ) { SAL_INFO("svtools.control", "FontNameBox::LoadMRUEntries: opening mru entries file " << aFontMRUEntriesFile << " failed"); - return; + return {}; } OStringBuffer aLine; @@ -494,7 +494,7 @@ void FontNameBox::LoadMRUEntries( const OUString& aFontMRUEntriesFile ) aFontEntries.push_back(sEntry); } - m_xComboBox->set_mru_entries(aFontEntries); + return aFontEntries; } void FontNameBox::InitFontMRUEntriesFile() @@ -520,8 +520,8 @@ void FontNameBox::Fill( const FontList* pList ) { // store old text and clear box OUString aOldText = m_xComboBox->get_active_text(); - std::vector rEntries = m_xComboBox->get_mru_entries(); - bool bLoadFromFile = rEntries.empty(); + std::vector aEntries = m_xComboBox->get_mru_entries(); + bool bLoadFromFile = aEntries.empty(); m_xComboBox->freeze(); m_xComboBox->clear(); @@ -538,9 +538,9 @@ void FontNameBox::Fill( const FontList* pList ) } if (bLoadFromFile) - LoadMRUEntries(maFontMRUEntriesFile); - else - m_xComboBox->set_mru_entries(rEntries); + aEntries = LoadMRUEntries(maFontMRUEntriesFile); + + m_xComboBox->set_mru_entries(aEntries); m_xComboBox->thaw(); diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 1399762f7493..b1c3d0e6d112 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -779,18 +779,6 @@ sal_uInt16 TabBar::ImplGetLastFirstPos() return nLastFirstPos; } -IMPL_LINK(TabBar, ContextMenuHdl, const CommandEvent&, rCommandEvent, void) -{ - maScrollAreaContextHdl.Call(rCommandEvent); -} - -IMPL_LINK(TabBar, MousePressHdl, const MouseEvent&, rMouseEvent, bool) -{ - if (rMouseEvent.IsRight()) - ContextMenuHdl(CommandEvent(rMouseEvent.GetPosPixel(), CommandEventId::ContextMenu, true)); - return false; -} - IMPL_LINK_NOARG( TabBar, ImplListClickHandler, weld::Button&, void ) { maScrollAreaContextHdl.Call( CommandEvent( Point( 0, 0 ), CommandEventId::ContextMenu, true ) ); @@ -813,9 +801,6 @@ void TabBar::ImplInitControls() mpImpl->mxButtonBox.disposeAndReset(VclPtr::Create(this, mbSheets)); - Link aContextLink = LINK( this, TabBar, ContextMenuHdl ); - Link aBtnContextLink = LINK(this, TabBar, MousePressHdl); - if (mnWinStyle & WB_INSERTTAB) { Link aLink = LINK(this, TabBar, ImplAddClickHandler); @@ -825,7 +810,6 @@ void TabBar::ImplInitControls() aLink = LINK( this, TabBar, ImplListClickHandler ); mpImpl->mxButtonBox->m_xListButton->connect_clicked( aLink ); - mpImpl->mxButtonBox->m_xListButton->connect_mouse_press( aBtnContextLink ); mpImpl->mxButtonBox->m_xListButton->show(); } @@ -834,20 +818,18 @@ void TabBar::ImplInitControls() if (mnWinStyle & (WB_MINSCROLL | WB_SCROLL)) { mpImpl->mxButtonBox->m_xPrevRepeater = std::make_shared( - *mpImpl->mxButtonBox->m_xPrevButton, aLink, aContextLink); + *mpImpl->mxButtonBox->m_xPrevButton, aLink ); mpImpl->mxButtonBox->m_xPrevButton->show(); mpImpl->mxButtonBox->m_xNextRepeater = std::make_shared( - *mpImpl->mxButtonBox->m_xNextButton, aLink, aContextLink); + *mpImpl->mxButtonBox->m_xNextButton, aLink ); mpImpl->mxButtonBox->m_xNextButton->show(); } if (mnWinStyle & WB_SCROLL) { mpImpl->mxButtonBox->m_xFirstButton->connect_clicked(aLink); - mpImpl->mxButtonBox->m_xFirstButton->connect_mouse_press(aBtnContextLink); mpImpl->mxButtonBox->m_xFirstButton->show(); mpImpl->mxButtonBox->m_xLastButton->connect_clicked(aLink); - mpImpl->mxButtonBox->m_xLastButton->connect_mouse_press(aBtnContextLink); mpImpl->mxButtonBox->m_xLastButton->show(); } diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 399887e17c19..710cd4248c7c 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -37,7 +37,6 @@ using namespace ::com::sun::star; ValueSetItem::ValueSetItem( ValueSet& rParent ) : mrParent(rParent) - , mpData(nullptr) , mxAcc() , mnId(0) , meType(ValueSetItemType::None) diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx index 293c94e86f32..e0104d69ad77 100644 --- a/svtools/source/control/valueimp.hxx +++ b/svtools/source/control/valueimp.hxx @@ -32,7 +32,6 @@ enum class ValueSetItemType { None, Image, - ImageAndText, Color, UserDraw }; @@ -44,7 +43,6 @@ struct ValueSetItem { ValueSet& mrParent; OUString maText; - void* mpData; rtl::Reference< ValueItemAcc > mxAcc; Image maImage; Color maColor; diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 60cfc1fe2246..c20a50492346 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -85,7 +85,6 @@ ValueSet::ValueSet(std::unique_ptr pScrolledWindow) { mnItemWidth = 0; mnItemHeight = 0; - mnTextOffset = 0; mnVisLines = 0; mnLines = 0; mnUserItemWidth = 0; @@ -628,36 +627,13 @@ void ValueSet::ImplHighlightItem(sal_uInt16 nItemId) void ValueSet::ImplDraw(vcl::RenderContext& rRenderContext) { if (mbFormat) - Format(rRenderContext); + Format(); Point aDefPos; Size aSize = maVirDev->GetOutputSizePixel(); rRenderContext.DrawOutDev(aDefPos, aSize, aDefPos, aSize, *maVirDev); - // draw parting line to the Namefield - if (GetStyle() & WB_NAMEFIELD) - { - if (!(GetStyle() & WB_FLATVALUESET)) - { - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - Size aWinSize(GetOutputSizePixel()); - Point aPos1(NAME_LINE_OFF_X, mnTextOffset + NAME_LINE_OFF_Y); - Point aPos2(aWinSize.Width() - (NAME_LINE_OFF_X * 2), mnTextOffset + NAME_LINE_OFF_Y); - if (!(rStyleSettings.GetOptions() & StyleSettingsOptions::Mono)) - { - rRenderContext.SetLineColor(rStyleSettings.GetShadowColor()); - rRenderContext.DrawLine(aPos1, aPos2); - aPos1.AdjustY( 1 ); - aPos2.AdjustY( 1 ); - rRenderContext.SetLineColor(rStyleSettings.GetLightColor()); - } - else - rRenderContext.SetLineColor(rStyleSettings.GetWindowTextColor()); - rRenderContext.DrawLine(aPos1, aPos2); - } - } - ImplDrawSelect(rRenderContext); } @@ -692,9 +668,9 @@ void ValueSet::SelectItem( sal_uInt16 nItemId ) bool bNewOut = !mbFormat && IsReallyVisible(); bool bNewLine = false; - if (weld::DrawingArea* pNeedsFormatToScroll = !mnCols ? GetDrawingArea() : nullptr) + if (!mnCols && GetDrawingArea()) { - Format(pNeedsFormatToScroll->get_ref_device()); + Format(); // reset scrollbar so it's set to the later calculated mnFirstLine on // the next Format RecalcScrollBar(); @@ -798,12 +774,11 @@ void ValueSet::SetStyle(WinBits nStyle) } } -void ValueSet::Format(vcl::RenderContext const & rRenderContext) +void ValueSet::Format() { Size aWinSize(GetOutputSizePixel()); size_t nItemCount = mItemList.size(); WinBits nStyle = GetStyle(); - tools::Long nTxtHeight = rRenderContext.GetTextHeight(); if (mxScrolledWindow && !(nStyle & WB_VSCROLL) && mxScrolledWindow->get_vpolicy() != VclPolicyType::NEVER) TurnOffScrollBar(); @@ -814,23 +789,6 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) aWinSize.AdjustHeight(-mnMargin * 2); } - // consider size, if NameField does exist - if (nStyle & WB_NAMEFIELD) - { - mnTextOffset = aWinSize.Height() - nTxtHeight - NAME_OFFSET; - aWinSize.AdjustHeight( -(nTxtHeight + NAME_OFFSET) ); - - if (!(nStyle & WB_FLATVALUESET)) - { - mnTextOffset -= NAME_LINE_HEIGHT + NAME_LINE_OFF_Y; - aWinSize.AdjustHeight( -(NAME_LINE_HEIGHT + NAME_LINE_OFF_Y) ); - } - } - else - mnTextOffset = 0; - - mnTextOffset += mnMargin; - // calculate number of columns if (!mnUserCols) { @@ -1014,7 +972,7 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) } pItem->mbVisible = true; - ImplFormatItem(rRenderContext, *pItem, + ImplFormatItem(*pItem, tools::Rectangle(Point(x, y), Size(mnItemWidth, mnItemHeight))); if (!((i + 1) % mnCols)) @@ -1079,7 +1037,7 @@ void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext) if (pSelectedItem) { const bool bHover = pSelectedItem == pHighlightItem; - ImplDrawSelect(rRenderContext, aSelectedRect, pSelectedItem, bFocus, !mbNoSelection, true, bHover); + ImplDrawSelect(rRenderContext, aSelectedRect, bFocus, !mbNoSelection, true, bHover); } if (pHighlightItem && (pSelectedItem != pHighlightItem || mbNoSelection)) { @@ -1097,7 +1055,7 @@ void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext) else bDrawFocus = pSelectedItem == pHighlightItem && mbNoSelection; - ImplDrawSelect(rRenderContext, aHoverRect, pHighlightItem, bDrawFocus, mbHighlight, false, true); + ImplDrawSelect(rRenderContext, aHoverRect, bDrawFocus, mbHighlight, false, true); } } @@ -1117,10 +1075,9 @@ ValueSetItem* ValueSet::ImplGetDrawSelectItem(sal_uInt16 nItemId, const bool bFo return pItem; } -void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext, - const tools::Rectangle& rRect, const ValueSetItem* pItem, - const bool bFocus, const bool bDrawSel, - const bool bSelected, const bool bHover) +void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, + const bool bFocus, const bool bDrawSel, const bool bSelected, + const bool bHover) { tools::Rectangle aRect(rRect); @@ -1259,12 +1216,9 @@ void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext, if (bFocus) InvertFocusRect(rRenderContext, aFocusRect); } - - ImplDrawItemText(rRenderContext, pItem->maText); } -void ValueSet::ImplFormatItem(vcl::RenderContext const& rRenderContext, ValueSetItem& rItem, - tools::Rectangle aRect) +void ValueSet::ImplFormatItem(ValueSetItem& rItem, tools::Rectangle aRect) { WinBits nStyle = GetStyle(); if (nStyle & WB_ITEMBORDER) @@ -1323,9 +1277,7 @@ void ValueSet::ImplFormatItem(vcl::RenderContext const& rRenderContext, ValueSet Size aRectSize = aRect.GetSize(); Point aPos(aRect.Left(), aRect.Top()); aPos.AdjustX((aRectSize.Width() - aImageSize.Width()) / 2 ); - - if (rItem.meType != ValueSetItemType::ImageAndText) - aPos.AdjustY((aRectSize.Height() - aImageSize.Height()) / 2 ); + aPos.AdjustY((aRectSize.Height() - aImageSize.Height()) / 2); DrawImageFlags nImageStyle = DrawImageFlags::NONE; if (!IsEnabled()) @@ -1340,25 +1292,6 @@ void ValueSet::ImplFormatItem(vcl::RenderContext const& rRenderContext, ValueSet } else maVirDev->DrawImage(aPos, rItem.maImage, nImageStyle); - - if (rItem.meType == ValueSetItemType::ImageAndText) - { - maVirDev->SetFont(rRenderContext.GetFont()); - maVirDev->SetTextColor((nStyle & WB_MENUSTYLEVALUESET) ? rStyleSettings.GetMenuTextColor() : rStyleSettings.GetWindowTextColor()); - maVirDev->SetTextFillColor(); - - tools::Long nTxtWidth = maVirDev->GetTextWidth(rItem.maText); - - if (nTxtWidth > aRect.GetWidth()) - maVirDev->SetClipRegion(vcl::Region(aRect)); - - maVirDev->DrawText(Point(aRect.Left() + (aRect.GetWidth() - nTxtWidth) / 2, - aRect.Bottom() - maVirDev->GetTextHeight()), - rItem.maText); - - if (nTxtWidth > aRect.GetWidth()) - maVirDev->SetClipRegion(); - } } } @@ -1378,29 +1311,6 @@ void ValueSet::ImplFormatItem(vcl::RenderContext const& rRenderContext, ValueSet } } -void ValueSet::ImplDrawItemText(vcl::RenderContext& rRenderContext, const OUString& rText) -{ - if (!(GetStyle() & WB_NAMEFIELD)) - return; - - Size aWinSize(GetOutputSizePixel()); - tools::Long nTxtWidth = rRenderContext.GetTextWidth(rText); - tools::Long nTxtOffset = mnTextOffset; - - auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::TEXTCOLOR); - - // delete rectangle and show text - const bool bFlat(GetStyle() & WB_FLATVALUESET); - if (!bFlat) - nTxtOffset += NAME_LINE_HEIGHT+NAME_LINE_OFF_Y; - - rRenderContext.SetTextColor(Application::GetSettings().GetStyleSettings().GetButtonTextColor()); - // tdf#153787 highlighted entry text is drawn in the same Paint as the selected text, so can - // overwrite already rendered text - rRenderContext.Erase(tools::Rectangle(Point(0, nTxtOffset), Point(aWinSize.Width(), aWinSize.Height()))); - rRenderContext.DrawText(Point((aWinSize.Width() - nTxtWidth) / 2, nTxtOffset + (NAME_OFFSET / 2)), rText); -} - void ValueSet::StyleUpdated() { mbFormat = true; @@ -1421,26 +1331,6 @@ void ValueSet::SetColCount( sal_uInt16 nNewCols ) } } -void ValueSet::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) -{ - size_t nPos = GetItemPos( nItemId ); - - if ( nPos == VALUESET_ITEM_NOTFOUND ) - return; - - ValueSetItem* pItem = mItemList[nPos].get(); - pItem->meType = ValueSetItemType::Image; - pItem->maImage = rImage; - - if (!mbFormat && IsReallyVisible()) - { - const tools::Rectangle aRect = ImplGetItemRect(nPos); - Invalidate(aRect); - } - else - mbFormat = true; -} - void ValueSet::SetItemColor( sal_uInt16 nItemId, const Color& rColor ) { size_t nPos = GetItemPos( nItemId ); @@ -1505,11 +1395,10 @@ Size ValueSet::CalcWindowSizePixel( const Size& rItemSize, sal_uInt16 nDesireCol Size aSize( rItemSize.Width() * nCalcCols, rItemSize.Height() * nCalcLines ); WinBits nStyle = GetStyle(); - tools::Long nTxtHeight = GetTextHeight(); - tools::Long n; if ( nStyle & WB_ITEMBORDER ) { + tools::Long n; if ( nStyle & WB_DOUBLEBORDER ) n = ITEM_OFFSET_DOUBLE; else @@ -1518,8 +1407,6 @@ Size ValueSet::CalcWindowSizePixel( const Size& rItemSize, sal_uInt16 nDesireCol aSize.AdjustWidth(n * nCalcCols ); aSize.AdjustHeight(n * nCalcLines ); } - else - n = 0; if ( mnSpacing ) { @@ -1527,13 +1414,6 @@ Size ValueSet::CalcWindowSizePixel( const Size& rItemSize, sal_uInt16 nDesireCol aSize.AdjustHeight(mnSpacing * (nCalcLines - 1) ); } - if ( nStyle & WB_NAMEFIELD ) - { - aSize.AdjustHeight(nTxtHeight + NAME_OFFSET ); - if ( !(nStyle & WB_FLATVALUESET) ) - aSize.AdjustHeight(NAME_LINE_HEIGHT + NAME_LINE_OFF_Y ); - } - if ( mnMargin ) { aSize.AdjustWidth(mnMargin * 2); @@ -1553,12 +1433,11 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage ) } void ValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage, - const OUString& rText, size_t nPos, - bool bShowLegend ) + const OUString& rText, size_t nPos) { std::unique_ptr pItem(new ValueSetItem( *this )); pItem->mnId = nItemId; - pItem->meType = bShowLegend ? ValueSetItemType::ImageAndText : ValueSetItemType::Image; + pItem->meType = ValueSetItemType::Image; pItem->maImage = rImage; pItem->maText = rText; ImplInsertItem( std::move(pItem), nPos ); @@ -1723,38 +1602,6 @@ void ValueSet::SetFormat() mbFormat = true; } -void ValueSet::SetItemData( sal_uInt16 nItemId, void* pData ) -{ - size_t nPos = GetItemPos( nItemId ); - - if ( nPos == VALUESET_ITEM_NOTFOUND ) - return; - - ValueSetItem* pItem = mItemList[nPos].get(); - pItem->mpData = pData; - - if (pItem->meType == ValueSetItemType::UserDraw) - { - if (!mbFormat && IsReallyVisible()) - { - const tools::Rectangle aRect = ImplGetItemRect(nPos); - Invalidate(aRect); - } - else - mbFormat = true; - } -} - -void* ValueSet::GetItemData( sal_uInt16 nItemId ) const -{ - size_t nPos = GetItemPos( nItemId ); - - if ( nPos != VALUESET_ITEM_NOTFOUND ) - return mItemList[nPos]->mpData; - else - return nullptr; -} - void ValueSet::SetItemText(sal_uInt16 nItemId, const OUString& rText) { size_t nPos = GetItemPos( nItemId ); @@ -1801,22 +1648,13 @@ Size ValueSet::GetLargestItemSize() if (!pItem->mbVisible) continue; - if (pItem->meType != ValueSetItemType::Image && - pItem->meType != ValueSetItemType::ImageAndText) + if (pItem->meType != ValueSetItemType::Image) { // handle determining an optimal size for this case continue; } Size aSize = pItem->maImage.GetSizePixel(); - if (pItem->meType == ValueSetItemType::ImageAndText) - { - aSize.AdjustHeight(3 * NAME_LINE_HEIGHT + - maVirDev->GetTextHeight() ); - aSize.setWidth( std::max(aSize.Width(), - maVirDev->GetTextWidth(pItem->maText) + NAME_OFFSET) ); - } - aLargestItem.setWidth( std::max(aLargestItem.Width(), aSize.Width()) ); aLargestItem.setHeight( std::max(aLargestItem.Height(), aSize.Height()) ); } diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index a9aff82c5eec..3fa0eb484410 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -244,7 +244,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/sidebar/graphic/GraphicPropertyPanel \ svx/source/sidebar/line/LinePropertyPanel \ svx/source/sidebar/line/LinePropertyPanelBase \ - svx/source/sidebar/line/LineWidthValueSet \ svx/source/sidebar/line/LineWidthPopup \ $(call gb_Helper_optional,AVMEDIA,svx/source/sidebar/media/MediaPlaybackPanel) \ svx/source/sidebar/possize/PosSizePropertyPanel \ diff --git a/svx/Module_svx.mk b/svx/Module_svx.mk index 089e9a919d57..e6528fa00add 100644 --- a/svx/Module_svx.mk +++ b/svx/Module_svx.mk @@ -70,6 +70,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,svx,\ )) $(eval $(call gb_Module_add_uicheck_targets,svx,\ + UITest_svx_form \ UITest_svx_table \ )) diff --git a/codemaker/PythonTest_codemaker_python.mk b/svx/UITest_svx_form.mk similarity index 56% rename from codemaker/PythonTest_codemaker_python.mk rename to svx/UITest_svx_form.mk index be453aa5eedf..18e473824e36 100644 --- a/codemaker/PythonTest_codemaker_python.mk +++ b/svx/UITest_svx_form.mk @@ -7,11 +7,10 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -$(eval $(call gb_PythonTest_PythonTest,codemaker_python)) -$(eval $(call gb_PythonTest_add_modules,codemaker_python,$(SRCDIR)/codemaker/tests/pythonmaker,\ - test_pythonmaker \ +$(eval $(call gb_UITest_UITest,svx_form)) + +$(eval $(call gb_UITest_add_modules,svx_form,$(SRCDIR)/svx/qa/uitest,\ + form/ \ )) -$(call gb_PythonTest_get_target,codemaker_python): $(call gb_Executable_get_target,pythonmaker) - # vim: set noet sw=4 ts=4: diff --git a/svx/inc/bitmaps.hlst b/svx/inc/bitmaps.hlst index 178b22c0419e..aa73670c5771 100644 --- a/svx/inc/bitmaps.hlst +++ b/svx/inc/bitmaps.hlst @@ -126,7 +126,6 @@ inline constexpr OUString RID_SVXBMP_GALLERY_SOUND_7 = u"svx/res/galsnd7.png"_us inline constexpr OUString BMP_NONE_ICON = u"svx/res/symphony/blank.png"_ustr; inline constexpr OUString RID_SVXBMP_WIDTH_CUSTOM = u"svx/res/symphony/last_custom_common.png"_ustr; -inline constexpr OUString RID_SVXBMP_WIDTH_CUSTOM_GRAY = u"svx/res/symphony/last_custom_common_grey.png"_ustr; inline constexpr OUString BMP_AXIAL = u"svx/res/symphony/axial.png"_ustr; inline constexpr OUString BMP_ELLI = u"svx/res/symphony/ellipsoid.png"_ustr; diff --git a/svx/inc/extrud3d.hxx b/svx/inc/extrud3d.hxx index cd6c2e00972b..3d0f40413619 100644 --- a/svx/inc/extrud3d.hxx +++ b/svx/inc/extrud3d.hxx @@ -37,7 +37,6 @@ class E3dDefaultAttributes; class SAL_WARN_UNUSED E3dExtrudeObj final : public E3dCompoundObject { -private: // to allow sdr::properties::E3dExtrudeProperties access to SetGeometryValid() friend class sdr::properties::E3dExtrudeProperties; @@ -48,10 +47,11 @@ private: virtual std::unique_ptr CreateObjectSpecificProperties() override; void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); -private: // protected destructor - due to final, make private virtual ~E3dExtrudeObj() override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SVXCORE_DLLPUBLIC E3dExtrudeObj( SdrModel& rSdrModel, @@ -95,8 +95,6 @@ public: virtual SdrObjKind GetObjIdentifier() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - // TakeObjName...() is for the display in the UI (for example "3 frames selected") virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; diff --git a/svx/inc/polygn3d.hxx b/svx/inc/polygn3d.hxx index 1a9a645b9faa..5c2236dd6610 100644 --- a/svx/inc/polygn3d.hxx +++ b/svx/inc/polygn3d.hxx @@ -39,6 +39,8 @@ class E3dPolygonObj final : public E3dCompoundObject // protected destructor virtual ~E3dPolygonObj() override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: void SetPolyPolygon3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); void SetPolyNormals3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); @@ -57,8 +59,6 @@ public: virtual rtl::Reference DoConvertToPolyObj(bool bBezier, bool bAddText) const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - // LineOnly? bool GetLineOnly() const { return bLineOnly; } void SetLineOnly(bool bNew); diff --git a/svx/inc/sdgclitm.hxx b/svx/inc/sdgclitm.hxx index ca7d16aae271..67153b49eec7 100644 --- a/svx/inc/sdgclitm.hxx +++ b/svx/inc/sdgclitm.hxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/svx/inc/sdr/properties/attributeproperties.hxx b/svx/inc/sdr/properties/attributeproperties.hxx index adc303de00a6..93cad9e3b395 100644 --- a/svx/inc/sdr/properties/attributeproperties.hxx +++ b/svx/inc/sdr/properties/attributeproperties.hxx @@ -29,6 +29,12 @@ namespace sdr::properties { class AttributeProperties : public DefaultProperties, public SfxListener, public svl::StyleSheetUser { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + + // Regulates Styles/Items between models + virtual void postProcessAfterCloneToDifferentModel(const SdrObject& rSrcObj) override; + // core to set parent at SfxItemSet and to execute the hard attribute computations void ImpSetParentAtSfxItemSet(bool bDontRemoveHardAttr); @@ -58,9 +64,6 @@ namespace sdr::properties AttributeProperties(const AttributeProperties& rProps, SdrObject& rObj); public: - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // Get the local ItemSet. This directly returns the local ItemSet of the object. No // merging of ItemSets is done for e.g. Group objects. virtual const SfxItemSet& GetObjectItemSet() const override final; diff --git a/svx/inc/sdr/properties/captionproperties.hxx b/svx/inc/sdr/properties/captionproperties.hxx index 20d2e3b0636f..647914e82394 100644 --- a/svx/inc/sdr/properties/captionproperties.hxx +++ b/svx/inc/sdr/properties/captionproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class CaptionProperties final : public RectangleProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // create a new itemset virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; @@ -43,9 +46,6 @@ namespace sdr::properties // destructor virtual ~CaptionProperties() override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // set a new StyleSheet and broadcast virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast, bool bAdjustTextFrameWidthAndHeight = true) override; diff --git a/svx/inc/sdr/properties/cellproperties.hxx b/svx/inc/sdr/properties/cellproperties.hxx index ba023b9059be..7ed3a857d79a 100644 --- a/svx/inc/sdr/properties/cellproperties.hxx +++ b/svx/inc/sdr/properties/cellproperties.hxx @@ -61,7 +61,7 @@ public: ~CellProperties(); // Clone() operator, normally just calls the local copy constructor - std::unique_ptr Clone(SdrObject& rObj) const override; + std::unique_ptr implCloneProperties(SdrObject& rObj) const override; void ForceDefaultAttributes() override; diff --git a/svx/inc/sdr/properties/circleproperties.hxx b/svx/inc/sdr/properties/circleproperties.hxx index bb70bc814ae6..8f920fd89f40 100644 --- a/svx/inc/sdr/properties/circleproperties.hxx +++ b/svx/inc/sdr/properties/circleproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class CircleProperties final : public RectangleProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // create a new itemset virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; @@ -43,9 +46,6 @@ namespace sdr::properties // destructor virtual ~CircleProperties() override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // set a new StyleSheet and broadcast virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast, bool bAdjustTextFrameWidthAndHeight = true) override; diff --git a/svx/inc/sdr/properties/connectorproperties.hxx b/svx/inc/sdr/properties/connectorproperties.hxx index b0d66de6544d..bc4dd3e75df3 100644 --- a/svx/inc/sdr/properties/connectorproperties.hxx +++ b/svx/inc/sdr/properties/connectorproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class ConnectorProperties final : public TextProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // create a new itemset virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; @@ -43,9 +46,6 @@ namespace sdr::properties // destructor virtual ~ConnectorProperties() override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // set a new StyleSheet and broadcast virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast, bool bAdjustTextFrameWidthAndHeight = true) override; diff --git a/svx/inc/sdr/properties/customshapeproperties.hxx b/svx/inc/sdr/properties/customshapeproperties.hxx index 4f7e60f3cd43..7b54f2efbee0 100644 --- a/svx/inc/sdr/properties/customshapeproperties.hxx +++ b/svx/inc/sdr/properties/customshapeproperties.hxx @@ -27,7 +27,9 @@ namespace sdr::properties { class CustomShapeProperties final : public TextProperties { - private: + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + void UpdateTextFrameStatus(bool bInvalidateRenderGeometry); // create a new itemset @@ -72,9 +74,6 @@ namespace sdr::properties // destructor virtual ~CustomShapeProperties() override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // This is the notifier from SfxListener virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; }; diff --git a/svx/inc/sdr/properties/e3dcompoundproperties.hxx b/svx/inc/sdr/properties/e3dcompoundproperties.hxx index 6dc9afd4d356..c4232eeba378 100644 --- a/svx/inc/sdr/properties/e3dcompoundproperties.hxx +++ b/svx/inc/sdr/properties/e3dcompoundproperties.hxx @@ -27,7 +27,10 @@ namespace sdr::properties { class E3dCompoundProperties : public E3dProperties { - protected: + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + + protected: // Called after ItemChange() is done for all items. virtual void PostItemChange(const sal_uInt16 nWhich) override; @@ -41,9 +44,6 @@ namespace sdr::properties // destructor virtual ~E3dCompoundProperties() override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // Get merged ItemSet. Normally, this maps directly to GetObjectItemSet(), but may // be overridden e.g for group objects to return a merged ItemSet of the object. // When using this method the returned ItemSet may contain items in the state diff --git a/svx/inc/sdr/properties/e3dextrudeproperties.hxx b/svx/inc/sdr/properties/e3dextrudeproperties.hxx index 072b1c796919..e1be2fe05be4 100644 --- a/svx/inc/sdr/properties/e3dextrudeproperties.hxx +++ b/svx/inc/sdr/properties/e3dextrudeproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class E3dExtrudeProperties final : public E3dCompoundProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // Called after ItemChange() is done for all items. virtual void PostItemChange(const sal_uInt16 nWhich) override; @@ -39,9 +42,6 @@ namespace sdr::properties // destructor virtual ~E3dExtrudeProperties() override; - - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; }; } // end of namespace sdr::properties diff --git a/svx/inc/sdr/properties/e3dlatheproperties.hxx b/svx/inc/sdr/properties/e3dlatheproperties.hxx index 56e46fb8b578..a2e18968121b 100644 --- a/svx/inc/sdr/properties/e3dlatheproperties.hxx +++ b/svx/inc/sdr/properties/e3dlatheproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class E3dLatheProperties final : public E3dCompoundProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // Called after ItemChange() is done for all items. virtual void PostItemChange(const sal_uInt16 nWhich) override; @@ -39,9 +42,6 @@ namespace sdr::properties // destructor virtual ~E3dLatheProperties() override; - - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; }; } // end of namespace sdr::properties diff --git a/svx/inc/sdr/properties/e3dproperties.hxx b/svx/inc/sdr/properties/e3dproperties.hxx index 4e93d5887cd9..b8cca761b595 100644 --- a/svx/inc/sdr/properties/e3dproperties.hxx +++ b/svx/inc/sdr/properties/e3dproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class E3dProperties : public AttributeProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + protected: // create a new itemset virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; @@ -43,9 +46,6 @@ namespace sdr::properties // destructor virtual ~E3dProperties() override; - - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; }; } // end of namespace sdr::properties diff --git a/svx/inc/sdr/properties/e3dsceneproperties.hxx b/svx/inc/sdr/properties/e3dsceneproperties.hxx index d1c10fc73afb..b5ff6b24d703 100644 --- a/svx/inc/sdr/properties/e3dsceneproperties.hxx +++ b/svx/inc/sdr/properties/e3dsceneproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class E3dSceneProperties final : public E3dProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // Called after ItemChange() is done for all items. virtual void PostItemChange(const sal_uInt16 nWhich) override; @@ -40,9 +43,6 @@ namespace sdr::properties // destructor virtual ~E3dSceneProperties() override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // get merged ItemSet. Normally, this maps directly to GetObjectItemSet(), but may // be overridden e.g for group objects to return a merged ItemSet of the object. // When using this method the returned ItemSet may contain items in the state diff --git a/svx/inc/sdr/properties/e3dsphereproperties.hxx b/svx/inc/sdr/properties/e3dsphereproperties.hxx index 61870c939d6d..937c79debbf2 100644 --- a/svx/inc/sdr/properties/e3dsphereproperties.hxx +++ b/svx/inc/sdr/properties/e3dsphereproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class E3dSphereProperties final : public E3dCompoundProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // Called after ItemChange() is done for all items. virtual void PostItemChange(const sal_uInt16 nWhich) override; @@ -39,9 +42,6 @@ namespace sdr::properties // destructor virtual ~E3dSphereProperties() override; - - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; }; } // end of namespace sdr::properties diff --git a/svx/inc/sdr/properties/emptyproperties.hxx b/svx/inc/sdr/properties/emptyproperties.hxx index 65cc0a85c743..f9363a0d78d5 100644 --- a/svx/inc/sdr/properties/emptyproperties.hxx +++ b/svx/inc/sdr/properties/emptyproperties.hxx @@ -30,13 +30,13 @@ namespace sdr::properties { class EmptyProperties final : public BaseProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + public: // basic constructor explicit EmptyProperties(SdrObject& rObj); - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // create a new object specific itemset with object specific ranges. virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) override; diff --git a/svx/inc/sdr/properties/graphicproperties.hxx b/svx/inc/sdr/properties/graphicproperties.hxx index e1ab266ce058..96089310b8b3 100644 --- a/svx/inc/sdr/properties/graphicproperties.hxx +++ b/svx/inc/sdr/properties/graphicproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class GraphicProperties final : public RectangleProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // apply the correct SfyStyleSheet from SdrObject's SdrModel virtual void applyDefaultStyleSheetFromSdrModel() override; @@ -46,9 +49,6 @@ namespace sdr::properties // destructor virtual ~GraphicProperties() override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // set a new StyleSheet and broadcast virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast, bool bAdjustTextFrameWidthAndHeight = true) override; diff --git a/svx/inc/sdr/properties/groupproperties.hxx b/svx/inc/sdr/properties/groupproperties.hxx index a2f83af65c7c..a2974a6a10f4 100644 --- a/svx/inc/sdr/properties/groupproperties.hxx +++ b/svx/inc/sdr/properties/groupproperties.hxx @@ -28,8 +28,12 @@ namespace sdr::properties { class GroupProperties final : public BaseProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // the to be used ItemSet mutable std::optional moMergedItemSet; + public: // basic constructor explicit GroupProperties(SdrObject& rObj); @@ -40,9 +44,6 @@ namespace sdr::properties // create a new object specific itemset with object specific ranges. virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // get itemset virtual const SfxItemSet& GetObjectItemSet() const override; diff --git a/svx/inc/sdr/properties/measureproperties.hxx b/svx/inc/sdr/properties/measureproperties.hxx index 7d85743489ad..7c70c1984a25 100644 --- a/svx/inc/sdr/properties/measureproperties.hxx +++ b/svx/inc/sdr/properties/measureproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class MeasureProperties final : public TextProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // create a new itemset virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; @@ -43,9 +46,6 @@ namespace sdr::properties // destructor virtual ~MeasureProperties() override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // set a new StyleSheet and broadcast virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast, bool bAdjustTextFrameWidthAndHeight = true) override; diff --git a/svx/inc/sdr/properties/oleproperties.hxx b/svx/inc/sdr/properties/oleproperties.hxx index 2a35c3ad0ec4..f4753967f122 100644 --- a/svx/inc/sdr/properties/oleproperties.hxx +++ b/svx/inc/sdr/properties/oleproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class OleProperties final : public RectangleProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // apply the correct SfyStyleSheet from SdrObject's SdrModel virtual void applyDefaultStyleSheetFromSdrModel() override; @@ -39,9 +42,6 @@ namespace sdr::properties // destructor virtual ~OleProperties() override; - - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; }; } // end of namespace sdr::properties diff --git a/svx/inc/sdr/properties/pageproperties.hxx b/svx/inc/sdr/properties/pageproperties.hxx index 6ec599e80a04..0828cfeac268 100644 --- a/svx/inc/sdr/properties/pageproperties.hxx +++ b/svx/inc/sdr/properties/pageproperties.hxx @@ -28,6 +28,9 @@ namespace sdr::properties { class PageProperties final : public BaseProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + // the to be used ItemSet mutable std::optional mxEmptyItemSet; @@ -44,9 +47,6 @@ namespace sdr::properties // create a new object specific itemset with object specific ranges. virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - virtual const SfxItemSet& GetObjectItemSet() const override; // get the installed StyleSheet diff --git a/svx/inc/sdr/properties/rectangleproperties.hxx b/svx/inc/sdr/properties/rectangleproperties.hxx index bcef4f758f7a..fb5aed74bc96 100644 --- a/svx/inc/sdr/properties/rectangleproperties.hxx +++ b/svx/inc/sdr/properties/rectangleproperties.hxx @@ -27,6 +27,9 @@ namespace sdr::properties { class RectangleProperties : public TextProperties { + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + protected: // react on ItemSet changes virtual void ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight = true) override; @@ -41,9 +44,6 @@ namespace sdr::properties // destructor virtual ~RectangleProperties() override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // set a new StyleSheet and broadcast virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast, bool bAdjustTextFrameWidthAndHeight = true) override; diff --git a/svx/inc/sdr/properties/textproperties.hxx b/svx/inc/sdr/properties/textproperties.hxx index 980096229253..f6b152aee1b3 100644 --- a/svx/inc/sdr/properties/textproperties.hxx +++ b/svx/inc/sdr/properties/textproperties.hxx @@ -28,10 +28,12 @@ namespace sdr::properties { class TextProperties : public AttributeProperties { - private: // #i101556# versioning support sal_uInt32 maVersion; + // Clone() operator, normally just calls the local copy constructor + virtual std::unique_ptr implCloneProperties(SdrObject& rObj) const override; + protected: // create a new itemset virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; @@ -55,9 +57,6 @@ namespace sdr::properties // destructor virtual ~TextProperties() override; - // Clone() operator, normally just calls the local copy constructor - virtual std::unique_ptr Clone(SdrObject& rObj) const override; - // set a new StyleSheet and broadcast virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast, bool bAdjustTextFrameWidthAndHeight = true) override; diff --git a/svx/qa/uitest/form/tdf170190.py b/svx/qa/uitest/form/tdf170190.py new file mode 100644 index 000000000000..a307ab336db1 --- /dev/null +++ b/svx/qa/uitest/form/tdf170190.py @@ -0,0 +1,53 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from com.sun.star.awt import Size + +# Bug 170190 - Form based filter reads wrong filter string +class tdf170190(UITestCase): + def test_tdf170190(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + # a form on the Bibliography table, filtered by two conditions on the same column + xForm = document.createInstance("com.sun.star.form.component.DataForm") + xForm.DataSourceName = "Bibliography" + xForm.Command = "biblio" + xForm.CommandType = 0 # TABLE + xForm.Filter = "\"Title\" LIKE 'A%' AND \"Title\" LIKE '%e'" + xForm.ApplyFilter = True + document.DrawPage.Forms.insertByName("Form", xForm) + + xTextField = document.createInstance("com.sun.star.form.component.TextField") + xTextField.DataField = "Title" + xForm.insertByName("Title", xTextField) + xShape = document.createInstance("com.sun.star.drawing.ControlShape") + xShape.Size = Size(5000, 1000) + xShape.Control = xTextField + document.DrawPage.add(xShape) + + xController = document.CurrentController + xController.setFormDesignMode(False) + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.waitUntilAllIdlesDispatched() + self.assertTrue(xForm.isLoaded()) + + # start the form based filter, which shows the current filter in the controls + xController.getControl(xTextField).setFocus() + xToolkit.waitUntilAllIdlesDispatched() + self.xUITest.executeCommand(".uno:FormFilter") + xToolkit.waitUntilAllIdlesDispatched() + + aPredicates = xController.getFormController(xForm).getPredicateExpressions() + self.xUITest.executeCommand(".uno:FormFilterExit") + + # Before the fix: AssertionError: "LIKE 'A%' AND LIKE '%e'" != "LIKE 'A%' AND '%e'" + self.assertEqual(1, len(aPredicates)) + self.assertEqual(1, len(aPredicates[0])) + self.assertEqual("LIKE 'A%' AND LIKE '%e'", " ".join(aPredicates[0][0].split())) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/svx/sdi/xoitems.sdi b/svx/sdi/xoitems.sdi index 3d8def73aebb..c144d6394664 100644 --- a/svx/sdi/xoitems.sdi +++ b/svx/sdi/xoitems.sdi @@ -16,7 +16,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -//item String XFillAttrSetItem; SfxSetItem! struct XFillBitmap { String Name MID_NAME; @@ -88,8 +87,6 @@ enum SvxFillStyle item SvxFillStyle XFillStyleItem; -//item String XLineAttrSetItem; SfxSetItem! - struct XLineColor { INT32 Color MID_COLOR_RGB; diff --git a/svx/source/annotation/AnnotationObject.cxx b/svx/source/annotation/AnnotationObject.cxx index 75de32522e92..d84e83c3461c 100644 --- a/svx/source/annotation/AnnotationObject.cxx +++ b/svx/source/annotation/AnnotationObject.cxx @@ -232,7 +232,7 @@ OUString AnnotationObject::TakeObjNameSingul() const OUString AnnotationObject::TakeObjNamePlural() const { return u"Annotations"_ustr; } -rtl::Reference AnnotationObject::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference AnnotationObject::implCloneSdrObject(SdrModel& rTargetModel) const { return new AnnotationObject(rTargetModel, *this); } diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index 76e375efb6f0..00ee7f83016b 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -127,9 +127,9 @@ const SvxMSDffHandle mso_sptArcHandle[] = const mso_CustomShape msoArc = { std::span(mso_sptArcVert), - const_cast(mso_sptArcSegm), sizeof( mso_sptArcSegm ) >> 1, + std::span(mso_sptArcSegm), std::span(mso_sptArcCalc), - const_cast(mso_sptArcDefault), + std::span(mso_sptArcDefault), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -144,9 +144,9 @@ const SvxMSDffVertPair mso_sptTextSimpleVert[] = const mso_CustomShape msoTextSimple = { std::span(mso_sptTextSimpleVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -161,9 +161,9 @@ const SvxMSDffVertPair mso_sptRectangleVert[] = const mso_CustomShape msoRectangle = { std::span(mso_sptRectangleVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -206,9 +206,9 @@ const SvxMSDffHandle mso_sptRoundRectangleHandle[] = const mso_CustomShape msoRoundRectangle = { std::span(mso_sptRoundRectangleVert), - const_cast(mso_sptRoundRectangleSegm), sizeof( mso_sptRoundRectangleSegm ) >> 1, + std::span(mso_sptRoundRectangleSegm), std::span(mso_sptRoundRectangleCalc), - const_cast(mso_sptDefault3600), + std::span(mso_sptDefault3600), std::span(mso_sptRoundRectangleTextRect), 21600, 21600, 10800, 10800, @@ -231,9 +231,9 @@ const SvxMSDffVertPair mso_sptRightTriangleGluePoints[] = const mso_CustomShape msoRightTriangle = { std::span(mso_sptRightTriangleVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptRightTriangleTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -260,9 +260,9 @@ const SvxMSDffVertPair mso_sptEllipseGluePoints[] = const mso_CustomShape msoEllipse = { std::span(mso_sptEllipseVert), - const_cast(mso_sptEllipseSegm), sizeof( mso_sptEllipseSegm ) >> 1, + std::span(mso_sptEllipseSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptEllipseTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -311,9 +311,9 @@ const SvxMSDffHandle mso_sptParallelogramHandle[] = const mso_CustomShape msoParallelogram = { std::span(mso_sptParallelogramVert), - const_cast(mso_sptParallelogramSegm), sizeof( mso_sptParallelogramSegm ) >> 1, + std::span(mso_sptParallelogramSegm), std::span(mso_sptParallelogramCalc), - const_cast(mso_sptDefault5400), + std::span(mso_sptDefault5400), std::span(mso_sptParallelogramTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -332,9 +332,9 @@ const SvxMSDffTextRectangles mso_sptDiamondTextRect[] = const mso_CustomShape msoDiamond = { std::span(mso_sptDiamondVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptDiamondTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -376,9 +376,9 @@ const SvxMSDffHandle mso_sptTrapezoidHandle[] = const mso_CustomShape msoTrapezoid = { std::span(mso_sptTrapezoidVert), - const_cast(mso_sptTrapezoidSegm), sizeof( mso_sptTrapezoidSegm ) >> 1, + std::span(mso_sptTrapezoidSegm), std::span(mso_sptTrapezoidCalc), - const_cast(mso_sptDefault5400), + std::span(mso_sptDefault5400), std::span(mso_sptTrapezoidTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -467,9 +467,9 @@ const SvxMSDffHandle mso_sptOctagonHandle[] = const mso_CustomShape msoOctagon = { std::span(mso_sptOctagonVert), - const_cast(mso_sptOctagonSegm), sizeof( mso_sptOctagonSegm ) >> 1, + std::span(mso_sptOctagonSegm), std::span(mso_sptOctagonCalc), - const_cast(mso_sptOctagonDefault), + std::span(mso_sptOctagonDefault), std::span(mso_sptOctagonTextRect), 21600, 21600, 10800, 10800, @@ -513,9 +513,9 @@ const SvxMSDffHandle mso_sptIsocelesTriangleHandle[] = const mso_CustomShape msoIsocelesTriangle = { std::span(mso_sptIsocelesTriangleVert), - const_cast(mso_sptIsocelesTriangleSegm), sizeof( mso_sptIsocelesTriangleSegm ) >> 1, + std::span(mso_sptIsocelesTriangleSegm), std::span(mso_sptIsocelesTriangleCalc), - const_cast(mso_sptDefault10800), + std::span(mso_sptDefault10800), std::span(mso_sptIsocelesTriangleTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -552,9 +552,9 @@ const SvxMSDffHandle mso_sptHexagonHandle[] = const mso_CustomShape msoHexagon = { std::span(mso_sptHexagonVert), - const_cast(mso_sptHexagonSegm), sizeof( mso_sptHexagonSegm ) >> 1, + std::span(mso_sptHexagonSegm), std::span(mso_sptHexagonCalc), - const_cast(mso_sptDefault5400), + std::span(mso_sptDefault5400), std::span(mso_sptHexagonTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -579,9 +579,9 @@ const SvxMSDffVertPair mso_sptPentagonGluePoints[] = const mso_CustomShape msoPentagon = { std::span(mso_sptPentagonVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptPentagonTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -614,9 +614,9 @@ const SvxMSDffHandle mso_sptPlusHandle[] = const mso_CustomShape msoPlus = { std::span(mso_sptPlusVert), - nullptr, 0, + std::span(), std::span(mso_sptPlusCalc), - const_cast(mso_sptDefault5400), + std::span(mso_sptDefault5400), std::span(mso_sptPlusTextRect), 21600, 21600, 10800, 10800, @@ -671,9 +671,9 @@ const SvxMSDffHandle mso_sptCanHandle[] = const mso_CustomShape msoCan = { std::span(mso_sptCanVert), - const_cast(mso_sptCanSegm), sizeof( mso_sptCanSegm ) >> 1, + std::span(mso_sptCanSegm), std::span(mso_sptCanCalc), - const_cast(mso_sptDefault5400), + std::span(mso_sptDefault5400), std::span(mso_sptCanTextRect), 88, 21600, MIN_INT32, MIN_INT32, @@ -713,9 +713,9 @@ const SvxMSDffHandle mso_sptArrowHandle[] = const mso_CustomShape msoArrow = { std::span(mso_sptArrowVert), - const_cast(mso_sptArrowSegm), sizeof( mso_sptArrowSegm ) >> 1, + std::span(mso_sptArrowSegm), std::span(mso_sptArrowCalc), - const_cast(mso_sptDefault16200and5400), + std::span(mso_sptDefault16200and5400), std::span(mso_sptArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -748,9 +748,9 @@ const SvxMSDffHandle mso_sptLeftArrowHandle[] = const mso_CustomShape msoLeftArrow = { std::span(mso_sptLeftArrowVert), - const_cast(mso_sptLeftArrowSegm), sizeof( mso_sptLeftArrowSegm ) >> 1, + std::span(mso_sptLeftArrowSegm), std::span(mso_sptArrowCalc), - const_cast(mso_sptLeftArrowDefault), + std::span(mso_sptLeftArrowDefault), std::span(mso_sptLeftArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -779,9 +779,9 @@ const SvxMSDffHandle mso_sptDownArrowHandle[] = const mso_CustomShape msoDownArrow = { std::span(mso_sptDownArrowVert), - const_cast(mso_sptDownArrowSegm), sizeof( mso_sptDownArrowSegm ) >> 1, + std::span(mso_sptDownArrowSegm), std::span(mso_sptArrowCalc), - const_cast(mso_sptDefault16200and5400), + std::span(mso_sptDefault16200and5400), std::span(mso_sptDownArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -814,9 +814,9 @@ const SvxMSDffHandle mso_sptUpArrowHandle[] = const mso_CustomShape msoUpArrow = { std::span(mso_sptUpArrowVert), - const_cast(mso_sptUpArrowSegm), sizeof( mso_sptUpArrowSegm ) >> 1, + std::span(mso_sptUpArrowSegm), std::span(mso_sptArrowCalc), - const_cast(mso_sptUpArrowDefault), + std::span(mso_sptUpArrowDefault), std::span(mso_sptUpArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -863,9 +863,9 @@ const SvxMSDffHandle mso_sptLeftRightArrowHandle[] = const mso_CustomShape msoLeftRightArrow = { std::span(mso_sptLeftRightArrowVert), - const_cast(mso_sptLeftRightArrowSegm), sizeof( mso_sptLeftRightArrowSegm ) >> 1, + std::span(mso_sptLeftRightArrowSegm), std::span(mso_sptDoubleArrowCalc), - const_cast(mso_sptLeftRightArrowDefault), + std::span(mso_sptLeftRightArrowDefault), std::span(mso_sptLeftRightArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -899,9 +899,9 @@ const SvxMSDffHandle mso_sptUpDownArrowHandle[] = const mso_CustomShape msoUpDownArrow = { std::span(mso_sptUpDownArrowVert), - const_cast(mso_sptUpDownArrowSegm), sizeof( mso_sptUpDownArrowSegm ) >> 1, + std::span(mso_sptUpDownArrowSegm), std::span(mso_sptDoubleArrowCalc), - const_cast(mso_sptUpDownArrowDefault), + std::span(mso_sptUpDownArrowDefault), std::span(mso_sptUpDownArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -949,9 +949,9 @@ const SvxMSDffHandle mso_sptQuadArrowHandle[] = const mso_CustomShape msoQuadArrow = { std::span(mso_sptQuadArrowVert), - const_cast(mso_sptQuadArrowSegm), sizeof( mso_sptQuadArrowSegm ) >> 1, + std::span(mso_sptQuadArrowSegm), std::span(mso_sptQuadArrowCalc), - const_cast(mso_sptQuadArrowDefault), + std::span(mso_sptQuadArrowDefault), std::span(mso_sptQuadArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -998,9 +998,9 @@ const SvxMSDffHandle mso_sptLeftRightUpArrowHandle[] = const mso_CustomShape msoLeftRightUpArrow = { std::span(mso_sptLeftRightUpArrowVert), - const_cast(mso_sptLeftRightUpArrowSegm), sizeof( mso_sptLeftRightUpArrowSegm ) >> 1, + std::span(mso_sptLeftRightUpArrowSegm), std::span(mso_sptLeftRightUpArrowCalc), - const_cast(mso_sptLeftRightUpArrowDefault), + std::span(mso_sptLeftRightUpArrowDefault), std::span(mso_sptLeftRightUpArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1042,9 +1042,9 @@ const SvxMSDffHandle mso_sptBentArrowHandle[] = const mso_CustomShape msoBentArrow = { std::span(mso_sptBentArrowVert), - const_cast(mso_sptBentArrowSegm), sizeof( mso_sptBentArrowSegm ) >> 1, + std::span(mso_sptBentArrowSegm), std::span(mso_sptBentArrowCalc), - const_cast(mso_sptBentArrowDefault), + std::span(mso_sptBentArrowDefault), std::span(mso_sptBentArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1073,9 +1073,9 @@ const SvxMSDffTextRectangles mso_sptUturnArrowTextRect[] = const mso_CustomShape msoUturnArrow = { std::span(mso_sptUturnArrowVert), - const_cast(mso_sptUturnArrowSegm), sizeof( mso_sptUturnArrowSegm ) >> 1, + std::span(mso_sptUturnArrowSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptUturnArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1125,9 +1125,9 @@ const SvxMSDffHandle mso_sptLeftUpArrowHandle[] = const mso_CustomShape msoLeftUpArrow = { std::span(mso_sptLeftUpArrowVert), - const_cast(mso_sptLeftUpArrowSegm), sizeof( mso_sptLeftUpArrowSegm ) >> 1, + std::span(mso_sptLeftUpArrowSegm), std::span(mso_sptLeftUpArrowCalc), - const_cast(mso_sptLeftUpArrowDefault), + std::span(mso_sptLeftUpArrowDefault), std::span(mso_sptLeftUpArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1178,9 +1178,9 @@ const SvxMSDffHandle mso_sptBentUpArrowHandle[] = const mso_CustomShape msoBentUpArrow = { std::span(mso_sptBentUpArrowVert), - const_cast(mso_sptBentUpArrowSegm), sizeof( mso_sptBentUpArrowSegm ) >> 1, + std::span(mso_sptBentUpArrowSegm), std::span(mso_sptBentUpArrowCalc), - const_cast(mso_sptBentUpArrowDefault), + std::span(mso_sptBentUpArrowDefault), std::span(mso_sptBentUpArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1287,9 +1287,9 @@ const SvxMSDffHandle mso_sptCurvedRightHandles[] = const mso_CustomShape msoCurvedRightArrow = { std::span(mso_sptCurvedRightVert), - const_cast(mso_sptCurvedRightSegm), sizeof( mso_sptCurvedRightSegm ) >> 1, + std::span(mso_sptCurvedRightSegm), std::span(mso_sptCurvedRightCalc), - const_cast(mso_sptCurvedRightDefault), + std::span(mso_sptCurvedRightDefault), std::span(mso_sptCurvedRightTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1343,9 +1343,9 @@ const SvxMSDffHandle mso_sptCurvedDownHandles[] = const mso_CustomShape msoCurvedDownArrow = { std::span(mso_sptCurvedDownVert), - const_cast(mso_sptCurvedDownSegm), sizeof( mso_sptCurvedDownSegm ) >> 1, + std::span(mso_sptCurvedDownSegm), std::span(mso_sptCurvedRightCalc), - const_cast(mso_sptCurvedRightDefault), + std::span(mso_sptCurvedRightDefault), std::span(mso_sptCurvedDownTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1450,9 +1450,9 @@ const SvxMSDffHandle mso_sptCurvedUpHandles[] = const mso_CustomShape msoCurvedUpArrow = { std::span(mso_sptCurvedUpVert), - const_cast(mso_sptCurvedUpSegm), sizeof( mso_sptCurvedUpSegm ) >> 1, + std::span(mso_sptCurvedUpSegm), std::span(mso_sptCurvedUpCalc), - const_cast(mso_sptCurvedUpDefault), + std::span(mso_sptCurvedUpDefault), std::span(mso_sptCurvedUpTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1504,9 +1504,9 @@ const SvxMSDffHandle mso_sptCurvedLeftHandles[] = const mso_CustomShape msoCurvedLeftArrow = { std::span(mso_sptCurvedLeftVert), - const_cast(mso_sptCurvedLeftSegm), sizeof( mso_sptCurvedLeftSegm ) >> 1, + std::span(mso_sptCurvedLeftSegm), std::span(mso_sptCurvedUpCalc), - const_cast(mso_sptCurvedUpDefault), + std::span(mso_sptCurvedUpDefault), std::span(mso_sptCurvedLeftTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1548,9 +1548,9 @@ const SvxMSDffHandle mso_sptStripedRightArrowHandle[] = const mso_CustomShape msoStripedRightArrow = { std::span(mso_sptStripedRightArrowVert), - const_cast(mso_sptStripedRightArrowSegm), sizeof( mso_sptStripedRightArrowSegm ) >> 1, + std::span(mso_sptStripedRightArrowSegm), std::span(mso_sptStripedRightArrowCalc), - const_cast(mso_sptDefault16200and5400), + std::span(mso_sptDefault16200and5400), std::span(mso_sptStripedRightArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1585,9 +1585,9 @@ const SvxMSDffHandle mso_sptNotchedRightArrowHandle[] = const mso_CustomShape msoNotchedRightArrow = { std::span(mso_sptNotchedRightArrowVert), - nullptr, 0, + std::span(), std::span(mso_sptNotchedRightArrowCalc), - const_cast(mso_sptDefault16200and5400), + std::span(mso_sptDefault16200and5400), std::span(mso_sptNotchedRightArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1624,9 +1624,9 @@ const SvxMSDffHandle mso_sptHomePlateHandle[] = const mso_CustomShape msoHomePlate = { std::span(mso_sptHomePlateVert), - const_cast(mso_sptHomePlateSegm), sizeof( mso_sptHomePlateSegm ) >> 1, + std::span(mso_sptHomePlateSegm), std::span(mso_sptHomePlateCalc), - const_cast(mso_sptHomePlateDefault), + std::span(mso_sptHomePlateDefault), std::span(mso_sptHomePlateTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1664,9 +1664,9 @@ const SvxMSDffHandle mso_sptChevronHandle[] = const mso_CustomShape msoChevron = { std::span(mso_sptChevronVert), - const_cast(mso_sptChevronSegm), sizeof( mso_sptChevronSegm ) >> 1, + std::span(mso_sptChevronSegm), std::span(mso_sptChevronCalc), - const_cast(mso_sptChevronDefault), + std::span(mso_sptChevronDefault), std::span(mso_sptChevronTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1713,9 +1713,9 @@ const SvxMSDffHandle mso_sptRightArrowCalloutHandle[] = const mso_CustomShape msoRightArrowCallout = { std::span(mso_sptRightArrowCalloutVert), - const_cast(mso_sptRightArrowCalloutSegm), sizeof( mso_sptRightArrowCalloutSegm ) >> 1, + std::span(mso_sptRightArrowCalloutSegm), std::span(mso_sptRightArrowCalloutCalc), - const_cast(mso_sptRightArrowCalloutDefault), + std::span(mso_sptRightArrowCalloutDefault), std::span(mso_sptRightArrowCalloutTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1762,9 +1762,9 @@ const SvxMSDffHandle mso_sptLeftArrowCalloutHandle[] = const mso_CustomShape msoLeftArrowCallout = { std::span(mso_sptLeftArrowCalloutVert), - const_cast(mso_sptLeftArrowCalloutSegm), sizeof( mso_sptLeftArrowCalloutSegm ) >> 1, + std::span(mso_sptLeftArrowCalloutSegm), std::span(mso_sptLeftArrowCalloutCalc), - const_cast(mso_sptLeftArrowCalloutDefault), + std::span(mso_sptLeftArrowCalloutDefault), std::span(mso_sptLeftArrowCalloutTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1811,9 +1811,9 @@ const SvxMSDffHandle mso_sptUpArrowCalloutHandle[] = const mso_CustomShape msoUpArrowCallout = { std::span(mso_sptUpArrowCalloutVert), - const_cast(mso_sptUpArrowCalloutSegm), sizeof( mso_sptUpArrowCalloutSegm ) >> 1, + std::span(mso_sptUpArrowCalloutSegm), std::span(mso_sptUpArrowCalloutCalc), - const_cast(mso_sptUpArrowCalloutDefault), + std::span(mso_sptUpArrowCalloutDefault), std::span(mso_sptUpArrowCalloutTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1860,9 +1860,9 @@ const SvxMSDffHandle mso_sptDownArrowCalloutHandle[] = const mso_CustomShape msoDownArrowCallout = { std::span(mso_sptDownArrowCalloutVert), - const_cast(mso_sptDownArrowCalloutSegm), sizeof( mso_sptDownArrowCalloutSegm ) >> 1, + std::span(mso_sptDownArrowCalloutSegm), std::span(mso_sptDownArrowCalloutCalc), - const_cast(mso_sptDownArrowCalloutDefault), + std::span(mso_sptDownArrowCalloutDefault), std::span(mso_sptDownArrowCalloutTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1913,9 +1913,9 @@ const SvxMSDffHandle mso_sptLeftRightArrowCalloutHandle[] = const mso_CustomShape msoLeftRightArrowCallout = { std::span(mso_sptLeftRightArrowCalloutVert), - const_cast(mso_sptLeftRightArrowCalloutSegm), sizeof( mso_sptLeftRightArrowCalloutSegm ) >> 1, + std::span(mso_sptLeftRightArrowCalloutSegm), std::span(mso_sptLeftRightArrowCalloutCalc), - const_cast(mso_sptLeftRightArrowCalloutDefault), + std::span(mso_sptLeftRightArrowCalloutDefault), std::span(mso_sptLeftRightArrowCalloutTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -1966,9 +1966,9 @@ const SvxMSDffHandle mso_sptUpDownArrowCalloutHandle[] = const mso_CustomShape msoUpDownArrowCallout = { std::span(mso_sptUpDownArrowCalloutVert), - const_cast(mso_sptUpDownArrowCalloutSegm), sizeof( mso_sptUpDownArrowCalloutSegm ) >> 1, + std::span(mso_sptUpDownArrowCalloutSegm), std::span(mso_sptUpDownArrowCalloutCalc), - const_cast(mso_sptUpDownArrowCalloutDefault), + std::span(mso_sptUpDownArrowCalloutDefault), std::span(mso_sptUpDownArrowCalloutTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -2022,9 +2022,9 @@ const SvxMSDffHandle mso_sptQuadArrowCalloutHandle[] = const mso_CustomShape msoQuadArrowCallout = { std::span(mso_sptQuadArrowCalloutVert), - const_cast(mso_sptQuadArrowCalloutSegm), sizeof( mso_sptQuadArrowCalloutSegm ) >> 1, + std::span(mso_sptQuadArrowCalloutSegm), std::span(mso_sptQuadArrowCalloutCalc), - const_cast(mso_sptQuadArrowCalloutDefault), + std::span(mso_sptQuadArrowCalloutDefault), std::span(mso_sptQuadArrowCalloutTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -2118,9 +2118,9 @@ const SvxMSDffHandle mso_sptCircularArrowHandle[] = const mso_CustomShape msoCircularArrow = { std::span(mso_sptCircularArrowVert), - const_cast(mso_sptCircularArrowSegm), sizeof( mso_sptCircularArrowSegm ) >> 1, + std::span(mso_sptCircularArrowSegm), std::span(mso_sptCircularArrowCalc), - const_cast(mso_sptCircularArrowDefault), + std::span(mso_sptCircularArrowDefault), std::span(mso_sptCircularArrowTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -2172,9 +2172,9 @@ const SvxMSDffVertPair mso_sptCubeGluePoints[] = const mso_CustomShape msoCube = { std::span(mso_sptCubeVert), - const_cast(mso_sptCubeSegm), sizeof( mso_sptCubeSegm ) >> 1, + std::span(mso_sptCubeSegm), std::span(mso_sptCubeCalc), - const_cast(mso_sptDefault5400), + std::span(mso_sptDefault5400), std::span(mso_sptCubeTextRect), 21600, 21600, 10800, 10800, @@ -2217,9 +2217,9 @@ const SvxMSDffHandle mso_sptBevelHandle[] = const mso_CustomShape msoBevel = { std::span(mso_sptBevelVert), - const_cast(mso_sptBevelSegm), sizeof( mso_sptBevelSegm ) >> 1, + std::span(mso_sptBevelSegm), std::span(mso_sptBevelCalc), - const_cast(mso_sptDefault2700), + std::span(mso_sptDefault2700), std::span(mso_sptBevelTextRect), 21600, 21600, 10800, 10800, @@ -2269,9 +2269,9 @@ const SvxMSDffHandle mso_sptFoldedCornerHandle[] = const mso_CustomShape msoFoldedCorner = { std::span(mso_sptFoldedCornerVert), - const_cast(mso_sptFoldedCornerSegm), sizeof( mso_sptFoldedCornerSegm ) >> 1, + std::span(mso_sptFoldedCornerSegm), std::span(mso_sptFoldedCornerCalc), - const_cast(mso_sptFoldedCornerDefault), + std::span(mso_sptFoldedCornerDefault), std::span(mso_sptFoldedCornerTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -2313,9 +2313,9 @@ const SvxMSDffHandle mso_sptButtonHandle[] = const mso_CustomShape msoActionButtonBlank = { std::span(mso_sptActionButtonBlankVert), - const_cast(mso_sptActionButtonBlankSegm), sizeof( mso_sptActionButtonBlankSegm ) >> 1, + std::span(mso_sptActionButtonBlankSegm), std::span(mso_sptActionButtonBlankCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonBlankTextRect), 21600, 21600, 10800, 10800, @@ -2401,9 +2401,9 @@ const SvxMSDffCalculationData mso_sptActionButtonHomeCalc[] = // adj value 0 const mso_CustomShape msoActionButtonHome = { std::span(mso_sptActionButtonHomeVert), - const_cast(mso_sptActionButtonHomeSegm), sizeof( mso_sptActionButtonHomeSegm ) >> 1, + std::span(mso_sptActionButtonHomeSegm), std::span(mso_sptActionButtonHomeCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonTextRect), 21600, 21600, 10800, 10800, @@ -2511,9 +2511,9 @@ const SvxMSDffCalculationData mso_sptActionButtonHelpCalc[] = // adj value 0 const mso_CustomShape msoActionButtonHelp = { std::span(mso_sptActionButtonHelpVert), - const_cast(mso_sptActionButtonHelpSegm), sizeof( mso_sptActionButtonHelpSegm ) >> 1, + std::span(mso_sptActionButtonHelpSegm), std::span(mso_sptActionButtonHelpCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonTextRect), 21600, 21600, 10800, 10800, @@ -2599,9 +2599,9 @@ const SvxMSDffCalculationData mso_sptActionButtonInformationCalc[] = // adj valu const mso_CustomShape msoActionButtonInformation = { std::span(mso_sptActionButtonInformationVert), - const_cast(mso_sptActionButtonInformationSegm), sizeof( mso_sptActionButtonInformationSegm ) >> 1, + std::span(mso_sptActionButtonInformationSegm), std::span(mso_sptActionButtonInformationCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonTextRect), 21600, 21600, 10800, 10800, @@ -2652,9 +2652,9 @@ const SvxMSDffCalculationData mso_sptActionButtonForwardBackCalc[] = // adj valu const mso_CustomShape msoActionButtonBackPrevious = { std::span(mso_sptActionButtonBackPreviousVert), - const_cast(mso_sptActionButtonForwardBackSegm), sizeof( mso_sptActionButtonForwardBackSegm ) >> 1, + std::span(mso_sptActionButtonForwardBackSegm), std::span(mso_sptActionButtonForwardBackCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonTextRect), 21600, 21600, 10800, 10800, @@ -2675,9 +2675,9 @@ const SvxMSDffVertPair mso_sptActionButtonForwardNextVert[] = const mso_CustomShape msoActionButtonForwardNext = { std::span(mso_sptActionButtonForwardNextVert), - const_cast(mso_sptActionButtonForwardBackSegm), sizeof( mso_sptActionButtonForwardBackSegm ) >> 1, + std::span(mso_sptActionButtonForwardBackSegm), std::span(mso_sptActionButtonForwardBackCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonTextRect), 21600, 21600, 10800, 10800, @@ -2742,9 +2742,9 @@ const SvxMSDffCalculationData mso_sptActionButtonBeginningEndCalc[] = // adj const mso_CustomShape msoActionButtonBeginning = { std::span(mso_sptActionButtonBeginningVert), - const_cast(mso_sptActionButtonBeginningEndSegm), sizeof( mso_sptActionButtonBeginningEndSegm ) >> 1, + std::span(mso_sptActionButtonBeginningEndSegm), std::span(mso_sptActionButtonBeginningEndCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonTextRect), 21600, 21600, 10800, 10800, @@ -2767,9 +2767,9 @@ const SvxMSDffVertPair mso_sptActionButtonEndVert[] = const mso_CustomShape msoActionButtonEnd = { std::span(mso_sptActionButtonEndVert), - const_cast(mso_sptActionButtonBeginningEndSegm), sizeof( mso_sptActionButtonBeginningEndSegm ) >> 1, + std::span(mso_sptActionButtonBeginningEndSegm), std::span(mso_sptActionButtonBeginningEndCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonTextRect), 21600, 21600, 10800, 10800, @@ -2856,9 +2856,9 @@ const SvxMSDffCalculationData mso_sptActionButtonReturnCalc[] = // adj value 0 const mso_CustomShape msoActionButtonReturn = { std::span(mso_sptActionButtonReturnVert), - const_cast(mso_sptActionButtonReturnSegm), sizeof( mso_sptActionButtonReturnSegm ) >> 1, + std::span(mso_sptActionButtonReturnSegm), std::span(mso_sptActionButtonReturnCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonTextRect), 21600, 21600, 10800, 10800, @@ -2916,9 +2916,9 @@ const SvxMSDffCalculationData mso_sptActionButtonDocumentCalc[] = // adj valu const mso_CustomShape msoActionButtonDocument = { std::span(mso_sptActionButtonDocumentVert), - const_cast(mso_sptActionButtonDocumentSegm), sizeof( mso_sptActionButtonDocumentSegm ) >> 1, + std::span(mso_sptActionButtonDocumentSegm), std::span(mso_sptActionButtonDocumentCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonTextRect), 21600, 21600, 10800, 10800, @@ -2992,9 +2992,9 @@ const SvxMSDffCalculationData mso_sptActionButtonSoundCalc[] = // adj value 0 const mso_CustomShape msoActionButtonSound = { std::span(mso_sptActionButtonSoundVert), - const_cast(mso_sptActionButtonSoundSegm), sizeof( mso_sptActionButtonSoundSegm ) >> 1, + std::span(mso_sptActionButtonSoundSegm), std::span(mso_sptActionButtonSoundCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonTextRect), 21600, 21600, 10800, 10800, @@ -3077,9 +3077,9 @@ const SvxMSDffCalculationData mso_sptActionButtonMovieCalc[] = // adj value 0 const mso_CustomShape msoActionButtonMovie = { std::span(mso_sptActionButtonMovieVert), - const_cast(mso_sptActionButtonMovieSegm), sizeof( mso_sptActionButtonMovieSegm ) >> 1, + std::span(mso_sptActionButtonMovieSegm), std::span(mso_sptActionButtonMovieCalc), - const_cast(mso_sptDefault1400), + std::span(mso_sptDefault1400), std::span(mso_sptActionButtonTextRect), 21600, 21600, 10800, 10800, @@ -3120,9 +3120,9 @@ const SvxMSDffHandle mso_sptSmileyHandle[] = const mso_CustomShape msoSmileyFace = { std::span(mso_sptSmileyFaceVert), - const_cast(mso_sptSmileyFaceSegm), sizeof( mso_sptSmileyFaceSegm ) >> 1, + std::span(mso_sptSmileyFaceSegm), std::span(mso_sptSmileyFaceCalc), - const_cast(mso_sptSmileyFaceDefault), + std::span(mso_sptSmileyFaceDefault), std::span(mso_sptEllipseTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3152,9 +3152,9 @@ const SvxMSDffHandle mso_sptDonutHandle[] = const mso_CustomShape msoDonut = { std::span(mso_sptDonutVert), - const_cast(mso_sptDonutSegm), sizeof( mso_sptDonutSegm ) >> 1, + std::span(mso_sptDonutSegm), std::span(mso_sptDonutCalc), - const_cast(mso_sptDefault5400), + std::span(mso_sptDefault5400), std::span(mso_sptEllipseTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3201,9 +3201,9 @@ const SvxMSDffHandle mso_sptNoSmokingHandle[] = const mso_CustomShape msoNoSmoking = { std::span(mso_sptNoSmokingVert), - const_cast(mso_sptNoSmokingSegm), sizeof( mso_sptNoSmokingSegm ) >> 1, + std::span(mso_sptNoSmokingSegm), std::span(mso_sptNoSmokingCalc), - const_cast(mso_sptDefault2700), + std::span(mso_sptDefault2700), std::span(mso_sptEllipseTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3244,9 +3244,9 @@ const SvxMSDffHandle mso_sptBlockArcHandle[] = const mso_CustomShape msoBlockArc = { std::span(mso_sptBlockArcVert), - const_cast(mso_sptBlockArcSegm), sizeof( mso_sptBlockArcSegm ) >> 1, + std::span(mso_sptBlockArcSegm), std::span(mso_sptBlockArcCalc), - const_cast(mso_sptBlockArcDefault), + std::span(mso_sptBlockArcDefault), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3308,9 +3308,9 @@ const SvxMSDffVertPair mso_sptHeartGluePoints[] = const mso_CustomShape msoHeart = { std::span(mso_sptHeartVert), - const_cast(mso_sptHeartSegm), sizeof( mso_sptHeartSegm ) >> 1, + std::span(mso_sptHeartSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptHeartTextRect), 21615, 21602, MIN_INT32, MIN_INT32, @@ -3336,9 +3336,9 @@ const SvxMSDffVertPair mso_sptLightningBoldGluePoints[] = const mso_CustomShape msoLightningBold = { std::span(mso_sptLightningBoldVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptLightningBoldTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3440,9 +3440,9 @@ const SvxMSDffHandle mso_sptSunHandle[] = const mso_CustomShape msoSun = { std::span(mso_sptSunVert), - const_cast(mso_sptSunSegm), sizeof( mso_sptSunSegm ) >> 1, + std::span(mso_sptSunSegm), std::span(mso_sptSunCalc), - const_cast(mso_sptDefault5400), + std::span(mso_sptDefault5400), std::span(mso_sptSunTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3492,9 +3492,9 @@ const SvxMSDffHandle mso_sptMoonHandle[] = const mso_CustomShape msoMoon = { std::span(mso_sptMoonVert), - const_cast(mso_sptMoonSegm), sizeof( mso_sptMoonSegm ) >> 1, + std::span(mso_sptMoonSegm), std::span(mso_sptMoonCalc), - const_cast(mso_sptDefault10800), + std::span(mso_sptDefault10800), std::span(mso_sptMoonTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3551,9 +3551,9 @@ const SvxMSDffHandle mso_sptBracketPairHandle[] = const mso_CustomShape msoBracketPair = { std::span(mso_sptBracketPairVert), - const_cast(mso_sptBracketPairSegm), sizeof( mso_sptBracketPairSegm ) >> 1, + std::span(mso_sptBracketPairSegm), std::span(mso_sptBracketPairCalc), - const_cast(mso_sptDefault3700), + std::span(mso_sptDefault3700), std::span(mso_sptBracketPairTextRect), 21600, 21600, 10800, MIN_INT32, @@ -3577,9 +3577,9 @@ const SvxMSDffHandle mso_sptPlaqueHandle[] = const mso_CustomShape msoPlaque = { std::span(mso_sptBracketPairVert), - const_cast(mso_sptPlaqueSegm), sizeof( mso_sptPlaqueSegm ) >> 1, + std::span(mso_sptPlaqueSegm), std::span(mso_sptBracketPairCalc), - const_cast(mso_sptDefault3600), + std::span(mso_sptDefault3600), std::span(mso_sptPlaqueTextRect), 21600, 21600, 10800, 10800, @@ -3635,9 +3635,9 @@ const SvxMSDffHandle mso_sptBracePairHandle[] = const mso_CustomShape msoBracePair = { std::span(mso_sptBracePairVert), - const_cast(mso_sptBracePairSegm), sizeof( mso_sptBracePairSegm ) >> 1, + std::span(mso_sptBracePairSegm), std::span(mso_sptBracePairCalc), - const_cast(mso_sptDefault1800), + std::span(mso_sptDefault1800), std::span(mso_sptBracePairTextRect), 21600, 21600, 10800, MIN_INT32, @@ -3678,9 +3678,9 @@ const SvxMSDffHandle mso_sptLeftBracketHandle[] = const mso_CustomShape msoLeftBracket = { std::span(mso_sptLeftBracketVert), - const_cast(mso_sptBracketSegm), sizeof( mso_sptBracketSegm ) >> 1, + std::span(mso_sptBracketSegm), std::span(mso_sptBracketCalc), - const_cast(mso_sptDefault1800), + std::span(mso_sptDefault1800), std::span(mso_sptLeftBracketTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3708,9 +3708,9 @@ const SvxMSDffHandle mso_sptRightBracketHandle[] = const mso_CustomShape msoRightBracket = { std::span(mso_sptRightBracketVert), - const_cast(mso_sptBracketSegm), sizeof( mso_sptBracketSegm ) >> 1, + std::span(mso_sptBracketSegm), std::span(mso_sptBracketCalc), - const_cast(mso_sptDefault1800), + std::span(mso_sptDefault1800), std::span(mso_sptRightBracketTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3764,9 +3764,9 @@ const SvxMSDffHandle mso_sptLeftBraceHandle[] = const mso_CustomShape msoLeftBrace = // adj value0 0 -> 5400 { // adj value1 0 -> 21600 std::span(mso_sptLeftBraceVert), - const_cast(mso_sptBraceSegm), sizeof( mso_sptBraceSegm ) >> 1, + std::span(mso_sptBraceSegm), std::span(mso_sptBraceCalc), - const_cast(mso_sptBraceDefault), + std::span(mso_sptBraceDefault), std::span(mso_sptLeftBraceTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3797,9 +3797,9 @@ const SvxMSDffHandle mso_sptRightBraceHandle[] = const mso_CustomShape msoRightBrace = // adj value0 0 -> 5400 { // adj value1 0 -> 21600 std::span(mso_sptRightBraceVert), - const_cast(mso_sptBraceSegm), sizeof( mso_sptBraceSegm ) >> 1, + std::span(mso_sptBraceSegm), std::span(mso_sptBraceCalc), - const_cast(mso_sptBraceDefault), + std::span(mso_sptBraceDefault), std::span(mso_sptRightBraceTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3827,9 +3827,9 @@ const SvxMSDffVertPair mso_sptIrregularSeal1GluePoints[] = const mso_CustomShape msoIrregularSeal1 = { std::span(mso_sptIrregularSeal1Vert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptIrregularSeal1TextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3859,9 +3859,9 @@ const SvxMSDffVertPair mso_sptIrregularSeal2GluePoints[] = const mso_CustomShape msoIrregularSeal2 = { std::span(mso_sptIrregularSeal2Vert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptIrregularSeal2TextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3895,9 +3895,9 @@ const SvxMSDffHandle mso_sptSealHandle[] = const mso_CustomShape msoSeal4 = { std::span(mso_sptSeal4Vert), - nullptr, 0, + std::span(), std::span(mso_sptSeal4Calc), - const_cast(mso_sptDefault8100), + std::span(mso_sptDefault8100), std::span(mso_sptSeal4TextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -3923,9 +3923,9 @@ const SvxMSDffVertPair mso_sptStarGluePoints[] = const mso_CustomShape msoStar = { std::span(mso_sptStarVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptStarTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -4052,9 +4052,9 @@ const SvxMSDffTextRectangles mso_sptSealTextRect[] = const mso_CustomShape msoSeal8 = { std::span(mso_sptSeal8Vert), - nullptr, 0, + std::span(), std::span(mso_sptSeal24Calc), - const_cast(mso_sptDefault2500), + std::span(mso_sptDefault2500), std::span(mso_sptSealTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -4148,9 +4148,9 @@ const SvxMSDffCalculationData mso_sptSeal16Calc[] = const mso_CustomShape msoSeal16 = { std::span(mso_sptSeal16Vert), - nullptr, 0, + std::span(), std::span(mso_sptSeal16Calc), - const_cast(mso_sptDefault2500), + std::span(mso_sptDefault2500), std::span(mso_sptSealTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -4176,9 +4176,9 @@ const SvxMSDffVertPair mso_sptSeal24Vert[] = const mso_CustomShape msoSeal24 = { std::span(mso_sptSeal24Vert), - nullptr, 0, + std::span(), std::span(mso_sptSeal24Calc), - const_cast(mso_sptDefault2500), + std::span(mso_sptDefault2500), std::span(mso_sptSealTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -4344,9 +4344,9 @@ const SvxMSDffVertPair mso_sptSeal32Vert[] = const mso_CustomShape msoSeal32 = { std::span(mso_sptSeal32Vert), - nullptr, 0, + std::span(), std::span(mso_sptSeal32Calc), - const_cast(mso_sptDefault2500), + std::span(mso_sptDefault2500), std::span(mso_sptSealTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -4441,9 +4441,9 @@ const SvxMSDffHandle mso_sptRibbon2Handle[] = const mso_CustomShape msoRibbon2 = { std::span(mso_sptRibbon2Vert), - const_cast(mso_sptRibbon2Segm), sizeof( mso_sptRibbon2Segm ) >> 1, + std::span(mso_sptRibbon2Segm), std::span(mso_sptRibbon2Calc), - const_cast(mso_sptRibbon2Default), + std::span(mso_sptRibbon2Default), std::span(mso_sptRibbon2TextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -4522,9 +4522,9 @@ const SvxMSDffHandle mso_sptRibbonHandle[] = const mso_CustomShape msoRibbon = { std::span(mso_sptRibbonVert), - const_cast(mso_sptRibbonSegm), sizeof( mso_sptRibbonSegm ) >> 1, + std::span(mso_sptRibbonSegm), std::span(mso_sptRibbonCalc), - const_cast(mso_sptRibbonDefault), + std::span(mso_sptRibbonDefault), std::span(mso_sptRibbonTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -4645,9 +4645,9 @@ const SvxMSDffHandle mso_sptEllipseRibbonHandle[] = const mso_CustomShape msosptEllipseRibbon = { std::span(mso_sptEllipseRibbonVert), - const_cast(mso_sptEllipseRibbonSegm), sizeof( mso_sptEllipseRibbonSegm ) >> 1, + std::span(mso_sptEllipseRibbonSegm), std::span(mso_sptEllipseRibbonCalc), - const_cast(mso_sptEllipseRibbonDefault), + std::span(mso_sptEllipseRibbonDefault), std::span(mso_sptEllipseRibbonTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -4761,9 +4761,9 @@ const SvxMSDffHandle mso_sptEllipseRibbon2Handle[] = const mso_CustomShape msosptEllipseRibbon2 = { std::span(mso_sptEllipseRibbon2Vert), - const_cast(mso_sptEllipseRibbon2Segm), sizeof( mso_sptEllipseRibbon2Segm ) >> 1, + std::span(mso_sptEllipseRibbon2Segm), std::span(mso_sptEllipseRibbon2Calc), - const_cast(mso_sptEllipseRibbon2Default), + std::span(mso_sptEllipseRibbon2Default), std::span(mso_sptEllipseRibbon2TextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -4827,9 +4827,9 @@ const SvxMSDffHandle mso_sptVerticalScrollHandle[] = const mso_CustomShape msoVerticalScroll = { std::span(mso_sptVerticalScrollVert), - const_cast(mso_sptVerticalScrollSegm), sizeof( mso_sptVerticalScrollSegm ) >> 1, + std::span(mso_sptVerticalScrollSegm), std::span(mso_sptScrollCalc), - const_cast(mso_sptDefault2700), + std::span(mso_sptDefault2700), std::span(mso_sptScrollTextRect), 21600, 21600, 11000, 10800, @@ -4873,9 +4873,9 @@ const SvxMSDffHandle mso_sptHorizontalScrollHandle[] = const mso_CustomShape msoHorizontalScroll = { std::span(mso_sptHorizontalScrollVert), - const_cast(mso_sptHorizontalScrollSegm), sizeof( mso_sptHorizontalScrollSegm ) >> 1, + std::span(mso_sptHorizontalScrollSegm), std::span(mso_sptScrollCalc), - const_cast(mso_sptDefault2700), + std::span(mso_sptDefault2700), std::span(mso_sptScrollTextRect), 21600, 21600, 10800, 11000, @@ -4890,9 +4890,9 @@ const SvxMSDffVertPair mso_sptFlowChartProcessVert[] = const mso_CustomShape msoFlowChartProcess = { std::span(mso_sptFlowChartProcessVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -4927,9 +4927,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartAlternateProcessTextRect[] = const mso_CustomShape msoFlowChartAlternateProcess = { std::span(mso_sptFlowChartAlternateProcessVert), - const_cast(mso_sptFlowChartAlternateProcessSegm), sizeof( mso_sptFlowChartAlternateProcessSegm ) >> 1, + std::span(mso_sptFlowChartAlternateProcessSegm), std::span(mso_sptFlowChartAlternateProcessCalc), - nullptr, + std::span(), std::span(mso_sptFlowChartAlternateProcessTextRect), 21600, 21600, 10800, 10800, @@ -4948,9 +4948,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartDecisionTextRect[] = const mso_CustomShape msoFlowChartDecision = { std::span(mso_sptFlowChartDecisionVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartDecisionTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -4973,9 +4973,9 @@ const SvxMSDffVertPair mso_sptFlowChartInputOutputGluePoints[] = const mso_CustomShape msoFlowChartInputOutput = { std::span(mso_sptFlowChartInputOutputVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartInputOutputTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5004,9 +5004,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartPredefinedProcessTextRect[] = const mso_CustomShape msoFlowChartPredefinedProcess = { std::span(mso_sptFlowChartPredefinedProcessVert), - const_cast(mso_sptFlowChartPredefinedProcessSegm), sizeof( mso_sptFlowChartPredefinedProcessSegm ) >> 1, + std::span(mso_sptFlowChartPredefinedProcessSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartPredefinedProcessTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5035,9 +5035,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartInternalStorageTextRect[] = const mso_CustomShape msoFlowChartInternalStorage = { std::span(mso_sptFlowChartInternalStorageVert), - const_cast(mso_sptFlowChartInternalStorageSegm), sizeof( mso_sptFlowChartInternalStorageSegm ) >> 1, + std::span(mso_sptFlowChartInternalStorageSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartInternalStorageTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5066,9 +5066,9 @@ const SvxMSDffVertPair mso_sptFlowChartDocumentGluePoints[] = const mso_CustomShape msoFlowChartDocument = { std::span(mso_sptFlowChartDocumentVert), - const_cast(mso_sptFlowChartDocumentSegm), sizeof( mso_sptFlowChartDocumentSegm ) >> 1, + std::span(mso_sptFlowChartDocumentSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartDocumentTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5105,9 +5105,9 @@ const SvxMSDffVertPair mso_sptFlowChartMultidocumentGluePoints[] = const mso_CustomShape msoFlowChartMultidocument = { std::span(mso_sptFlowChartMultidocumentVert), - const_cast(mso_sptFlowChartMultidocumentSegm), sizeof( mso_sptFlowChartMultidocumentSegm ) >> 1, + std::span(mso_sptFlowChartMultidocumentSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartMultidocumentTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5131,9 +5131,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartTerminatorTextRect[] = const mso_CustomShape msoFlowChartTerminator = { std::span(mso_sptFlowChartTerminatorVert), - const_cast(mso_sptFlowChartTerminatorSegm), sizeof( mso_sptFlowChartTerminatorSegm ) >> 1, + std::span(mso_sptFlowChartTerminatorSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartTerminatorTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5153,9 +5153,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartPreparationTextRect[] = const mso_CustomShape msoFlowChartPreparation = { std::span(mso_sptFlowChartPreparationVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartPreparationTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5178,9 +5178,9 @@ const SvxMSDffVertPair mso_sptFlowChartManualInputGluePoints[] = const mso_CustomShape msoFlowChartManualInput = { std::span(mso_sptFlowChartManualInputVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartManualInputTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5203,9 +5203,9 @@ const SvxMSDffVertPair mso_sptFlowChartManualOperationGluePoints[] = const mso_CustomShape msoFlowChartManualOperation = { std::span(mso_sptFlowChartManualOperationVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartManualOperationTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5228,9 +5228,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartConnectorTextRect[] = const mso_CustomShape msoFlowChartConnector = { std::span(mso_sptFlowChartConnectorVert), - const_cast(mso_sptFlowChartConnectorSegm), sizeof( mso_sptFlowChartConnectorSegm ) >> 1, + std::span(mso_sptFlowChartConnectorSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartConnectorTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5250,9 +5250,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartOffpageConnectorTextRect[] = const mso_CustomShape msoFlowChartOffpageConnector = { std::span(mso_sptFlowChartOffpageConnectorVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartOffpageConnectorTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5272,9 +5272,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartPunchedCardTextRect[] = const mso_CustomShape msoFlowChartPunchedCard = { std::span(mso_sptFlowChartPunchedCardVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartPunchedCardTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5310,9 +5310,9 @@ const SvxMSDffVertPair mso_sptFlowChartPunchedTapeGluePoints[] = const mso_CustomShape msoFlowChartPunchedTape = { std::span(mso_sptFlowChartPunchedTapeVert), - const_cast(mso_sptFlowChartPunchedTapeSegm), sizeof( mso_sptFlowChartPunchedTapeSegm ) >> 1, + std::span(mso_sptFlowChartPunchedTapeSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartPunchedTapeTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5343,9 +5343,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartSummingJunctionTextRect[] = const mso_CustomShape msoFlowChartSummingJunction = { std::span(mso_sptFlowChartSummingJunctionVert), - const_cast(mso_sptFlowChartSummingJunctionSegm), sizeof( mso_sptFlowChartSummingJunctionSegm ) >> 1, + std::span(mso_sptFlowChartSummingJunctionSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartSummingJunctionTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5374,9 +5374,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartOrTextRect[] = const mso_CustomShape msoFlowChartOr = { std::span(mso_sptFlowChartOrVert), - const_cast(mso_sptFlowChartOrSegm), sizeof( mso_sptFlowChartOrSegm ) >> 1, + std::span(mso_sptFlowChartOrSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartOrTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5399,9 +5399,9 @@ const SvxMSDffVertPair mso_sptFlowChartCollateGluePoints[] = const mso_CustomShape msoFlowChartCollate = { std::span(mso_sptFlowChartCollateVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartCollateTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5427,9 +5427,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartSortTextRect[] = const mso_CustomShape msoFlowChartSort = { std::span(mso_sptFlowChartSortVert), - const_cast(mso_sptFlowChartSortSegm), sizeof( mso_sptFlowChartSortSegm ) >> 1, + std::span(mso_sptFlowChartSortSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartSortTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5452,9 +5452,9 @@ const SvxMSDffVertPair mso_sptFlowChartExtractGluePoints[] = const mso_CustomShape msoFlowChartExtract = { std::span(mso_sptFlowChartExtractVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartExtractTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5473,9 +5473,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartMergeTextRect[] = const mso_CustomShape msoFlowChartMerge = { std::span(mso_sptFlowChartMergeVert), - nullptr, 0, + std::span(), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartMergeTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5503,9 +5503,9 @@ const SvxMSDffVertPair mso_sptFlowChartOnlineStorageGluePoints[] = const mso_CustomShape msoFlowChartOnlineStorage = { std::span(mso_sptFlowChartOnlineStorageVert), - const_cast(mso_sptFlowChartOnlineStorageSegm), sizeof( mso_sptFlowChartOnlineStorageSegm ) >> 1, + std::span(mso_sptFlowChartOnlineStorageSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartOnlineStorageTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5529,9 +5529,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartDelayTextRect[] = const mso_CustomShape msoFlowChartDelay = { std::span(mso_sptFlowChartDelayVert), - const_cast(mso_sptFlowChartDelaySegm), sizeof( mso_sptFlowChartDelaySegm ) >> 1, + std::span(mso_sptFlowChartDelaySegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartDelayTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5558,9 +5558,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartMagneticTapeTextRect[] = const mso_CustomShape msoFlowChartMagneticTape = { std::span(mso_sptFlowChartMagneticTapeVert), - const_cast(mso_sptFlowChartMagneticTapeSegm), sizeof( mso_sptFlowChartMagneticTapeSegm ) >> 1, + std::span(mso_sptFlowChartMagneticTapeSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartMagneticTapeTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5591,9 +5591,9 @@ const SvxMSDffVertPair mso_sptFlowChartMagneticDiskGluePoints[] = const mso_CustomShape msoFlowChartMagneticDisk = { std::span(mso_sptFlowChartMagneticDiskVert), - const_cast(mso_sptFlowChartMagneticDiskSegm), sizeof( mso_sptFlowChartMagneticDiskSegm ) >> 1, + std::span(mso_sptFlowChartMagneticDiskSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartMagneticDiskTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5624,9 +5624,9 @@ const SvxMSDffVertPair mso_sptFlowChartMagneticDrumGluePoints[] = const mso_CustomShape msoFlowChartMagneticDrum = { std::span(mso_sptFlowChartMagneticDrumVert), - const_cast(mso_sptFlowChartMagneticDrumSegm), sizeof( mso_sptFlowChartMagneticDrumSegm ) >> 1, + std::span(mso_sptFlowChartMagneticDrumSegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartMagneticDrumTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5650,9 +5650,9 @@ const SvxMSDffTextRectangles mso_sptFlowChartDisplayTextRect[] = const mso_CustomShape msoFlowChartDisplay = { std::span(mso_sptFlowChartDisplayVert), - const_cast(mso_sptFlowChartDisplaySegm), sizeof( mso_sptFlowChartDisplaySegm ) >> 1, + std::span(mso_sptFlowChartDisplaySegm), std::span(), - nullptr, + std::span(), std::span(mso_sptFlowChartDisplayTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5743,9 +5743,9 @@ const SvxMSDffHandle mso_sptCalloutHandle[] = const mso_CustomShape msoWedgeRectCallout = { std::span(mso_sptWedgeRectCalloutVert), - nullptr, 0, + std::span(), std::span(mso_sptWedgeRectCalloutCalc), - const_cast(mso_sptWedgeRectCalloutDefault), + std::span(mso_sptWedgeRectCalloutDefault), std::span(mso_sptWedgeRectCalloutTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5779,9 +5779,9 @@ const SvxMSDffTextRectangles mso_sptWedgeRRectCalloutTextRect[] = const mso_CustomShape msoWedgeRRectCallout = { std::span(mso_sptWedgeRRectCalloutVert), - const_cast(mso_sptWedgeRRectCalloutSegm), sizeof( mso_sptWedgeRRectCalloutSegm ) >> 1, + std::span(mso_sptWedgeRRectCalloutSegm), std::span(mso_sptWedgeRectCalloutCalc), - const_cast(mso_sptWedgeRectCalloutDefault), + std::span(mso_sptWedgeRectCalloutDefault), std::span(mso_sptWedgeRRectCalloutTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5818,9 +5818,9 @@ const SvxMSDffTextRectangles mso_sptBalloonTextRect[] = const mso_CustomShape msoBalloon = { std::span(mso_sptBalloonVert), - const_cast(mso_sptBalloonSegm), sizeof( mso_sptBalloonSegm ) >> 1, + std::span(mso_sptBalloonSegm), std::span(mso_sptWedgeRectCalloutCalc), - const_cast(mso_sptWedgeRectCalloutDefault), + std::span(mso_sptWedgeRectCalloutDefault), std::span(mso_sptBalloonTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5877,9 +5877,9 @@ const SvxMSDffTextRectangles mso_sptWedgeEllipseCalloutTextRect[] = const mso_CustomShape msoWedgeEllipseCallout = { std::span(mso_sptWedgeEllipseCalloutVert), - const_cast(mso_sptWedgeEllipseCalloutSegm), sizeof( mso_sptWedgeEllipseCalloutSegm ) >> 1, + std::span(mso_sptWedgeEllipseCalloutSegm), std::span(mso_sptWedgeEllipseCalloutCalc), - const_cast(mso_sptWedgeEllipseCalloutDefault), + std::span(mso_sptWedgeEllipseCalloutDefault), std::span(mso_sptWedgeEllipseCalloutTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -5982,9 +5982,9 @@ const SvxMSDffTextRectangles mso_sptCloudCalloutTextRect[] = const mso_CustomShape msoCloudCallout = { std::span(mso_sptCloudCalloutVert), - const_cast(mso_sptCloudCalloutSegm), sizeof( mso_sptCloudCalloutSegm ) >> 1, + std::span(mso_sptCloudCalloutSegm), std::span(mso_sptCloudCalloutCalc), - const_cast(mso_sptCloudCalloutDefault), + std::span(mso_sptCloudCalloutDefault), std::span(mso_sptCloudCalloutTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6060,9 +6060,9 @@ const SvxMSDffTextRectangles mso_sptWaveTextRect[] = const mso_CustomShape msoWave = { std::span(mso_sptWaveVert), - const_cast(mso_sptWaveSegm), sizeof( mso_sptWaveSegm ) >> 1, + std::span(mso_sptWaveSegm), std::span(mso_sptWaveCalc), - const_cast(mso_sptWaveDefault), + std::span(mso_sptWaveDefault), std::span(mso_sptWaveTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6142,9 +6142,9 @@ const SvxMSDffTextRectangles mso_sptDoubleWaveTextRect[] = const mso_CustomShape msoDoubleWave = { std::span(mso_sptDoubleWaveVert), - const_cast(mso_sptDoubleWaveSegm), sizeof( mso_sptDoubleWaveSegm ) >> 1, + std::span(mso_sptDoubleWaveSegm), std::span(mso_sptDoubleWaveCalc), - const_cast(mso_sptDoubleWaveDefault), + std::span(mso_sptDoubleWaveDefault), std::span(mso_sptDoubleWaveTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6258,9 +6258,9 @@ const SvxMSDffHandle mso_sptTextPlainTextHandle[] = const mso_CustomShape msoTextPlainText = { std::span(mso_sptTextPlainTextVert), - const_cast(mso_sptTextPlainTextSegm), sizeof( mso_sptTextPlainTextSegm ) >> 1, + std::span(mso_sptTextPlainTextSegm), std::span(mso_sptTextPlainTextCalc), - const_cast(mso_sptDefault10800), + std::span(mso_sptDefault10800), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6295,9 +6295,9 @@ const SvxMSDffHandle mso_sptTextStopHandle[] = const mso_CustomShape msoTextStop = { std::span(mso_sptTextStopVert), - const_cast(mso_sptTextStopSegm), sizeof( mso_sptTextStopSegm ) >> 1, + std::span(mso_sptTextStopSegm), std::span(mso_sptTextStopCalc), - const_cast(mso_sptTextStopDefault), + std::span(mso_sptTextStopDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6326,9 +6326,9 @@ const SvxMSDffHandle mso_sptTextTriangleHandle[] = const mso_CustomShape msoTextTriangle = { std::span(mso_sptTextTriangleVert), - const_cast(mso_sptTextTriangleSegm), sizeof( mso_sptTextTriangleSegm ) >> 1, + std::span(mso_sptTextTriangleSegm), std::span(mso_sptTextTriangleCalc), - const_cast(mso_sptDefault10800), + std::span(mso_sptDefault10800), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6347,9 +6347,9 @@ const sal_uInt16 mso_sptTextTriangleInvertedSegm[] = const mso_CustomShape msoTextTriangleInverted = { std::span(mso_sptTextTriangleInvertedVert), - const_cast(mso_sptTextTriangleInvertedSegm), sizeof( mso_sptTextTriangleInvertedSegm ) >> 1, + std::span(mso_sptTextTriangleInvertedSegm), std::span(mso_sptTextTriangleCalc), - const_cast(mso_sptDefault10800), + std::span(mso_sptDefault10800), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6379,9 +6379,9 @@ const SvxMSDffHandle mso_sptTextChevronHandle[] = const mso_CustomShape msoTextChevron = { std::span(mso_sptTextChevronVert), - const_cast(mso_sptTextChevronSegm), sizeof( mso_sptTextChevronSegm ) >> 1, + std::span(mso_sptTextChevronSegm), std::span(mso_sptTextChevronCalc), - const_cast(mso_sptDefault5400), + std::span(mso_sptDefault5400), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6411,9 +6411,9 @@ const SvxMSDffHandle mso_sptTextChevronInvertedHandle[] = const mso_CustomShape msoTextChevronInverted = { std::span(mso_sptTextChevronInvertedVert), - const_cast(mso_sptTextChevronInvertedSegm), sizeof( mso_sptTextChevronInvertedSegm ) >> 1, + std::span(mso_sptTextChevronInvertedSegm), std::span(mso_sptTextChevronInvertedCalc), - const_cast(mso_sptDefault16200), + std::span(mso_sptDefault16200), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6452,9 +6452,9 @@ const SvxMSDffHandle mso_sptTextRingInsideHandle[] = const mso_CustomShape msoTextRingInside = { std::span(mso_sptTextRingInsideVert), - const_cast(mso_sptTextRingInsideSegm), sizeof( mso_sptTextRingInsideSegm ) >> 1, + std::span(mso_sptTextRingInsideSegm), std::span(mso_sptTextRingInsideCalc), - const_cast(mso_sptDefault13500), + std::span(mso_sptDefault13500), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6487,9 +6487,9 @@ const SvxMSDffHandle mso_sptTextRingOutsideHandle[] = const mso_CustomShape msoTextRingOutside = { std::span(mso_sptTextRingOutsideVert), - const_cast(mso_sptTextRingOutsideSegm), sizeof( mso_sptTextRingOutsideSegm ) >> 1, + std::span(mso_sptTextRingOutsideSegm), std::span(mso_sptTextRingOutsideCalc), - const_cast(mso_sptDefault13500), + std::span(mso_sptDefault13500), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6519,9 +6519,9 @@ const SvxMSDffHandle mso_sptTextFadeRightHandle[] = const mso_CustomShape msoTextFadeRight = { std::span(mso_sptTextFadeRightVert), - const_cast(mso_sptTextFadeSegm), sizeof( mso_sptTextFadeSegm ) >> 1, + std::span(mso_sptTextFadeSegm), std::span(mso_sptTextFadeCalc), - const_cast(mso_sptDefault7200), + std::span(mso_sptDefault7200), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6541,9 +6541,9 @@ const SvxMSDffHandle mso_sptTextFadeLeftHandle[] = const mso_CustomShape msoTextFadeLeft = { std::span(mso_sptTextFadeLeftVert), - const_cast(mso_sptTextFadeSegm), sizeof( mso_sptTextFadeSegm ) >> 1, + std::span(mso_sptTextFadeSegm), std::span(mso_sptTextFadeCalc), - const_cast(mso_sptDefault7200), + std::span(mso_sptDefault7200), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6563,9 +6563,9 @@ const SvxMSDffHandle mso_sptTextFadeUpHandle[] = const mso_CustomShape msoTextFadeUp = { std::span(mso_sptTextFadeUpVert), - const_cast(mso_sptTextFadeSegm), sizeof( mso_sptTextFadeSegm ) >> 1, + std::span(mso_sptTextFadeSegm), std::span(mso_sptTextFadeCalc), - const_cast(mso_sptDefault7200), + std::span(mso_sptDefault7200), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6585,9 +6585,9 @@ const SvxMSDffHandle mso_sptTextFadeDownHandle[] = const mso_CustomShape msoTextFadeDown = { std::span(mso_sptTextFadeDownVert), - const_cast(mso_sptTextFadeSegm), sizeof( mso_sptTextFadeSegm ) >> 1, + std::span(mso_sptTextFadeSegm), std::span(mso_sptTextFadeCalc), - const_cast(mso_sptDefault7200), + std::span(mso_sptDefault7200), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6607,9 +6607,9 @@ const SvxMSDffHandle mso_sptTextSlantUpHandle[] = const mso_CustomShape msoTextSlantUp = { std::span(mso_sptTextSlantUpVert), - const_cast(mso_sptTextFadeSegm), sizeof( mso_sptTextFadeSegm ) >> 1, + std::span(mso_sptTextFadeSegm), std::span(mso_sptTextFadeCalc), - const_cast(mso_sptDefault12000), + std::span(mso_sptDefault12000), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6629,9 +6629,9 @@ const SvxMSDffHandle mso_sptTextSlantDownHandle[] = const mso_CustomShape msoTextSlantDown = { std::span(mso_sptTextSlantDownVert), - const_cast(mso_sptTextFadeSegm), sizeof( mso_sptTextFadeSegm ) >> 1, + std::span(mso_sptTextFadeSegm), std::span(mso_sptTextFadeCalc), - const_cast(mso_sptDefault12000), + std::span(mso_sptDefault12000), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6657,9 +6657,9 @@ const SvxMSDffHandle mso_sptTextCascadeUpHandle[] = const mso_CustomShape msoTextCascadeUp = { std::span(mso_sptTextCascadeUpVert), - const_cast(mso_sptTextFadeSegm), sizeof( mso_sptTextFadeSegm ) >> 1, + std::span(mso_sptTextFadeSegm), std::span(mso_sptTextCascadeCalc), - const_cast(mso_sptDefault9600), + std::span(mso_sptDefault9600), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6679,9 +6679,9 @@ const SvxMSDffHandle mso_sptTextCascadeDownHandle[] = const mso_CustomShape msoTextCascadeDown = { std::span(mso_sptTextCascadeDownVert), - const_cast(mso_sptTextFadeSegm), sizeof( mso_sptTextFadeSegm ) >> 1, + std::span(mso_sptTextFadeSegm), std::span(mso_sptTextCascadeCalc), - const_cast(mso_sptDefault9600), + std::span(mso_sptDefault9600), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6717,9 +6717,9 @@ const sal_Int32 mso_sptTextArchUpCurveDefault[] = const mso_CustomShape msoTextArchUpCurve = { std::span(mso_sptTextArchUpCurveVert), - const_cast(mso_sptTextArchUpCurveSegm), sizeof( mso_sptTextArchUpCurveSegm ) >> 1, + std::span(mso_sptTextArchUpCurveSegm), std::span(mso_sptTextArchCurveCalc), - const_cast(mso_sptTextArchUpCurveDefault), + std::span(mso_sptTextArchUpCurveDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6747,9 +6747,9 @@ const sal_Int32 mso_sptTextArchDownCurveDefault[] = const mso_CustomShape msoTextArchDownCurve = { std::span(mso_sptTextArchDownCurveVert), - const_cast(mso_sptTextArchDownCurveSegm), sizeof( mso_sptTextArchDownCurveSegm ) >> 1, + std::span(mso_sptTextArchDownCurveSegm), std::span(mso_sptTextArchCurveCalc), - const_cast(mso_sptTextArchDownCurveDefault), + std::span(mso_sptTextArchDownCurveDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6785,9 +6785,9 @@ const sal_Int32 mso_sptTextCircleCurveDefault[] = const mso_CustomShape msoTextCircleCurve = { std::span(mso_sptTextCircleCurveVert), - const_cast(mso_sptTextCircleCurveSegm), sizeof( mso_sptTextCircleCurveSegm ) >> 1, + std::span(mso_sptTextCircleCurveSegm), std::span(mso_sptTextCircleCurveCalc), - const_cast(mso_sptTextCircleCurveDefault), + std::span(mso_sptTextCircleCurveDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6828,9 +6828,9 @@ const sal_Int32 mso_sptTextButtonCurveDefault[] = const mso_CustomShape msoTextButtonCurve = { std::span(mso_sptTextButtonCurveVert), - const_cast(mso_sptTextButtonCurveSegm), sizeof( mso_sptTextButtonCurveSegm ) >> 1, + std::span(mso_sptTextButtonCurveSegm), std::span(mso_sptTextButtonCurveCalc), - const_cast(mso_sptTextButtonCurveDefault), + std::span(mso_sptTextButtonCurveDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6874,9 +6874,9 @@ const sal_Int32 mso_sptTextArchUpPourDefault[] = const mso_CustomShape msoTextArchUpPour = { std::span(mso_sptTextArchUpPourVert), - const_cast(mso_sptTextArchUpPourSegm), sizeof( mso_sptTextArchUpPourSegm ) >> 1, + std::span(mso_sptTextArchUpPourSegm), std::span(mso_sptTextArchPourCalc), - const_cast(mso_sptTextArchUpPourDefault), + std::span(mso_sptTextArchUpPourDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6900,9 +6900,9 @@ const sal_Int32 mso_sptTextArchDownPourDefault[] = const mso_CustomShape msoTextArchDownPour = { std::span(mso_sptTextArchDownPourVert), - const_cast(mso_sptTextArchDownPourSegm), sizeof( mso_sptTextArchDownPourSegm ) >> 1, + std::span(mso_sptTextArchDownPourSegm), std::span(mso_sptTextArchPourCalc), - const_cast(mso_sptTextArchDownPourDefault), + std::span(mso_sptTextArchDownPourDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -6947,9 +6947,9 @@ const sal_Int32 mso_sptTextCirclePourDefault[] = const mso_CustomShape msoTextCirclePour = { std::span(mso_sptTextCirclePourVert), - const_cast(mso_sptTextCirclePourSegm), sizeof( mso_sptTextCirclePourSegm ) >> 1, + std::span(mso_sptTextCirclePourSegm), std::span(mso_sptTextCirclePourCalc), - const_cast(mso_sptTextCirclePourDefault), + std::span(mso_sptTextCirclePourDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7015,9 +7015,9 @@ const sal_Int32 mso_sptTextButtonPourDefault[] = const mso_CustomShape msoTextButtonPour = { std::span(mso_sptTextButtonPourVert), - const_cast(mso_sptTextButtonPourSegm), sizeof( mso_sptTextButtonPourSegm ) >> 1, + std::span(mso_sptTextButtonPourSegm), std::span(mso_sptTextButtonPourCalc), - const_cast(mso_sptTextButtonPourDefault), + std::span(mso_sptTextButtonPourDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7055,9 +7055,9 @@ const sal_Int32 mso_sptTextCurveUpDefault[] = const mso_CustomShape msoTextCurveUp = { std::span(mso_sptTextCurveUpVert), - const_cast(mso_sptTextCurveUpSegm), sizeof( mso_sptTextCurveUpSegm ) >> 1, + std::span(mso_sptTextCurveUpSegm), std::span(mso_sptTextCurveUpCalc), - const_cast(mso_sptTextCurveUpDefault), + std::span(mso_sptTextCurveUpDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7081,9 +7081,9 @@ const SvxMSDffHandle mso_sptTextCurveDownHandle[] = const mso_CustomShape msoTextCurveDown = { std::span(mso_sptTextCurveDownVert), - const_cast(mso_sptTextCurveUpSegm), sizeof( mso_sptTextCurveUpSegm ) >> 1, + std::span(mso_sptTextCurveUpSegm), std::span(mso_sptTextCurveUpCalc), - const_cast(mso_sptTextCurveUpDefault), + std::span(mso_sptTextCurveUpDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7121,9 +7121,9 @@ const sal_Int32 mso_sptTextCanUpDefault[] = const mso_CustomShape msoTextCanUp = { std::span(mso_sptTextCanUpVert), - const_cast(mso_sptTextCanUpSegm), sizeof( mso_sptTextCanUpSegm ) >> 1, + std::span(mso_sptTextCanUpSegm), std::span(mso_sptTextCanUpCalc), - const_cast(mso_sptTextCanUpDefault), + std::span(mso_sptTextCanUpDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7154,9 +7154,9 @@ const sal_Int32 mso_sptTextCanDownDefault[] = const mso_CustomShape msoTextCanDown = { std::span(mso_sptTextCanDownVert), - const_cast(mso_sptTextCanUpSegm), sizeof( mso_sptTextCanUpSegm ) >> 1, + std::span(mso_sptTextCanUpSegm), std::span(mso_sptTextCanDownCalc), - const_cast(mso_sptTextCanDownDefault), + std::span(mso_sptTextCanDownDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7188,9 +7188,9 @@ const sal_Int32 mso_sptTextInflateDefault[] = const mso_CustomShape msoTextInflate = { std::span(mso_sptTextInflateVert), - const_cast(mso_sptTextCanUpSegm), sizeof( mso_sptTextCanUpSegm ) >> 1, + std::span(mso_sptTextCanUpSegm), std::span(mso_sptTextInflateCalc), - const_cast(mso_sptTextInflateDefault), + std::span(mso_sptTextInflateDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7218,9 +7218,9 @@ const SvxMSDffHandle mso_sptTextDeflateHandle[] = const mso_CustomShape msoTextDeflate = { std::span(mso_sptTextDeflateVert), - const_cast(mso_sptTextCanUpSegm), sizeof( mso_sptTextCanUpSegm ) >> 1, + std::span(mso_sptTextCanUpSegm), std::span(mso_sptTextDeflateCalc), - const_cast(mso_sptDefault8100), + std::span(mso_sptDefault8100), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7257,9 +7257,9 @@ const sal_Int32 mso_sptTextInflateBottomDefault[] = const mso_CustomShape msoTextInflateBottom = { std::span(mso_sptTextInflateBottomVert), - const_cast(mso_sptTextInflateBottomSegm), sizeof( mso_sptTextInflateBottomSegm ) >> 1, + std::span(mso_sptTextInflateBottomSegm), std::span(mso_sptTextInflateBottomCalc), - const_cast(mso_sptTextInflateBottomDefault), + std::span(mso_sptTextInflateBottomDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7296,9 +7296,9 @@ const sal_Int32 mso_sptTextDeflateBottomDefault[] = const mso_CustomShape msoTextDeflateBottom = { std::span(mso_sptTextDeflateBottomVert), - const_cast(mso_sptTextDeflateBottomSegm), sizeof( mso_sptTextDeflateBottomSegm ) >> 1, + std::span(mso_sptTextDeflateBottomSegm), std::span(mso_sptTextDeflateBottomCalc), - const_cast(mso_sptTextDeflateBottomDefault), + std::span(mso_sptTextDeflateBottomDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7333,9 +7333,9 @@ const sal_Int32 mso_sptTextInflateTopDefault[] = const mso_CustomShape msoTextInflateTop = { std::span(mso_sptTextInflateTopVert), - const_cast(mso_sptTextInflateTopSegm), sizeof( mso_sptTextInflateTopSegm ) >> 1, + std::span(mso_sptTextInflateTopSegm), std::span(mso_sptTextInflateTopCalc), - const_cast(mso_sptTextInflateTopDefault), + std::span(mso_sptTextInflateTopDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7370,9 +7370,9 @@ const sal_Int32 mso_sptTextDeflateTopDefault[] = const mso_CustomShape msoTextDeflateTop = { std::span(mso_sptTextDeflateTopVert), - const_cast(mso_sptTextDeflateTopSegm), sizeof( mso_sptTextDeflateTopSegm ) >> 1, + std::span(mso_sptTextDeflateTopSegm), std::span(mso_sptTextDeflateTopCalc), - const_cast(mso_sptTextDeflateTopDefault), + std::span(mso_sptTextDeflateTopDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7416,9 +7416,9 @@ const sal_Int32 mso_sptTextDeflateInflateDefault[] = const mso_CustomShape msoTextDeflateInflate = { std::span(mso_sptTextDeflateInflateVert), - const_cast(mso_sptTextDeflateInflateSegm), sizeof( mso_sptTextDeflateInflateSegm ) >> 1, + std::span(mso_sptTextDeflateInflateSegm), std::span(mso_sptTextDeflateInflateCalc), - const_cast(mso_sptTextDeflateInflateDefault), + std::span(mso_sptTextDeflateInflateDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7470,9 +7470,9 @@ const sal_Int32 mso_sptTextDeflateInflateDeflateDefault[] = const mso_CustomShape msoTextDeflateInflateDeflate = { std::span(mso_sptTextDeflateInflateDeflateVert), - const_cast(mso_sptTextDeflateInflateDeflateSegm), sizeof( mso_sptTextDeflateInflateDeflateSegm ) >> 1, + std::span(mso_sptTextDeflateInflateDeflateSegm), std::span(mso_sptTextDeflateInflateDeflateCalc), - const_cast(mso_sptTextDeflateInflateDeflateDefault), + std::span(mso_sptTextDeflateInflateDeflateDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7493,9 +7493,9 @@ const sal_uInt16 mso_sptTextWave1Segm[] = const mso_CustomShape msoTextWave1 = { std::span(mso_sptTextWave1Vert), - const_cast(mso_sptTextWave1Segm), sizeof( mso_sptTextWave1Segm ) >> 1, + std::span(mso_sptTextWave1Segm), std::span(mso_sptWaveCalc), - const_cast(mso_sptWaveDefault), + std::span(mso_sptWaveDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7511,9 +7511,9 @@ const SvxMSDffVertPair mso_sptTextWave2Vert[] = // adjustment1 : 0 - 4459 const mso_CustomShape msoTextWave2 = { std::span(mso_sptTextWave2Vert), - const_cast(mso_sptTextWave1Segm), sizeof( mso_sptTextWave1Segm ) >> 1, + std::span(mso_sptTextWave1Segm), std::span(mso_sptWaveCalc), - const_cast(mso_sptWaveDefault), + std::span(mso_sptWaveDefault), std::span(mso_sptFontWorkTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7534,9 +7534,9 @@ const sal_uInt16 mso_sptTextWave3Segm[] = const mso_CustomShape msoTextWave3 = { std::span(mso_sptTextWave3Vert), - const_cast(mso_sptTextWave3Segm), sizeof( mso_sptTextWave3Segm ) >> 1, + std::span(mso_sptTextWave3Segm), std::span(mso_sptDoubleWaveCalc), - const_cast(mso_sptDoubleWaveDefault), + std::span(mso_sptDoubleWaveDefault), std::span(mso_sptDoubleWaveTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7552,9 +7552,9 @@ const SvxMSDffVertPair mso_sptTextWave4Vert[] = // adjustment1 : 0 - 2230 const mso_CustomShape msoTextWave4 = { std::span(mso_sptTextWave4Vert), - const_cast(mso_sptTextWave3Segm), sizeof( mso_sptTextWave3Segm ) >> 1, + std::span(mso_sptTextWave3Segm), std::span(mso_sptDoubleWaveCalc), - const_cast(mso_sptDoubleWaveDefault), + std::span(mso_sptDoubleWaveDefault), std::span(mso_sptDoubleWaveTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7719,9 +7719,9 @@ const SvxMSDffCalculationData mso_sptCalloutCalc[] = const mso_CustomShape msoCallout90 = { std::span(mso_sptCalloutVert1), - const_cast(mso_sptCalloutSegm1b), sizeof( mso_sptCalloutSegm1b ) >> 1, + std::span(mso_sptCalloutSegm1b), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault1), + std::span(mso_sptCalloutDefault1), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7731,9 +7731,9 @@ const mso_CustomShape msoCallout90 = const mso_CustomShape msoCallout1 = { std::span(mso_sptCalloutVert1), - const_cast(mso_sptCalloutSegm1b), sizeof( mso_sptCalloutSegm1b ) >> 1, + std::span(mso_sptCalloutSegm1b), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault2), + std::span(mso_sptCalloutDefault2), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7743,9 +7743,9 @@ const mso_CustomShape msoCallout1 = const mso_CustomShape msoCallout2 = { std::span(mso_sptCallout2Verta), - const_cast(mso_sptCallout2Segm1b), sizeof( mso_sptCallout2Segm1b ) >> 1, + std::span(mso_sptCallout2Segm1b), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault3), + std::span(mso_sptCalloutDefault3), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7755,9 +7755,9 @@ const mso_CustomShape msoCallout2 = const mso_CustomShape msoCallout3 = { std::span(mso_sptCallout3Verta), - const_cast(mso_sptCallout3Segm1b), sizeof( mso_sptCallout3Segm1b ) >> 1, + std::span(mso_sptCallout3Segm1b), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault4), + std::span(mso_sptCalloutDefault4), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7767,9 +7767,9 @@ const mso_CustomShape msoCallout3 = const mso_CustomShape msoAccentCallout90 = { std::span(mso_sptCalloutVert1), - const_cast(mso_sptCalloutSegm1b), sizeof( mso_sptCalloutSegm1b ) >> 1, + std::span(mso_sptCalloutSegm1b), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault1), + std::span(mso_sptCalloutDefault1), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7779,9 +7779,9 @@ const mso_CustomShape msoAccentCallout90 = const mso_CustomShape msoAccentCallout1 = { std::span(mso_sptCallout1Vert), - const_cast(mso_sptCallout1Segm1b), sizeof( mso_sptCallout1Segm1b ) >> 1, + std::span(mso_sptCallout1Segm1b), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault2), + std::span(mso_sptCalloutDefault2), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7791,9 +7791,9 @@ const mso_CustomShape msoAccentCallout1 = const mso_CustomShape msoAccentCallout2 = { std::span(mso_sptCallout2Vertb), - const_cast(mso_sptCallout2Segm1d), sizeof( mso_sptCallout2Segm1d ) >> 1, + std::span(mso_sptCallout2Segm1d), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault3), + std::span(mso_sptCalloutDefault3), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7803,9 +7803,9 @@ const mso_CustomShape msoAccentCallout2 = const mso_CustomShape msoAccentCallout3 = { std::span(mso_sptCallout3Vertb), - const_cast(mso_sptCallout3Segm1d), sizeof( mso_sptCallout3Segm1d ) >> 1, + std::span(mso_sptCallout3Segm1d), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault4), + std::span(mso_sptCalloutDefault4), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7815,9 +7815,9 @@ const mso_CustomShape msoAccentCallout3 = const mso_CustomShape msoBorderCallout90 = { std::span(mso_sptCalloutVert1), - const_cast(mso_sptCalloutSegm1a), sizeof( mso_sptCalloutSegm1a ) >> 1, + std::span(mso_sptCalloutSegm1a), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault1), + std::span(mso_sptCalloutDefault1), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7827,9 +7827,9 @@ const mso_CustomShape msoBorderCallout90 = const mso_CustomShape msoBorderCallout1 = { std::span(mso_sptCalloutVert1), - const_cast(mso_sptCalloutSegm1a), sizeof( mso_sptCalloutSegm1a ) >> 1, + std::span(mso_sptCalloutSegm1a), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault2), + std::span(mso_sptCalloutDefault2), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7839,9 +7839,9 @@ const mso_CustomShape msoBorderCallout1 = const mso_CustomShape msoBorderCallout2 = { std::span(mso_sptCallout2Verta), - const_cast(mso_sptCallout2Segm1a), sizeof( mso_sptCallout2Segm1a ) >> 1, + std::span(mso_sptCallout2Segm1a), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault3), + std::span(mso_sptCalloutDefault3), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7851,9 +7851,9 @@ const mso_CustomShape msoBorderCallout2 = const mso_CustomShape msoBorderCallout3 = { std::span(mso_sptCallout3Verta), - const_cast(mso_sptCallout3Segm1a), sizeof( mso_sptCallout3Segm1a ) >> 1, + std::span(mso_sptCallout3Segm1a), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault4), + std::span(mso_sptCalloutDefault4), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7863,9 +7863,9 @@ const mso_CustomShape msoBorderCallout3 = const mso_CustomShape msoAccentBorderCallout90 = { std::span(mso_sptCalloutVert1), - const_cast(mso_sptCalloutSegm1a), sizeof( mso_sptCalloutSegm1a ) >> 1, + std::span(mso_sptCalloutSegm1a), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault1), + std::span(mso_sptCalloutDefault1), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7875,9 +7875,9 @@ const mso_CustomShape msoAccentBorderCallout90 = const mso_CustomShape msoAccentBorderCallout1 = { std::span(mso_sptCallout1Vert), - const_cast(mso_sptCallout1Segm1a), sizeof( mso_sptCallout1Segm1a ) >> 1, + std::span(mso_sptCallout1Segm1a), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault2), + std::span(mso_sptCalloutDefault2), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7887,9 +7887,9 @@ const mso_CustomShape msoAccentBorderCallout1 = const mso_CustomShape msoAccentBorderCallout2 = { std::span(mso_sptCallout2Vertb), - const_cast(mso_sptCallout2Segm1c), sizeof( mso_sptCallout2Segm1c ) >> 1, + std::span(mso_sptCallout2Segm1c), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault3), + std::span(mso_sptCalloutDefault3), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7899,9 +7899,9 @@ const mso_CustomShape msoAccentBorderCallout2 = const mso_CustomShape msoAccentBorderCallout3 = { std::span(mso_sptCallout3Vertb), - const_cast(mso_sptCallout3Segm1c), sizeof( mso_sptCallout3Segm1c ) >> 1, + std::span(mso_sptCallout3Segm1c), std::span(mso_sptCalloutCalc), - const_cast(mso_sptCalloutDefault4), + std::span(mso_sptCalloutDefault4), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7920,9 +7920,9 @@ const sal_uInt16 mso_sptStraightConnector1Segm[] = const mso_CustomShape msoStraightConnector1 = { std::span(mso_sptStraightConnector1Vert), - const_cast(mso_sptStraightConnector1Segm), sizeof( mso_sptStraightConnector1Segm ) >> 1, + std::span(mso_sptStraightConnector1Segm), std::span(), - nullptr, + std::span(), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7941,9 +7941,9 @@ const sal_uInt16 mso_sptBentConnector2Segm[] = const mso_CustomShape msoBentConnector2 = { std::span(mso_sptBentConnector2Vert), - const_cast(mso_sptBentConnector2Segm), sizeof( mso_sptBentConnector2Segm ) >> 1, + std::span(mso_sptBentConnector2Segm), std::span(), - nullptr, + std::span(), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -7975,9 +7975,9 @@ const SvxMSDffHandle mso_sptBentConnector3Handle[] = const mso_CustomShape msoBentConnector3 = { std::span(mso_sptBentConnector3Vert), - const_cast(mso_sptBentConnector3Segm), sizeof( mso_sptBentConnector3Segm ) >> 1, + std::span(mso_sptBentConnector3Segm), std::span(mso_sptBentConnector3Calc), - const_cast(mso_sptBentConnector3Default), + std::span(mso_sptBentConnector3Default), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -8015,9 +8015,9 @@ const SvxMSDffHandle mso_sptBentConnector4Handle[] = const mso_CustomShape msoBentConnector4 = { std::span(mso_sptBentConnector4Vert), - const_cast(mso_sptBentConnector4Segm), sizeof( mso_sptBentConnector4Segm ) >> 1, + std::span(mso_sptBentConnector4Segm), std::span(mso_sptBentConnector4Calc), - const_cast(mso_sptBentConnector4Default), + std::span(mso_sptBentConnector4Default), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -8060,9 +8060,9 @@ const SvxMSDffHandle mso_sptBentConnector5Handle[] = const mso_CustomShape msoBentConnector5 = { std::span(mso_sptBentConnector5Vert), - const_cast(mso_sptBentConnector5Segm), sizeof( mso_sptBentConnector5Segm ) >> 1, + std::span(mso_sptBentConnector5Segm), std::span(mso_sptBentConnector5Calc), - const_cast(mso_sptBentConnector5Default), + std::span(mso_sptBentConnector5Default), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -8081,9 +8081,9 @@ const sal_uInt16 mso_sptCurvedConnector2Segm[] = const mso_CustomShape msoCurvedConnector2 = { std::span(mso_sptCurvedConnector2Vert), - const_cast(mso_sptCurvedConnector2Segm), sizeof( mso_sptCurvedConnector2Segm ) >> 1, + std::span(mso_sptCurvedConnector2Segm), std::span(), - nullptr, + std::span(), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -8118,9 +8118,9 @@ const SvxMSDffHandle mso_sptCurvedConnector3Handle[] = const mso_CustomShape msoCurvedConnector3 = { std::span(mso_sptCurvedConnector3Vert), - const_cast(mso_sptCurvedConnector3Segm), sizeof( mso_sptCurvedConnector3Segm ) >> 1, + std::span(mso_sptCurvedConnector3Segm), std::span(mso_sptCurvedConnector3Calc), - const_cast(mso_sptCurvedConnector3Default), + std::span(mso_sptCurvedConnector3Default), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -8171,9 +8171,9 @@ const SvxMSDffHandle mso_sptCurvedConnector4Handle[] = const mso_CustomShape msoCurvedConnector4 = { std::span(mso_sptCurvedConnector4Vert), - const_cast(mso_sptCurvedConnector4Segm), sizeof( mso_sptCurvedConnector4Segm ) >> 1, + std::span(mso_sptCurvedConnector4Segm), std::span(mso_sptCurvedConnector4Calc), - const_cast(mso_sptCurvedConnector4Default), + std::span(mso_sptCurvedConnector4Default), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -8234,9 +8234,9 @@ const SvxMSDffHandle mso_sptCurvedConnector5Handle[] = const mso_CustomShape msoCurvedConnector5 = { std::span(mso_sptCurvedConnector5Vert), - const_cast(mso_sptCurvedConnector5Segm), sizeof( mso_sptCurvedConnector5Segm ) >> 1, + std::span(mso_sptCurvedConnector5Segm), std::span(mso_sptCurvedConnector5Calc), - const_cast(mso_sptCurvedConnector5Default), + std::span(mso_sptCurvedConnector5Default), std::span(), 21600, 21600, MIN_INT32, MIN_INT32, @@ -8295,9 +8295,9 @@ const sal_Int32 mso_sptTearDropDefault[] = const mso_CustomShape msoTearDrop = { std::span(mso_sptTearDropVert), - const_cast(mso_sptTearDropSegm), sizeof( mso_sptTearDropSegm ) >> 1, + std::span(mso_sptTearDropSegm), std::span(mso_sptTearDropCalc), - const_cast(mso_sptTearDropDefault), + std::span(mso_sptTearDropDefault), std::span(mso_sptTearDropTextRect), 21600, 21600, MIN_INT32, MIN_INT32, @@ -8351,9 +8351,9 @@ const SvxMSDffVertPair mso_sptSinusoidGluePoints[] = const mso_CustomShape msoSinusoid = { std::span(mso_sptSinusoidVert), // vertices - const_cast(mso_sptSinusoidSegm), sizeof(mso_sptSinusoidSegm) >> 1, // segments, count + std::span(mso_sptSinusoidSegm), // segments std::span(), // calculations (none) - nullptr, // default values (none) + std::span(), // default values (none) std::span(), // text area (default) 21600, 21600, // viewbox w, h (default) MIN_INT32, MIN_INT32, // stretch x, y (unset) diff --git a/svx/source/dialog/TableAutoFmtDlg.cxx b/svx/source/dialog/TableAutoFmtDlg.cxx index 6171b7244e94..cff293782556 100644 --- a/svx/source/dialog/TableAutoFmtDlg.cxx +++ b/svx/source/dialog/TableAutoFmtDlg.cxx @@ -55,6 +55,14 @@ public: OUString GetInputString() const { return mxEdInput->get_text(); } }; + +SvxAutoFormatData* lcl_GetTableAutoFormat(size_t nIndex, SvxAutoFormat& rFormat) +{ + if (nIndex > rFormat.size() - 1) + return nullptr; + + return rFormat.GetData(nIndex); +} } // AutoFormat-Dialog: @@ -150,14 +158,15 @@ void SvxTableAutoFmtDlg::PopulateFormatList() void SvxTableAutoFmtDlg::UpdateUIState() { - const bool bCanModify = mnIndex != DEFAULT_STYLE; + const bool bCanModify = mnIndex != DEFAULT_STYLE && mnIndex < mpFormat.size(); mxBtnRename->set_sensitive(bCanModify); mxBtnRemove->set_sensitive(bCanModify); + mxBtnEdit->set_sensitive(bCanModify); } void SvxTableAutoFmtDlg::UpdateChecks() { - if (const SvxAutoFormatData* pData = mpFormat.GetData(mnIndex)) + if (const SvxAutoFormatData* pData = lcl_GetTableAutoFormat(mnIndex, mpFormat)) { mxBtnNumFormat->set_active(pData->IsValueFormat()); mxBtnBorder->set_active(pData->IsFrame()); @@ -185,7 +194,7 @@ OUString SvxTableAutoFmtDlg::GenerateUniqueStyleName() // Event Handlers IMPL_LINK(SvxTableAutoFmtDlg, CheckHdl, weld::Toggleable&, rBtn, void) { - SvxAutoFormatData* rData = mpFormat.GetData(mnIndex); + SvxAutoFormatData* rData = lcl_GetTableAutoFormat(mnIndex, mpFormat); if (!rData) return; @@ -269,13 +278,15 @@ IMPL_LINK_NOARG(SvxTableAutoFmtDlg, SelFormatHdl, weld::ItemView&, void) UpdateChecks(); UpdateUIState(); - if (const SvxAutoFormatData* pData = mpFormat.GetData(mnIndex)) + if (const SvxAutoFormatData* pData = lcl_GetTableAutoFormat(mnIndex, mpFormat)) maWndPreview.NotifyChange(mpFormat.GetResolvedStyle(pData)); + else + maWndPreview.NotifyChange(mpFormat.GetDefaultData()); } OUString SvxTableAutoFmtDlg::GetCurrFormatName() { - const SvxAutoFormatData* pData = mpFormat.GetData(mnIndex); + const SvxAutoFormatData* pData = lcl_GetTableAutoFormat(mnIndex, mpFormat); return pData ? pData->GetName() : OUString(); } diff --git a/svx/source/engine3d/cube3d.cxx b/svx/source/engine3d/cube3d.cxx index 42a215dd3477..ecda75591485 100644 --- a/svx/source/engine3d/cube3d.cxx +++ b/svx/source/engine3d/cube3d.cxx @@ -95,7 +95,7 @@ rtl::Reference E3dCubeObj::DoConvertToPolyObj(bool /*bBezier*/, bool return nullptr; } -rtl::Reference E3dCubeObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference E3dCubeObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new E3dCubeObj(rTargetModel, *this); } diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx index fa9b73e02797..a58ce4915f68 100644 --- a/svx/source/engine3d/extrud3d.cxx +++ b/svx/source/engine3d/extrud3d.cxx @@ -112,7 +112,7 @@ SdrObjKind E3dExtrudeObj::GetObjIdentifier() const return SdrObjKind::E3D_Extrusion; } -rtl::Reference E3dExtrudeObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference E3dExtrudeObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new E3dExtrudeObj(rTargetModel, *this); } diff --git a/svx/source/engine3d/lathe3d.cxx b/svx/source/engine3d/lathe3d.cxx index e8664cb949ad..22ab4f70d0fb 100644 --- a/svx/source/engine3d/lathe3d.cxx +++ b/svx/source/engine3d/lathe3d.cxx @@ -117,7 +117,7 @@ SdrObjKind E3dLatheObj::GetObjIdentifier() const return SdrObjKind::E3D_Lathe; } -rtl::Reference E3dLatheObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference E3dLatheObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new E3dLatheObj(rTargetModel, *this); } diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index 0955681dbc4c..9422d961402f 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -397,7 +397,7 @@ OUString E3dObject::TakeObjNamePlural() const return SvxResId(STR_ObjNamePluralObj3d); } -rtl::Reference E3dObject::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference E3dObject::implCloneSdrObject(SdrModel& rTargetModel) const { return new E3dObject(rTargetModel, *this); } @@ -593,7 +593,7 @@ void E3dCompoundObject::RecalcSnapRect() sal_Int32(ceil(aSnapRange.getMaxX())), sal_Int32(ceil(aSnapRange.getMaxY()))); } -rtl::Reference E3dCompoundObject::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference E3dCompoundObject::implCloneSdrObject(SdrModel& rTargetModel) const { return new E3dCompoundObject(rTargetModel, *this); } diff --git a/svx/source/engine3d/polygn3d.cxx b/svx/source/engine3d/polygn3d.cxx index 3303cfe77d60..1b71210fcbc2 100644 --- a/svx/source/engine3d/polygn3d.cxx +++ b/svx/source/engine3d/polygn3d.cxx @@ -223,7 +223,7 @@ rtl::Reference E3dPolygonObj::DoConvertToPolyObj(bool /*bBezier*/, return nullptr; } -rtl::Reference E3dPolygonObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference E3dPolygonObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new E3dPolygonObj(rTargetModel, *this); } diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index fb1151cceb74..0c59b2c2b9d6 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -439,7 +439,7 @@ void E3dScene::removeAllNonSelectedObjects() } } -rtl::Reference E3dScene::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference E3dScene::implCloneSdrObject(SdrModel& rTargetModel) const { return new E3dScene(rTargetModel, *this); } diff --git a/svx/source/engine3d/sphere3d.cxx b/svx/source/engine3d/sphere3d.cxx index 35c6dc0135d2..a3a75ae55067 100644 --- a/svx/source/engine3d/sphere3d.cxx +++ b/svx/source/engine3d/sphere3d.cxx @@ -99,7 +99,7 @@ rtl::Reference E3dSphereObj::DoConvertToPolyObj(bool /*bBezier*/, boo return nullptr; } -rtl::Reference E3dSphereObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference E3dSphereObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new E3dSphereObj(rTargetModel, *this); } diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 6a82eef6b2d3..b1e4b0e5de49 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -358,7 +358,7 @@ SdrObjKind FmFormObj::GetObjIdentifier() const return SdrObjKind::UNO; } -rtl::Reference FmFormObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference FmFormObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new FmFormObj(rTargetModel, *this); } diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index eb6bada9ea15..88a43f43fb97 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -3020,6 +3020,60 @@ void FormController::setFilter(::std::vector& rFieldInfos) const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetUILocaleDataWrapper() ); OUString strDecimalSeparator = rLocaleWrapper.getNumDecimalSep(); + // convert one structured condition into its UI text, e.g. "LIKE A*" + auto getCriteriaText = [&](const PropertyValue& rRefValue, const Reference< XPropertySet >& xField) -> OUString + { + OUString sPredicate,sErrorMsg; + rRefValue.Value >>= sPredicate; + std::unique_ptr< OSQLParseNode > pParseNode = predicateTree(sErrorMsg, sPredicate, xFormatter, xField, xConnection); + if ( pParseNode == nullptr ) + return OUString(); + + OUString sCriteria; + switch (rRefValue.Handle) + { + case css::sdb::SQLFilterOperator::EQUAL: + sCriteria += "="; + break; + case css::sdb::SQLFilterOperator::NOT_EQUAL: + sCriteria += "!="; + break; + case css::sdb::SQLFilterOperator::LESS: + sCriteria += "<"; + break; + case css::sdb::SQLFilterOperator::GREATER: + sCriteria += ">"; + break; + case css::sdb::SQLFilterOperator::LESS_EQUAL: + sCriteria += "<="; + break; + case css::sdb::SQLFilterOperator::GREATER_EQUAL: + sCriteria += ">="; + break; + case css::sdb::SQLFilterOperator::LIKE: + sCriteria += "LIKE "; + break; + case css::sdb::SQLFilterOperator::NOT_LIKE: + sCriteria += "NOT LIKE "; + break; + case css::sdb::SQLFilterOperator::SQLNULL: + sCriteria += "IS NULL"; + break; + case css::sdb::SQLFilterOperator::NOT_SQLNULL: + sCriteria += "IS NOT NULL"; + break; + } + pParseNode->parseNodeToPredicateStr( sCriteria + ,xConnection + ,xFormatter + ,xField + ,OUString() + ,aAppLocale + ,strDecimalSeparator + ,getParseContext()); + return sCriteria; + }; + // retrieving the filter for (const Sequence < PropertyValue >& rRow : aFilterRows) { @@ -3080,62 +3134,20 @@ void FormController::setFilter(::std::vector& rFieldInfos) // do we already have the control ? if (aRow.find(rFieldInfo.xText) != aRow.end()) { + // further conditions on the same field need their operator too + OUString sCriteria = getCriteriaText(rRefValue, xField); + if (sCriteria.isEmpty()) + sCriteria = ::comphelper::getString(rRefValue.Value); OString aVal = m_pParser->getContext().getIntlKeywordAscii(IParseContext::InternationalKeyCode::And); aRow[rFieldInfo.xText] = aRow[rFieldInfo.xText] + " " + OStringToOUString(aVal, RTL_TEXTENCODING_ASCII_US) + " " + - ::comphelper::getString(rRefValue.Value); + sCriteria; } else { - OUString sPredicate,sErrorMsg; - rRefValue.Value >>= sPredicate; - std::unique_ptr< OSQLParseNode > pParseNode = predicateTree(sErrorMsg, sPredicate, xFormatter, xField, xConnection); - if ( pParseNode != nullptr ) - { - OUString sCriteria; - switch (rRefValue.Handle) - { - case css::sdb::SQLFilterOperator::EQUAL: - sCriteria += "="; - break; - case css::sdb::SQLFilterOperator::NOT_EQUAL: - sCriteria += "!="; - break; - case css::sdb::SQLFilterOperator::LESS: - sCriteria += "<"; - break; - case css::sdb::SQLFilterOperator::GREATER: - sCriteria += ">"; - break; - case css::sdb::SQLFilterOperator::LESS_EQUAL: - sCriteria += "<="; - break; - case css::sdb::SQLFilterOperator::GREATER_EQUAL: - sCriteria += ">="; - break; - case css::sdb::SQLFilterOperator::LIKE: - sCriteria += "LIKE "; - break; - case css::sdb::SQLFilterOperator::NOT_LIKE: - sCriteria += "NOT LIKE "; - break; - case css::sdb::SQLFilterOperator::SQLNULL: - sCriteria += "IS NULL"; - break; - case css::sdb::SQLFilterOperator::NOT_SQLNULL: - sCriteria += "IS NOT NULL"; - break; - } - pParseNode->parseNodeToPredicateStr( sCriteria - ,xConnection - ,xFormatter - ,xField - ,OUString() - ,aAppLocale - ,strDecimalSeparator - ,getParseContext()); + OUString sCriteria = getCriteriaText(rRefValue, xField); + if (!sCriteria.isEmpty()) aRow[rFieldInfo.xText] = sCriteria; - } } } } diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index 763bb875a571..98adffad8f42 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -119,12 +119,8 @@ public: } -GalleryBrowser::GalleryBrowser( - weld::Builder& rBuilder, - Gallery* pGallery)//, - //std::function aThemeSelectionHandler) - : - mxNewTheme(rBuilder.weld_button(u"insert"_ustr)), +GalleryBrowser::GalleryBrowser(weld::Builder& rBuilder, Gallery* pGallery) + : mxNewTheme(rBuilder.weld_button(u"insert"_ustr)), mxThemes(rBuilder.weld_tree_view(u"themelist"_ustr)), mxMoreGalleries(rBuilder.weld_button(u"btnMoreGalleries"_ustr)), mpGallery ( pGallery ), @@ -132,12 +128,11 @@ GalleryBrowser::GalleryBrowser( aImgNormal ( RID_SVXBMP_THEME_NORMAL ), aImgDefault ( RID_SVXBMP_THEME_DEFAULT ), aImgReadOnly ( RID_SVXBMP_THEME_READONLY ) - //maThemeSelectionHandler(std::move(aThemeSelectionHandler)) , mpCurTheme(nullptr) - , mxIconView(new GalleryIconView(this, rBuilder.weld_scrolled_window(u"galleryscroll"_ustr, true))) + , mxIconView(new GalleryIconView(*this, rBuilder.weld_scrolled_window(u"galleryscroll"_ustr, true))) , mxIconViewWin(new weld::CustomWeld(rBuilder, u"gallery"_ustr, *mxIconView)) , mxListView(rBuilder.weld_tree_view(u"gallerylist"_ustr)) - , mxPreview(new GalleryPreview(this, rBuilder.weld_scrolled_window(u"previewscroll"_ustr))) + , mxPreview(new GalleryPreview(*this, rBuilder.weld_scrolled_window(u"previewscroll"_ustr))) , mxPreviewWin(new weld::CustomWeld(rBuilder, u"preview"_ustr, *mxPreview)) , mxIconButton(rBuilder.weld_toggle_button(u"icon"_ustr)) , mxListButton(rBuilder.weld_toggle_button(u"list"_ustr)) diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx index 4404e03298fc..054c62ffa2ce 100644 --- a/svx/source/gallery2/galctrl.cxx +++ b/svx/source/gallery2/galctrl.cxx @@ -38,9 +38,10 @@ #include #include -GalleryPreview::GalleryPreview(GalleryBrowser* pParent, std::unique_ptr xScrolledWindow) +GalleryPreview::GalleryPreview(GalleryBrowser& rParent, + std::unique_ptr xScrolledWindow) : mxScrolledWindow(std::move(xScrolledWindow)) - , mpParent(pParent) + , mrParent(rParent) , mpTheme(nullptr) { } @@ -68,7 +69,7 @@ void GalleryPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea) pDrawingArea->set_size_request(aSize.Width(), aSize.Height()); SetOutputSizePixel(aSize); - mxDragDropTargetHelper.reset(new GalleryDragDrop(mpParent, pDrawingArea->get_drop_target())); + mxDragDropTargetHelper.reset(new GalleryDragDrop(&mrParent, pDrawingArea->get_drop_target())); } namespace @@ -132,7 +133,7 @@ void GalleryPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rect bool GalleryPreview::MouseButtonDown(const MouseEvent& rMEvt) { if (mpTheme && (rMEvt.GetClicks() == 2)) - mpParent->TogglePreview(); + mrParent.TogglePreview(); return true; } @@ -140,7 +141,7 @@ bool GalleryPreview::Command(const CommandEvent& rCEvt) { if (mpTheme && (rCEvt.GetCommand() == CommandEventId::ContextMenu)) { - mpParent->ShowContextMenu(rCEvt); + mrParent.ShowContextMenu(rCEvt); return true; } return false; @@ -150,35 +151,33 @@ bool GalleryPreview::KeyInput(const KeyEvent& rKEvt) { if(mpTheme) { - GalleryBrowser* pBrowser = mpParent; - switch( rKEvt.GetKeyCode().GetCode() ) { case KEY_BACKSPACE: - pBrowser->TogglePreview(); + mrParent.TogglePreview(); break; case KEY_HOME: - pBrowser->Travel( GalleryBrowserTravel::First ); + mrParent.Travel(GalleryBrowserTravel::First); break; case KEY_END: - pBrowser->Travel( GalleryBrowserTravel::Last ); + mrParent.Travel(GalleryBrowserTravel::Last); break; case KEY_LEFT: case KEY_UP: - pBrowser->Travel( GalleryBrowserTravel::Previous ); + mrParent.Travel(GalleryBrowserTravel::Previous); break; case KEY_RIGHT: case KEY_DOWN: - pBrowser->Travel( GalleryBrowserTravel::Next ); + mrParent.Travel(GalleryBrowserTravel::Next); break; default: { - if (!pBrowser->KeyInput(rKEvt)) + if (!mrParent.KeyInput(rKEvt)) return false; } break; @@ -192,7 +191,7 @@ bool GalleryPreview::KeyInput(const KeyEvent& rKEvt) bool GalleryPreview::StartDrag() { if (mpTheme) - return mpParent->StartDrag(); + return mrParent.StartDrag(); return true; } @@ -300,9 +299,10 @@ void GalleryIconView::drawTransparenceBackground(vcl::RenderContext& rOut, const rOut.DrawCheckered(rPos, rSize, nLen, aW, aG); } -GalleryIconView::GalleryIconView(GalleryBrowser* pParent, std::unique_ptr xScrolledWindow) +GalleryIconView::GalleryIconView(GalleryBrowser& rParent, + std::unique_ptr xScrolledWindow) : ValueSet(std::move(xScrolledWindow)) - , mpParent(pParent) + , mrParent(rParent) , mpTheme(nullptr) { } @@ -322,7 +322,7 @@ void GalleryIconView::SetDrawingArea(weld::DrawingArea* pDrawingArea) SetItemWidth( S_THUMB + 6 ); SetItemHeight( S_THUMB + 6 ); - mxDragDropTargetHelper.reset(new GalleryDragDrop(mpParent, pDrawingArea->get_drop_target())); + mxDragDropTargetHelper.reset(new GalleryDragDrop(&mrParent, pDrawingArea->get_drop_target())); } void GalleryIconView::UserDraw(const UserDrawEvent& rUDEvt) @@ -391,7 +391,7 @@ bool GalleryIconView::MouseButtonDown(const MouseEvent& rMEvt) bool bRet = ValueSet::MouseButtonDown(rMEvt); if (rMEvt.GetClicks() == 2) - mpParent->TogglePreview(); + mrParent.TogglePreview(); return bRet; } @@ -402,7 +402,7 @@ bool GalleryIconView::Command(const CommandEvent& rCEvt) if (!bRet && rCEvt.GetCommand() == CommandEventId::ContextMenu) { - bRet = mpParent->ShowContextMenu(rCEvt); + bRet = mrParent.ShowContextMenu(rCEvt); } return bRet; @@ -410,7 +410,7 @@ bool GalleryIconView::Command(const CommandEvent& rCEvt) bool GalleryIconView::KeyInput(const KeyEvent& rKEvt) { - if (!mpTheme || !mpParent->KeyInput(rKEvt)) + if (!mpTheme || !mrParent.KeyInput(rKEvt)) return ValueSet::KeyInput(rKEvt); return true; } @@ -418,7 +418,7 @@ bool GalleryIconView::KeyInput(const KeyEvent& rKEvt) bool GalleryIconView::StartDrag() { Select(); - return mpParent->StartDrag(); + return mrParent.StartDrag(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/DefaultShapesPanel.hxx b/svx/source/inc/DefaultShapesPanel.hxx index 788acab692a0..0bbbdbbf1a87 100644 --- a/svx/source/inc/DefaultShapesPanel.hxx +++ b/svx/source/inc/DefaultShapesPanel.hxx @@ -16,12 +16,12 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SVX_SOURCE_INC_DEFAULTSHAPESPANEL_HXX -#define INCLUDED_SVX_SOURCE_INC_DEFAULTSHAPESPANEL_HXX + +#pragma once #include #include -#include +#include #include #include "ShapesUtil.hxx" @@ -46,37 +46,24 @@ public: virtual ~DefaultShapesPanel() override; private: - std::unique_ptr mxLineArrowSet; - std::unique_ptr mxLineArrowSetWin; - std::unique_ptr mxCurveSet; - std::unique_ptr mxCurveSetWin; - std::unique_ptr mxConnectorSet; - std::unique_ptr mxConnectorSetWin; - std::unique_ptr mxBasicShapeSet; - std::unique_ptr mxBasicShapeSetWin; - std::unique_ptr mxSymbolShapeSet; - std::unique_ptr mxSymbolShapeSetWin; - std::unique_ptr mxBlockArrowSet; - std::unique_ptr mxBlockArrowSetWin; - std::unique_ptr mxFlowchartSet; - std::unique_ptr mxFlowchartSetWin; - std::unique_ptr mxCalloutSet; - std::unique_ptr mxCalloutSetWin; - std::unique_ptr mxStarSet; - std::unique_ptr mxStarSetWin; - std::unique_ptr mx3DObjectSet; - std::unique_ptr mx3DObjectSetWin; + std::unique_ptr m_pLineArrowIconView; + std::unique_ptr m_pCurveIconView; + std::unique_ptr m_pConnectorIconView; + std::unique_ptr m_pBasicShapeIconView; + std::unique_ptr m_pSymbolShapeIconView; + std::unique_ptr m_pBlockArrowIconView; + std::unique_ptr m_pFlowchartIconView; + std::unique_ptr m_pCalloutIconView; + std::unique_ptr m_pStarIconView; + std::unique_ptr m_p3DObjectIconView; Reference< XFrame > mxFrame; - std::map> mpShapesSetMap; + std::vector m_aShapesViews; - void populateShapes(); void Initialize(); - DECL_LINK( ShapeSelectHdl, ValueSet*, void ); + DECL_LINK(ShapeActivatedHdl, const weld::TreeIter&, bool); }; } // end of namespace sd::sidebar -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/GraphCtlAccessibleContext.hxx b/svx/source/inc/GraphCtlAccessibleContext.hxx index b4ab889c6f08..88f65273527e 100644 --- a/svx/source/inc/GraphCtlAccessibleContext.hxx +++ b/svx/source/inc/GraphCtlAccessibleContext.hxx @@ -43,13 +43,13 @@ class SdrModel; class SdrPage; class SdrView; -/** @descr - This base class provides an implementation of the - AccessibleContext service. -*/ +// avoid LNK2005 duplicate ImplInheritanceHelper definitions with MSVC +class SvxGraphCtrlAccessibleContextBase : public comphelper::OAccessible +{ +}; class SvxGraphCtrlAccessibleContext final - : public cppu::ImplInheritanceHelper, public SfxListener, public ::accessibility::IAccessibleViewForwarder diff --git a/svx/source/inc/ShapesUtil.hxx b/svx/source/inc/ShapesUtil.hxx index a9c84d52c517..f44bb828398e 100644 --- a/svx/source/inc/ShapesUtil.hxx +++ b/svx/source/inc/ShapesUtil.hxx @@ -18,19 +18,26 @@ */ #pragma once -#include #include +#include + namespace svx::sidebar { class SvxShapeCommandsMap { public: SvxShapeCommandsMap(); - std::map mpLineShapes, mpCurveShapes, - mpConnectorShapes, mpBasicShapes, mpSymbolShapes, - mpBlockArrowShapes, mpFlowchartShapes, - mpCalloutShapes, mpStarShapes, mp3DShapes; + std::vector m_aLineShapes; + std::vector m_aCurveShapes; + std::vector m_aConnectorShapes; + std::vector m_aBasicShapes; + std::vector m_aSymbolShapes; + std::vector m_aBlockArrowShapes; + std::vector m_aFlowchartShapes; + std::vector m_aCalloutShapes; + std::vector m_aStarShapes; + std::vector m_a3DShapes; }; } diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx index d19399a737ee..629e2f201db0 100644 --- a/svx/source/inc/fmobj.hxx +++ b/svx/source/inc/fmobj.hxx @@ -50,6 +50,8 @@ class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) FmFormObj final : public SdrUnoObj // protected destructor SAL_DLLPRIVATE virtual ~FmFormObj() override; + SAL_DLLPRIVATE virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: FmFormObj( SdrModel& rSdrModel, @@ -79,8 +81,6 @@ public: SAL_DLLPRIVATE virtual SdrObjKind GetObjIdentifier() const override; SAL_DLLPRIVATE virtual void NbcReformatText() override; - SAL_DLLPRIVATE virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - SAL_DLLPRIVATE static css::uno::Reference< css::uno::XInterface> ensureModelEnv( const css::uno::Reference< css::uno::XInterface>& _rSourceContainer, const css::uno::Reference< css::form::XForms>& _rTopLevelDestContainer); diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index 3ccf39277635..53c79dbef826 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -144,74 +144,103 @@ namespace sdr::properties : DefaultProperties(rProps, rObj), mpStyleSheet(nullptr) { - SfxStyleSheet* pTargetStyleSheet(rProps.GetStyleSheet()); + const bool bModelChange(&rObj.getSdrModelFromSdrObject() != &rProps.GetSdrObject().getSdrModelFromSdrObject()); - if(pTargetStyleSheet) + if (bModelChange) { - const bool bModelChange(&rObj.getSdrModelFromSdrObject() != &rProps.GetSdrObject().getSdrModelFromSdrObject()); - - if(bModelChange) - { - // tdf#117506 - // The error shows that it is definitely necessary to solve this problem. - // Interestingly I already had a note here for 'work needed'. - // Checked in libreoffice-6-0 what happened there. In principle, the whole - // ::Clone of SdrPage and SdrObject happened in the same SdrModel, only - // afterwards a ::SetModel was used at the cloned SdrPage which went through - // all layers. The StyleSheet-problem was solved in - // AttributeProperties::MoveToItemPool at the end. There, a StyleSheet with the - // same name was searched for in the target-SdrModel. - // Start by resetting the current TargetStyleSheet so that nothing goes wrong - // when we do not find a fitting TargetStyleSheet. - // Note: The test for SdrModelChange above was wrong (compared the already set - // new SdrObject), so this never triggered and pTargetStyleSheet was never set to - // nullptr before. This means that a StyleSheet from another SdrModel was used - // which of course is very dangerous. Interestingly did not crash since when that - // other SdrModel was destroyed the ::Notify mechanism still worked reliably - // and disconnected these Properties successfully from the alien-StyleSheet. - pTargetStyleSheet = nullptr; - - // Check if we have a TargetStyleSheetPool at the target-SdrModel. This *should* - // be the case already (SdrModel::Merge and SdDrawDocument::InsertBookmarkAsPage - // have already cloned the StyleSheets to the target-SdrModel when used in Draw/impress). - // If none is found, ImpGetDefaultStyleSheet will be used to set a 'default' - // StyleSheet as StyleSheet implicitly later (that's what happened in the task, - // thus the FillStyle changed to the 'default' Blue). - // Note: It *may* be necessary to do more for StyleSheets, e.g. clone/copy the - // StyleSheet Hierarchy from the source SdrModel and/or add the Items from there - // as hard attributes. If needed, have a look at the older AttributeProperties::SetModel - // implementation from e.g. libreoffice-6-0. - SfxStyleSheetBasePool* pTargetStyleSheetPool(rObj.getSdrModelFromSdrObject().GetStyleSheetPool()); - - if(nullptr != pTargetStyleSheetPool) - { - // If we have a TargetStyleSheetPool, search for the used StyleSheet - // in the target SdrModel using the Name from the original StyleSheet - // in the source-SdrModel. - pTargetStyleSheet = dynamic_cast< SfxStyleSheet* >( - pTargetStyleSheetPool->Find( - rProps.GetStyleSheet()->GetName(), - rProps.GetStyleSheet()->GetFamily())); - } - } - } - - if(!pTargetStyleSheet) - return; - - if(HasSfxItemSet()) - { - // The SfxItemSet has been cloned and exists, - // we can directly set the SfxStyleSheet at it - ImpAddStyleSheet(pTargetStyleSheet, true); + // use default; will be corrected/handled in call to + // postProcessAfterCloneToDifferentModel below. Thus, + // also do not yet call ImpAddStyleSheet here + mpStyleSheet = GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet(); } else { - // No SfxItemSet exists yet (there is none in - // the source, so none was cloned). Remember the - // SfxStyleSheet to set it when the SfxItemSet - // got constructed on-demand - mpStyleSheet = pTargetStyleSheet; + // copy existing one + mpStyleSheet = rProps.GetStyleSheet(); + + // add StyleSheet && establish the parent-links in the SfxItemSet + ImpAddStyleSheet(mpStyleSheet, true); + } + } + + void AttributeProperties::postProcessAfterCloneToDifferentModel(const SdrObject& rSrcObj) + { + SdrModel& rDstModel(GetSdrObject().getSdrModelFromSdrObject()); + const bool bModelChange(&rSrcObj.getSdrModelFromSdrObject() != &rDstModel); + + if (!bModelChange) + return; + + // guarantee SfxItemSet existence + DefaultProperties::GetObjectItemSet(); + const sdr::properties::BaseProperties& rSource(rSrcObj.GetProperties()); + SfxStyleSheet* pNewStyleSheet(nullptr); + + if (rDstModel.GetStyleSheetPool()) + { + SfxStyleSheet* pSourceStyleSheet(rSource.GetStyleSheet()); + + if (pSourceStyleSheet) + { + // If we have a TargetStyleSheetPool, search for the used StyleSheet + // in the target SdrModel using the Name from the original StyleSheet + // in the source-SdrModel. + // That will/should work always since Paste from another model will + // in a 1st step copy non-existing StyleSheets to destination model + pNewStyleSheet = dynamic_cast< SfxStyleSheet* >( + rDstModel.GetStyleSheetPool()->Find( + pSourceStyleSheet->GetName(), + pSourceStyleSheet->GetFamily())); + } + } + + // fallback: every SdrObject *should* have a StyleSheet, use + // default from the model + if(!pNewStyleSheet) + pNewStyleSheet = rDstModel.GetDefaultStyleSheet(); + + if(!pNewStyleSheet) + // may still have no StyleSheet, was so before, too, but + // should not happen since a DefaultStyleSheet should + // always be there + return; + + // add StyleSheet && establish the parent-links in the SfxItemSet + if (GetStyleSheet() != pNewStyleSheet) + { + ImpRemoveStyleSheet(); + ImpAddStyleSheet(pNewStyleSheet, true); + } + + if (HasSfxItemSet()) + { + // here we have a model change and a StyleSheet set,. but that + // StyleSheet was found by looking for name & type. It may + // *not* be identical to the StyleSheet from the Source. + + // What to do? We could... + // (a) the Style-friendly way: + // - check if StyleSheet is identical + // - if not, create a new in-between StyleSheet hosting missing Items + // - if yes, use, done. + // (b) the pragmatic/practical way: + // - Just hard-attribute the Items that are detected as different + // similar to what BurnInStyleSheetAttributes does/did, but only + // for differing Items here + // + // (b)) is the most simple for now, but will lead to more hard + // attributes. The other possibilities will be better in the + // long term. For now, I will use (b). + SfxWhichIter aIter(rSource.GetObjectItemSet()); + + for (sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich()) + { + const SfxPoolItem& rOld(rSource.GetItem(nWhich)); + const SfxPoolItem& rNew(GetItem(nWhich)); + + if (!SfxPoolItem::areSame(rOld, rNew)) + SetObjectItemDirect(rOld); + } } } @@ -220,7 +249,7 @@ namespace sdr::properties ImpRemoveStyleSheet(); } - std::unique_ptr AttributeProperties::Clone(SdrObject&) const + std::unique_ptr AttributeProperties::implCloneProperties(SdrObject&) const { assert(false && "this class is effectively abstract, should only be instantiating subclasses"); abort(); diff --git a/svx/source/sdr/properties/captionproperties.cxx b/svx/source/sdr/properties/captionproperties.cxx index 958f9eecf080..dd71a6640791 100644 --- a/svx/source/sdr/properties/captionproperties.cxx +++ b/svx/source/sdr/properties/captionproperties.cxx @@ -57,7 +57,7 @@ namespace sdr::properties { } - std::unique_ptr CaptionProperties::Clone(SdrObject& rObj) const + std::unique_ptr CaptionProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new CaptionProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/circleproperties.cxx b/svx/source/sdr/properties/circleproperties.cxx index 217b9e7b257e..404023e507d8 100644 --- a/svx/source/sdr/properties/circleproperties.cxx +++ b/svx/source/sdr/properties/circleproperties.cxx @@ -61,7 +61,7 @@ namespace sdr::properties { } - std::unique_ptr CircleProperties::Clone(SdrObject& rObj) const + std::unique_ptr CircleProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new CircleProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/connectorproperties.cxx b/svx/source/sdr/properties/connectorproperties.cxx index e5e29de75979..778681834821 100644 --- a/svx/source/sdr/properties/connectorproperties.cxx +++ b/svx/source/sdr/properties/connectorproperties.cxx @@ -59,7 +59,7 @@ namespace sdr::properties { } - std::unique_ptr ConnectorProperties::Clone(SdrObject& rObj) const + std::unique_ptr ConnectorProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new ConnectorProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx index c63d7e4a4b3c..d56b32a4b278 100644 --- a/svx/source/sdr/properties/customshapeproperties.cxx +++ b/svx/source/sdr/properties/customshapeproperties.cxx @@ -195,7 +195,7 @@ namespace sdr::properties { } - std::unique_ptr CustomShapeProperties::Clone(SdrObject& rObj) const + std::unique_ptr CustomShapeProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new CustomShapeProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index 3354172d3cb0..f5a551137660 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -41,11 +42,13 @@ namespace sdr::properties DefaultProperties::DefaultProperties(SdrObject& rObj) : BaseProperties(rObj) + , m_itemPoolHolder(&rObj.getSdrModelFromSdrObject().GetItemPool()) { } DefaultProperties::DefaultProperties(const DefaultProperties& rProps, SdrObject& rObj) : BaseProperties(rObj) + , m_itemPoolHolder(&rObj.getSdrModelFromSdrObject().GetItemPool()) { if(!rProps.moItemSet) return; @@ -85,7 +88,7 @@ namespace sdr::properties } } - std::unique_ptr DefaultProperties::Clone(SdrObject& rObj) const + std::unique_ptr DefaultProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new DefaultProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/e3dcompoundproperties.cxx b/svx/source/sdr/properties/e3dcompoundproperties.cxx index 8ad00d6092b9..755af4c8f2c9 100644 --- a/svx/source/sdr/properties/e3dcompoundproperties.cxx +++ b/svx/source/sdr/properties/e3dcompoundproperties.cxx @@ -39,7 +39,7 @@ namespace sdr::properties { } - std::unique_ptr E3dCompoundProperties::Clone(SdrObject& rObj) const + std::unique_ptr E3dCompoundProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new E3dCompoundProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/e3dextrudeproperties.cxx b/svx/source/sdr/properties/e3dextrudeproperties.cxx index 9b9ffd8be9ab..3caac2b5816e 100644 --- a/svx/source/sdr/properties/e3dextrudeproperties.cxx +++ b/svx/source/sdr/properties/e3dextrudeproperties.cxx @@ -37,7 +37,7 @@ namespace sdr::properties { } - std::unique_ptr E3dExtrudeProperties::Clone(SdrObject& rObj) const + std::unique_ptr E3dExtrudeProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new E3dExtrudeProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/e3dlatheproperties.cxx b/svx/source/sdr/properties/e3dlatheproperties.cxx index feb546534d47..329ed34eac37 100644 --- a/svx/source/sdr/properties/e3dlatheproperties.cxx +++ b/svx/source/sdr/properties/e3dlatheproperties.cxx @@ -37,7 +37,7 @@ namespace sdr::properties { } - std::unique_ptr E3dLatheProperties::Clone(SdrObject& rObj) const + std::unique_ptr E3dLatheProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new E3dLatheProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/e3dproperties.cxx b/svx/source/sdr/properties/e3dproperties.cxx index 2cd011ffbb55..672b2249ae81 100644 --- a/svx/source/sdr/properties/e3dproperties.cxx +++ b/svx/source/sdr/properties/e3dproperties.cxx @@ -55,7 +55,7 @@ namespace sdr::properties { } - std::unique_ptr E3dProperties::Clone(SdrObject& rObj) const + std::unique_ptr E3dProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new E3dProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx index 1716eece9a20..3ca38beacc04 100644 --- a/svx/source/sdr/properties/e3dsceneproperties.cxx +++ b/svx/source/sdr/properties/e3dsceneproperties.cxx @@ -42,7 +42,7 @@ namespace sdr::properties { } - std::unique_ptr E3dSceneProperties::Clone(SdrObject& rObj) const + std::unique_ptr E3dSceneProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new E3dSceneProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/e3dsphereproperties.cxx b/svx/source/sdr/properties/e3dsphereproperties.cxx index 66f01748f293..88a456cc228a 100644 --- a/svx/source/sdr/properties/e3dsphereproperties.cxx +++ b/svx/source/sdr/properties/e3dsphereproperties.cxx @@ -37,7 +37,7 @@ namespace sdr::properties { } - std::unique_ptr E3dSphereProperties::Clone(SdrObject& rObj) const + std::unique_ptr E3dSphereProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new E3dSphereProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/emptyproperties.cxx b/svx/source/sdr/properties/emptyproperties.cxx index 6f7b0f6876e5..3b56b8fa5122 100644 --- a/svx/source/sdr/properties/emptyproperties.cxx +++ b/svx/source/sdr/properties/emptyproperties.cxx @@ -31,7 +31,7 @@ namespace sdr::properties { } - std::unique_ptr EmptyProperties::Clone(SdrObject& rObj) const + std::unique_ptr EmptyProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new EmptyProperties(rObj)); } diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx index 53c97e817952..730ec5314905 100644 --- a/svx/source/sdr/properties/graphicproperties.cxx +++ b/svx/source/sdr/properties/graphicproperties.cxx @@ -89,7 +89,7 @@ namespace sdr::properties { } - std::unique_ptr GraphicProperties::Clone(SdrObject& rObj) const + std::unique_ptr GraphicProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new GraphicProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx index 51e6a7d922e9..c4cb117bbbe6 100644 --- a/svx/source/sdr/properties/groupproperties.cxx +++ b/svx/source/sdr/properties/groupproperties.cxx @@ -38,7 +38,7 @@ namespace sdr::properties { } - std::unique_ptr GroupProperties::Clone(SdrObject& rObj) const + std::unique_ptr GroupProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new GroupProperties(rObj)); } diff --git a/svx/source/sdr/properties/measureproperties.cxx b/svx/source/sdr/properties/measureproperties.cxx index dd235aab8fe4..9ae9461eac8e 100644 --- a/svx/source/sdr/properties/measureproperties.cxx +++ b/svx/source/sdr/properties/measureproperties.cxx @@ -67,7 +67,7 @@ namespace sdr::properties { } - std::unique_ptr MeasureProperties::Clone(SdrObject& rObj) const + std::unique_ptr MeasureProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new MeasureProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx index 5310e74e30c6..ecb6b0b38b08 100644 --- a/svx/source/sdr/properties/oleproperties.cxx +++ b/svx/source/sdr/properties/oleproperties.cxx @@ -56,7 +56,7 @@ namespace sdr::properties { } - std::unique_ptr OleProperties::Clone(SdrObject& rObj) const + std::unique_ptr OleProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new OleProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx index 6b532d2d487b..9b5479ac9220 100644 --- a/svx/source/sdr/properties/pageproperties.cxx +++ b/svx/source/sdr/properties/pageproperties.cxx @@ -41,7 +41,7 @@ namespace sdr::properties { } - std::unique_ptr PageProperties::Clone(SdrObject& rObj) const + std::unique_ptr PageProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new PageProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx index 612813bb1aac..401a1fc3085b 100644 --- a/svx/source/sdr/properties/properties.cxx +++ b/svx/source/sdr/properties/properties.cxx @@ -40,6 +40,15 @@ namespace sdr::properties { } + void BaseProperties::postProcessAfterCloneToDifferentModel(const SdrObject& /*rSrcObj*/) + { + } + + std::unique_ptr BaseProperties::Clone(SdrObject& rObj) const + { + return implCloneProperties(rObj); + } + const SdrObject& BaseProperties::GetSdrObject() const { return mrObject; diff --git a/svx/source/sdr/properties/rectangleproperties.cxx b/svx/source/sdr/properties/rectangleproperties.cxx index 9242fa5f9ac5..619927399556 100644 --- a/svx/source/sdr/properties/rectangleproperties.cxx +++ b/svx/source/sdr/properties/rectangleproperties.cxx @@ -37,7 +37,7 @@ namespace sdr::properties { } - std::unique_ptr RectangleProperties::Clone(SdrObject& rObj) const + std::unique_ptr RectangleProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new RectangleProperties(*this, rObj)); } diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index 25c16eaca4f6..afa93e40bfda 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -78,7 +78,7 @@ namespace sdr::properties { } - std::unique_ptr TextProperties::Clone(SdrObject& rObj) const + std::unique_ptr TextProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new TextProperties(*this, rObj)); } @@ -466,9 +466,9 @@ namespace sdr::properties if(aSet.GetItemState(EE_CHAR_COLOR) == SfxItemState::SET) { - EditEngine* pEditEngine = const_cast(&(pOutliner->GetEditEngine())); + EditEngine& rEditEngine = pOutliner->GetEditEngine(); std::vector aAttribs; - pEditEngine->GetCharAttribs(nPara, aAttribs); + rEditEngine.GetCharAttribs(nPara, aAttribs); for(const auto& rAttrib : aAttribs) { @@ -503,17 +503,17 @@ namespace sdr::properties aSel.end.nIndex = rAttrib.nStart; if (aSel.start.nIndex != aSel.end.nIndex) - pEditEngine->QuickSetAttribs(aColorSet, aSel); + rEditEngine.QuickSetAttribs(aColorSet, aSel); aSel.start.nIndex = rAttrib.nEnd; } } - aSel.end.nIndex = pEditEngine->GetTextLen(nPara); + aSel.end.nIndex = rEditEngine.GetTextLen(nPara); if (aSel.start.nIndex != aSel.end.nIndex) { - pEditEngine->QuickSetAttribs( aColorSet, aSel ); + rEditEngine.QuickSetAttribs( aColorSet, aSel ); } } diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 042cd69be665..4b510baf7ca9 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -90,6 +90,7 @@ AreaPropertyPanelBase::AreaPropertyPanelBase( mxMTRAngle(m_xBuilder->weld_metric_spin_button(u"gradangle"_ustr, FieldUnit::DEGREE)), mxGradientStyle(m_xBuilder->weld_combo_box(u"gradientstyle"_ustr)), mxBmpImport(m_xBuilder->weld_button(u"bmpimport"_ustr)), + mxTransparencyBox(m_xBuilder->weld_container(u"box1"_ustr)), maImgAxial(BMP_AXIAL), maImgElli(BMP_ELLI), maImgQuad(BMP_QUAD), @@ -410,8 +411,7 @@ void AreaPropertyPanelBase::ShowTransparency(const bool bDoShow) { mxLBTransType->set_visible(bDoShow); mxTrspTextFT->set_visible(bDoShow); - mxMTRTransparent->set_visible(bDoShow); - mxSldTransparent->set_visible(bDoShow); + mxTransparencyBox->set_visible(bDoShow); } void AreaPropertyPanelBase::FillStyleChanged(bool bUpdateModel) diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx b/svx/source/sidebar/line/LineWidthPopup.cxx index 782b801c51f0..c92180933035 100644 --- a/svx/source/sidebar/line/LineWidthPopup.cxx +++ b/svx/source/sidebar/line/LineWidthPopup.cxx @@ -27,8 +27,9 @@ #include #include #include +#include #include -#include "LineWidthValueSet.hxx" +#include #include namespace svx::sidebar @@ -39,17 +40,13 @@ LineWidthPopup::LineWidthPopup(weld::Widget* pParent, LinePropertyPanelBase& rPa , m_rParent(rParent) , m_sPt(SvxResId(RID_SVXSTR_PT)) , m_eMapUnit(MapUnit::MapTwip) - , m_bVSFocus(true) + , m_bTreeViewFocus(true) , m_bCustom(false) , m_nCustomWidth(0) , m_aIMGCus(StockImage::Yes, RID_SVXBMP_WIDTH_CUSTOM) - , m_aIMGCusGray(StockImage::Yes, RID_SVXBMP_WIDTH_CUSTOM_GRAY) , m_xMFWidth(m_xBuilder->weld_metric_spin_button(u"spin"_ustr, FieldUnit::POINT)) - , m_xVSWidth(new LineWidthValueSet()) - , m_xVSWidthWin(new weld::CustomWeld(*m_xBuilder, u"lineset"_ustr, *m_xVSWidth)) + , m_xWidthTreeView(m_xBuilder->weld_tree_view("linetreeview")) { - m_xVSWidth->SetStyle(m_xVSWidth->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT); - maStrUnits = { u"0.5"_ustr, u"0.8"_ustr, u"1.0"_ustr, u"1.5"_ustr, u"2.3"_ustr, u"3.0"_ustr, u"4.5"_ustr, u"6.0"_ustr, SvxResId(RID_SVXSTR_WIDTH_LAST_CUSTOM) }; @@ -64,46 +61,78 @@ LineWidthPopup::LineWidthPopup(weld::Widget* pParent, LinePropertyPanelBase& rPa maStrUnits[i] += m_sPt; } - for (sal_uInt16 i = 1; i <= 9; ++i) + for (int i = 0; i < 9; ++i) { - m_xVSWidth->InsertItem(i); - m_xVSWidth->SetItemText(i, maStrUnits[i - 1]); + m_xWidthTreeView->insert(i); + ScopedVclPtr pImage = CreateImage(i); + m_xWidthTreeView->set_image(i, *pImage, 0); + m_xWidthTreeView->set_text(i, maStrUnits.at(i), 1); + m_xWidthTreeView->set_sensitive(i, true); } + m_xWidthTreeView->columns_autosize(); - m_xVSWidth->SetUnit(maStrUnits); - m_xVSWidth->SetItemData(1, reinterpret_cast(5)); - m_xVSWidth->SetItemData(2, reinterpret_cast(8)); - m_xVSWidth->SetItemData(3, reinterpret_cast(10)); - m_xVSWidth->SetItemData(4, reinterpret_cast(15)); - m_xVSWidth->SetItemData(5, reinterpret_cast(23)); - m_xVSWidth->SetItemData(6, reinterpret_cast(30)); - m_xVSWidth->SetItemData(7, reinterpret_cast(45)); - m_xVSWidth->SetItemData(8, reinterpret_cast(60)); - m_xVSWidth->SetImage(m_aIMGCusGray); + m_xWidthTreeView->set_id(0, OUString::number(5)); + m_xWidthTreeView->set_id(1, OUString::number(8)); + m_xWidthTreeView->set_id(2, OUString::number(10)); + m_xWidthTreeView->set_id(3, OUString::number(15)); + m_xWidthTreeView->set_id(4, OUString::number(23)); + m_xWidthTreeView->set_id(5, OUString::number(30)); + m_xWidthTreeView->set_id(6, OUString::number(45)); + m_xWidthTreeView->set_id(7, OUString::number(60)); - m_xVSWidth->SetSelItem(0); + UnselectTreeViewItems(); - m_xVSWidth->SetSelectHdl(LINK(this, LineWidthPopup, VSSelectHdl)); + m_xWidthTreeView->connect_item_activated(LINK(this, LineWidthPopup, TreeViewItemActivatedHdl)); m_xMFWidth->connect_value_changed(LINK(this, LineWidthPopup, MFModifyHdl)); } LineWidthPopup::~LineWidthPopup() {} -IMPL_LINK_NOARG(LineWidthPopup, VSSelectHdl, ValueSet*, void) +ScopedVclPtr LineWidthPopup::CreateImage(int nIndex) { - sal_uInt16 iPos = m_xVSWidth->GetSelectedItemId(); - if (iPos >= 1 && iPos <= 8) + ScopedVclPtr pDev = m_xWidthTreeView->create_virtual_device(); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + pDev->SetBackground(rStyleSettings.GetFieldColor()); + pDev->SetLineColor(rStyleSettings.GetFieldTextColor()); + pDev->SetFillColor(pDev->GetLineColor()); + pDev->SetOutputSizePixel(Size(50, 26)); + + if (nIndex >= 0 && nIndex <= 7) { - sal_IntPtr nVal = OutputDevice::LogicToLogic( - reinterpret_cast(m_xVSWidth->GetItemData(iPos)), MapUnit::MapPoint, - m_eMapUnit); + pDev->DrawRect(tools::Rectangle(5, 10, 40, 11 + nIndex)); + } + else + { + assert(nIndex == 8 && "Invalid index"); + const Point aStartPoint( + (pDev->GetOutputWidthPixel() - m_aIMGCus.GetSizePixel().getWidth()) / 2, + (pDev->GetOutputHeightPixel() - m_aIMGCus.GetSizePixel().getHeight()) / 2); + pDev->DrawImage(aStartPoint, m_aIMGCus); + } + + return pDev; +} + +void LineWidthPopup::UnselectTreeViewItems() +{ + m_xWidthTreeView->unselect_all(); + m_xWidthTreeView->set_cursor(-1); +} + +IMPL_LINK(LineWidthPopup, TreeViewItemActivatedHdl, const weld::TreeIter&, rIter, bool) +{ + const int nPos = m_xWidthTreeView->get_iter_index_in_parent(rIter); + if (nPos >= 0 && nPos <= 7) + { + sal_Int64 nVal = OutputDevice::LogicToLogic(m_xWidthTreeView->get_id(rIter).toInt64(), + MapUnit::MapPoint, m_eMapUnit); nVal = m_xMFWidth->denormalize(nVal); XLineWidthItem aWidthItem(nVal); m_rParent.setLineWidth(aWidthItem); - m_rParent.SetWidthIcon(iPos); + m_rParent.SetWidthIcon(nPos + 1); m_rParent.SetWidth(nVal); } - else if (iPos == 9) + else if (nPos == 8) { //last custom //modified if (m_bCustom) @@ -117,27 +146,23 @@ IMPL_LINK_NOARG(LineWidthPopup, VSSelectHdl, ValueSet*, void) } else { - m_xVSWidth->SetNoSelection(); //add , set no selection and keep the last select item - m_xVSWidth->SetFormat(); - m_xVSWidth->Invalidate(); + // add: set no selection and keep the last selected item + m_xWidthTreeView->unselect_all(); } //modify end } - if ((iPos >= 1 && iPos <= 8) || (iPos == 9 && m_bCustom)) //add + if ((nPos >= 0 && nPos <= 7) || (nPos == 8 && m_bCustom)) //add { m_rParent.EndLineWidthPopup(); } + + return true; } IMPL_LINK_NOARG(LineWidthPopup, MFModifyHdl, weld::MetricSpinButton&, void) { - if (m_xVSWidth->GetSelItem()) - { - m_xVSWidth->SetSelItem(0); - m_xVSWidth->SetFormat(); - m_xVSWidth->Invalidate(); - } + UnselectTreeViewItems(); tools::Long nTmp = static_cast(m_xMFWidth->get_value(FieldUnit::NONE)); tools::Long nVal = OutputDevice::LogicToLogic(nTmp, MapUnit::MapPoint, m_eMapUnit); sal_Int32 nNewWidth = static_cast(m_xMFWidth->denormalize(nVal)); @@ -147,8 +172,8 @@ IMPL_LINK_NOARG(LineWidthPopup, MFModifyHdl, weld::MetricSpinButton&, void) void LineWidthPopup::SetWidthSelect(tools::Long lValue, bool bValuable, MapUnit eMapUnit) { - m_bVSFocus = true; - m_xVSWidth->SetSelItem(0); + m_bTreeViewFocus = true; + UnselectTreeViewItems(); m_eMapUnit = eMapUnit; SvtViewOptions aWinOpt(EViewType::Window, u"PopupPanel_LineWidth"_ustr); if (aWinOpt.Exists()) @@ -161,18 +186,16 @@ void LineWidthPopup::SetWidthSelect(tools::Long lValue, bool bValuable, MapUnit OUString aWinData(aTmp); m_nCustomWidth = aWinData.toInt32(); m_bCustom = true; - m_xVSWidth->SetImage(m_aIMGCus); - m_xVSWidth->SetCusEnable(true); + m_xWidthTreeView->set_sensitive(8, true); OUString aStrTip = OUString::number(static_cast(m_nCustomWidth) / 10) + m_sPt; - m_xVSWidth->SetItemText(9, aStrTip); + m_xWidthTreeView->set_text(8, aStrTip); } else { m_bCustom = false; - m_xVSWidth->SetImage(m_aIMGCusGray); - m_xVSWidth->SetCusEnable(false); - m_xVSWidth->SetItemText(9, maStrUnits[8]); + m_xWidthTreeView->set_sensitive(8, false); + m_xWidthTreeView->set_text(8, maStrUnits.at(8)); } if (bValuable) @@ -187,30 +210,28 @@ void LineWidthPopup::SetWidthSelect(tools::Long lValue, bool bValuable, MapUnit } OUString strCurrValue = m_xMFWidth->get_text(); - sal_uInt16 i = 0; + int i = 0; for (; i < 8; i++) { if (strCurrValue == maStrUnits[i]) { - m_xVSWidth->SetSelItem(i + 1); + m_xWidthTreeView->select(i); + m_xWidthTreeView->grab_focus(); break; } } if (i >= 8) { - m_bVSFocus = false; - m_xVSWidth->SetSelItem(0); + m_bTreeViewFocus = false; + UnselectTreeViewItems(); } - - m_xVSWidth->SetFormat(); - m_xVSWidth->Invalidate(); } void LineWidthPopup::GrabFocus() { - if (m_bVSFocus) - m_xVSWidth->GrabFocus(); + if (m_bTreeViewFocus) + m_xWidthTreeView->grab_focus(); else m_xMFWidth->grab_focus(); } diff --git a/svx/source/sidebar/line/LineWidthValueSet.cxx b/svx/source/sidebar/line/LineWidthValueSet.cxx deleted file mode 100644 index a8fc15ebd7dd..000000000000 --- a/svx/source/sidebar/line/LineWidthValueSet.cxx +++ /dev/null @@ -1,167 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include "LineWidthValueSet.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace svx::sidebar { - -LineWidthValueSet::LineWidthValueSet() - : ValueSet(nullptr) - , nSelItem(0) - , bCusEnable(false) -{ -} - -void LineWidthValueSet::Resize() -{ - SetColCount(); - SetLineCount(9); - ValueSet::Resize(); -} - -LineWidthValueSet::~LineWidthValueSet() -{ -} - -void LineWidthValueSet::SetUnit(std::array const & strUnits) -{ - maStrUnits = strUnits; -} - -void LineWidthValueSet::SetSelItem(sal_uInt16 nSel) -{ - nSelItem = nSel; - if(nSel == 0) - { - SelectItem(1); // ,false); // 'false' nut supported by AOO - SetNoSelection(); - } - else - { - SelectItem(nSelItem); - GrabFocus(); - } -} - -void LineWidthValueSet::SetImage(const Image& img) -{ - imgCus = img; -} - -void LineWidthValueSet::SetCusEnable(bool bEnable) -{ - bCusEnable = bEnable; -} - -void LineWidthValueSet::UserDraw( const UserDrawEvent& rUDEvt ) -{ - tools::Rectangle aRect = rUDEvt.GetRect(); - vcl::RenderContext* pDev = rUDEvt.GetRenderContext(); - sal_uInt16 nItemId = rUDEvt.GetItemId(); - - tools::Long nRectHeight = aRect.GetHeight(); - tools::Long nRectWidth = aRect.GetWidth(); - Point aBLPos = aRect.TopLeft(); - - //const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - //Color aBackColor(0,0,200); - //const Color aTextColor = rStyleSettings.GetFieldTextColor(); - auto popIt = pDev->ScopedPush(vcl::PushFlags::FONT | vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR); - - vcl::Font aFont(OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, MsLangId::getConfiguredSystemLanguage(), GetDefaultFontFlags::OnlyOne)); - Size aSize = aFont.GetFontSize(); - aSize.setHeight( nRectHeight*3/5 ); - aFont.SetFontSize( aSize ); - - Point aLineStart(aBLPos.X() + 5, aBLPos.Y() + ( nRectHeight - nItemId )/2); - Point aLineEnd(aBLPos.X() + nRectWidth * 7 / 9 - 10, aBLPos.Y() + ( nRectHeight - nItemId )/2); - if (nItemId == 9) - { - Point aImgStart(aBLPos.X() + 5, aBLPos.Y() + ( nRectHeight - 23 ) / 2); - pDev->DrawImage(aImgStart, imgCus); - - tools::Rectangle aStrRect = aRect; - aStrRect.AdjustTop(nRectHeight/6 ); - aStrRect.AdjustBottom( -(nRectHeight/6) ); - aStrRect.AdjustLeft(imgCus.GetSizePixel().Width() + 20 ); - if(bCusEnable) - aFont.SetColor(Application::GetSettings().GetStyleSettings().GetFieldTextColor()); - else - aFont.SetColor(Application::GetSettings().GetStyleSettings().GetDisableColor()); - - pDev->SetFont(aFont); - pDev->DrawText(aStrRect, maStrUnits[ nItemId - 1 ], DrawTextFlags::EndEllipsis); - } - else - { - if( nSelItem == nItemId ) - { - tools::Rectangle aBackRect = aRect; - aBackRect.AdjustTop(3 ); - aBackRect.AdjustBottom( -2 ); - pDev->SetFillColor(Color(50,107,197)); - pDev->DrawRect(aBackRect); - } - - //draw text - if(nSelItem == nItemId ) - aFont.SetColor(COL_WHITE); - else - aFont.SetColor(Application::GetSettings().GetStyleSettings().GetFieldTextColor()); - pDev->SetFont(aFont); - Point aStart(aBLPos.X() + nRectWidth * 7 / 9 , aBLPos.Y() + nRectHeight/6); - pDev->DrawText(aStart, maStrUnits[ nItemId - 1 ]); //can't set DrawTextFlags::EndEllipsis here ,or the text will disappear - - //draw line - if( nSelItem == nItemId ) - pDev->SetLineColor(COL_WHITE); - else - pDev->SetLineColor(Application::GetSettings().GetStyleSettings().GetFieldTextColor()); - - for(sal_uInt16 i = 1; i <= nItemId; i++) - { - pDev->DrawLine(aLineStart,aLineEnd ); - aLineStart.setY(aLineStart.getY() + 1); - aLineEnd.setY (aLineEnd.getY() + 1); - } - } - - Invalidate( aRect ); -} - -void LineWidthValueSet::SetDrawingArea(weld::DrawingArea* pDrawingArea) -{ - ValueSet::SetDrawingArea(pDrawingArea); - Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(80, 12 * 9), MapMode(MapUnit::MapAppFont))); - pDrawingArea->set_size_request(aSize.Width(), aSize.Height()); - SetOutputSizePixel(aSize); - SetColor(Application::GetSettings().GetStyleSettings().GetListBoxWindowBackgroundColor()); -} - -} // end of namespace svx::sidebar - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/line/LineWidthValueSet.hxx b/svx/source/sidebar/line/LineWidthValueSet.hxx deleted file mode 100644 index 225e706a6d6e..000000000000 --- a/svx/source/sidebar/line/LineWidthValueSet.hxx +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHVALUESET_HXX -#define INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHVALUESET_HXX - -#include -#include -#include - -namespace svx::sidebar { - -class LineWidthValueSet final : public ValueSet -{ -public: - explicit LineWidthValueSet(); - virtual ~LineWidthValueSet() override; - - void SetUnit(std::array const & strUnits); - void SetSelItem(sal_uInt16 nSel); - sal_uInt16 GetSelItem() const { return nSelItem;} - void SetImage(const Image& img); - void SetCusEnable(bool bEnable); - - virtual void UserDraw( const UserDrawEvent& rUDEvt ) override; - virtual void Resize() override; - virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; - -private: - sal_uInt16 nSelItem; - std::array maStrUnits; - Image imgCus; - bool bCusEnable; -}; - -} // end of namespace svx::sidebar - -#endif // INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHVALUESET_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx index 4275da409e1b..48238caf54f7 100644 --- a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx +++ b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx @@ -21,38 +21,28 @@ #include #include #include +#include #include #include #include #include -#include +#include namespace svx::sidebar { -DefaultShapesPanel::DefaultShapesPanel ( - weld::Widget* pParent, - css::uno::Reference xFrame) +DefaultShapesPanel::DefaultShapesPanel(weld::Widget* pParent, + css::uno::Reference xFrame) : PanelLayout(pParent, u"DefaultShapesPanel"_ustr, u"svx/ui/defaultshapespanel.ui"_ustr) - , mxLineArrowSet(new ValueSet(nullptr)) - , mxLineArrowSetWin(new weld::CustomWeld(*m_xBuilder, u"LinesArrows"_ustr, *mxLineArrowSet)) - , mxCurveSet(new ValueSet(nullptr)) - , mxCurveSetWin(new weld::CustomWeld(*m_xBuilder, u"Curves"_ustr, *mxCurveSet)) - , mxConnectorSet(new ValueSet(nullptr)) - , mxConnectorSetWin(new weld::CustomWeld(*m_xBuilder, u"Connectors"_ustr, *mxConnectorSet)) - , mxBasicShapeSet(new ValueSet(nullptr)) - , mxBasicShapeSetWin(new weld::CustomWeld(*m_xBuilder, u"BasicShapes"_ustr, *mxBasicShapeSet)) - , mxSymbolShapeSet(new ValueSet(nullptr)) - , mxSymbolShapeSetWin(new weld::CustomWeld(*m_xBuilder, u"SymbolShapes"_ustr, *mxSymbolShapeSet)) - , mxBlockArrowSet(new ValueSet(nullptr)) - , mxBlockArrowSetWin(new weld::CustomWeld(*m_xBuilder, u"BlockArrows"_ustr, *mxBlockArrowSet)) - , mxFlowchartSet(new ValueSet(nullptr)) - , mxFlowchartSetWin(new weld::CustomWeld(*m_xBuilder, u"Flowcharts"_ustr, *mxFlowchartSet)) - , mxCalloutSet(new ValueSet(nullptr)) - , mxCalloutSetWin(new weld::CustomWeld(*m_xBuilder, u"Callouts"_ustr, *mxCalloutSet)) - , mxStarSet(new ValueSet(nullptr)) - , mxStarSetWin(new weld::CustomWeld(*m_xBuilder, u"Stars"_ustr, *mxStarSet)) - , mx3DObjectSet(new ValueSet(nullptr)) - , mx3DObjectSetWin(new weld::CustomWeld(*m_xBuilder, u"3DObjects"_ustr, *mx3DObjectSet)) + , m_pLineArrowIconView(m_xBuilder->weld_icon_view(u"LinesArrows"_ustr)) + , m_pCurveIconView(m_xBuilder->weld_icon_view(u"Curves"_ustr)) + , m_pConnectorIconView(m_xBuilder->weld_icon_view(u"Connectors"_ustr)) + , m_pBasicShapeIconView(m_xBuilder->weld_icon_view(u"BasicShapes"_ustr)) + , m_pSymbolShapeIconView(m_xBuilder->weld_icon_view(u"SymbolShapes"_ustr)) + , m_pBlockArrowIconView(m_xBuilder->weld_icon_view(u"BlockArrows"_ustr)) + , m_pFlowchartIconView(m_xBuilder->weld_icon_view(u"Flowcharts"_ustr)) + , m_pCalloutIconView(m_xBuilder->weld_icon_view(u"Callouts"_ustr)) + , m_pStarIconView(m_xBuilder->weld_icon_view(u"Stars"_ustr)) + , m_p3DObjectIconView(m_xBuilder->weld_icon_view(u"3DObjects"_ustr)) , mxFrame(std::move(xFrame)) { Initialize(); @@ -74,83 +64,53 @@ std::unique_ptr DefaultShapesPanel::Create( void DefaultShapesPanel::Initialize() { - mpShapesSetMap = decltype(mpShapesSetMap){ - { mxLineArrowSet.get(), mpLineShapes }, - { mxCurveSet.get(), mpCurveShapes }, - { mxConnectorSet.get(), mpConnectorShapes }, - { mxBasicShapeSet.get(), mpBasicShapes }, - { mxSymbolShapeSet.get(), mpSymbolShapes }, - { mxBlockArrowSet.get(), mpBlockArrowShapes }, - { mxFlowchartSet.get(), mpFlowchartShapes }, - { mxCalloutSet.get(), mpCalloutShapes }, - { mxStarSet.get(), mpStarShapes }, - { mx3DObjectSet.get(), mp3DShapes } - }; - populateShapes(); - for(auto& aSetMap: mpShapesSetMap) + const std::map> aShapesViewsMap + = { { m_pLineArrowIconView.get(), m_aLineShapes }, + { m_pCurveIconView.get(), m_aCurveShapes }, + { m_pConnectorIconView.get(), m_aConnectorShapes }, + { m_pBasicShapeIconView.get(), m_aBasicShapes }, + { m_pSymbolShapeIconView.get(), m_aSymbolShapes }, + { m_pBlockArrowIconView.get(), m_aBlockArrowShapes }, + { m_pFlowchartIconView.get(), m_aFlowchartShapes }, + { m_pCalloutIconView.get(), m_aCalloutShapes }, + { m_pStarIconView.get(), m_aStarShapes }, + { m_p3DObjectIconView.get(), m_a3DShapes } }; + + for (auto& rEntry : aShapesViewsMap) { - aSetMap.first->SetColor(Application::GetSettings().GetStyleSettings().GetDialogColor()); - aSetMap.first->SetSelectHdl(LINK(this, DefaultShapesPanel, ShapeSelectHdl)); + for (size_t i = 0; i < rEntry.second.size(); i++) + { + const OUString sSlotStr = rEntry.second.at(i); + const Bitmap aSlotImage + = vcl::CommandInfoProvider::GetImageForCommand(sSlotStr, mxFrame).GetBitmap(); + auto aProperties = vcl::CommandInfoProvider::GetCommandProperties( + sSlotStr, vcl::CommandInfoProvider::GetModuleIdentifier(mxFrame)); + const OUString sLabel + = vcl::CommandInfoProvider::GetTooltipForCommand(sSlotStr, aProperties, mxFrame); + rEntry.first->insert(i, nullptr, &sSlotStr, &aSlotImage, nullptr); + rEntry.first->set_item_accessible_name(i, sLabel); + rEntry.first->set_item_tooltip_text(i, sLabel); + } + + rEntry.first->connect_item_activated(LINK(this, DefaultShapesPanel, ShapeActivatedHdl)); + m_aShapesViews.push_back(rEntry.first); } } -DefaultShapesPanel::~DefaultShapesPanel() -{ - mpShapesSetMap.clear(); - mxLineArrowSetWin.reset(); - mxLineArrowSet.reset(); - mxCurveSetWin.reset(); - mxCurveSet.reset(); - mxConnectorSetWin.reset(); - mxConnectorSet.reset(); - mxBasicShapeSetWin.reset(); - mxBasicShapeSet.reset(); - mxSymbolShapeSetWin.reset(); - mxSymbolShapeSet.reset(); - mxBlockArrowSetWin.reset(); - mxBlockArrowSet.reset(); - mxFlowchartSetWin.reset(); - mxFlowchartSet.reset(); - mxCalloutSetWin.reset(); - mxCalloutSet.reset(); - mxStarSetWin.reset(); - mxStarSet.reset(); - mx3DObjectSetWin.reset(); - mx3DObjectSet.reset(); -} +DefaultShapesPanel::~DefaultShapesPanel() { m_aShapesViews.clear(); } -IMPL_LINK(DefaultShapesPanel, ShapeSelectHdl, ValueSet*, rValueSet, void) +IMPL_LINK(DefaultShapesPanel, ShapeActivatedHdl, const weld::TreeIter&, rIter, bool) { - for(auto& aSetMap : mpShapesSetMap) + const weld::ItemView& rActiveItemView = rIter.getItemView(); + for (weld::IconView* pView : m_aShapesViews) { - if(rValueSet == aSetMap.first) - { - sal_uInt16 nSelectionId = aSetMap.first->GetSelectedItemId(); - comphelper::dispatchCommand(aSetMap.second[nSelectionId - 1], {}); - } + if (&rActiveItemView == pView) + comphelper::dispatchCommand(rActiveItemView.get_id(rIter), {}); else - aSetMap.first->SetNoSelection(); + pView->unselect_all(); } -} -void DefaultShapesPanel::populateShapes() -{ - OUString sSlotStr, sLabel; - Image aSlotImage; - for(auto& aSet : mpShapesSetMap) - { - aSet.first->SetColCount(6); - for(std::map::size_type i = 0; i < aSet.second.size(); i++) - { - sSlotStr = aSet.second[i]; - aSlotImage = vcl::CommandInfoProvider::GetImageForCommand(sSlotStr, mxFrame); - auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sSlotStr, - vcl::CommandInfoProvider::GetModuleIdentifier(mxFrame)); - sLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sSlotStr, aProperties, mxFrame); - sal_uInt16 nSelectionId = i + 1; // tdf#142767 id 0 is reserved for nothing-selected - aSet.first->InsertItem(nSelectionId, aSlotImage, sLabel); - } - } + return true; } } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/shapes/ShapesUtil.cxx b/svx/source/sidebar/shapes/ShapesUtil.cxx index 3f238030d8ef..0fb6a1450177 100644 --- a/svx/source/sidebar/shapes/ShapesUtil.cxx +++ b/svx/source/sidebar/shapes/ShapesUtil.cxx @@ -18,196 +18,195 @@ */ #include -#include #include namespace svx::sidebar{ SvxShapeCommandsMap::SvxShapeCommandsMap() { - mpLineShapes = decltype(mpLineShapes){ - {0, ".uno:Line"}, - {1, ".uno:LineArrowEnd"}, - {2, ".uno:LineCircleArrow"}, - {3, ".uno:LineSquareArrow"}, - {4, ".uno:LineArrows"}, - {5, ".uno:LineArrowStart"}, - {6, ".uno:LineArrowCircle"}, - {7, ".uno:LineArrowSquare"}, - {8, ".uno:MeasureLine"}, - {9, ".uno:Line_Diagonal"} + m_aLineShapes = { + u".uno:Line"_ustr, + u".uno:LineArrowEnd"_ustr, + u".uno:LineCircleArrow"_ustr, + u".uno:LineSquareArrow"_ustr, + u".uno:LineArrows"_ustr, + u".uno:LineArrowStart"_ustr, + u".uno:LineArrowCircle"_ustr, + u".uno:LineArrowSquare"_ustr, + u".uno:MeasureLine"_ustr, + u".uno:Line_Diagonal"_ustr }; - mpCurveShapes = decltype(mpCurveShapes){ - {0, ".uno:Freeline_Unfilled"}, - {1, ".uno:Bezier_Unfilled"}, - {2, ".uno:Polygon_Unfilled"}, - {3, ".uno:Polygon_Diagonal_Unfilled"}, - {4, ".uno:Freeline"}, - {5, ".uno:BezierFill"}, - {6, ".uno:Polygon"}, - {7, ".uno:Polygon_Diagonal"} + m_aCurveShapes = { + u".uno:Freeline_Unfilled"_ustr, + u".uno:Bezier_Unfilled"_ustr, + u".uno:Polygon_Unfilled"_ustr, + u".uno:Polygon_Diagonal_Unfilled"_ustr, + u".uno:Freeline"_ustr, + u".uno:BezierFill"_ustr, + u".uno:Polygon"_ustr, + u".uno:Polygon_Diagonal"_ustr }; - mpConnectorShapes = decltype(mpConnectorShapes){ - {0, ".uno:ConnectorArrowEnd"}, - {1, ".uno:ConnectorLineArrowEnd"}, - {2, ".uno:ConnectorCurveArrowEnd"}, - {3, ".uno:ConnectorLinesArrowEnd"}, - {4, ".uno:Connector"}, - {5, ".uno:ConnectorLine"}, - {6, ".uno:ConnectorCurve"}, - {7, ".uno:ConnectorLines"}, - {8, ".uno:ConnectorArrows"}, - {9, ".uno:ConnectorLineArrows"}, - {10, ".uno:ConnectorCurveArrows"}, - {11, ".uno:ConnectorLinesArrows"} + m_aConnectorShapes = { + u".uno:ConnectorArrowEnd"_ustr, + u".uno:ConnectorLineArrowEnd"_ustr, + u".uno:ConnectorCurveArrowEnd"_ustr, + u".uno:ConnectorLinesArrowEnd"_ustr, + u".uno:Connector"_ustr, + u".uno:ConnectorLine"_ustr, + u".uno:ConnectorCurve"_ustr, + u".uno:ConnectorLines"_ustr, + u".uno:ConnectorArrows"_ustr, + u".uno:ConnectorLineArrows"_ustr, + u".uno:ConnectorCurveArrows"_ustr, + u".uno:ConnectorLinesArrows"_ustr }; - mpBasicShapes = decltype(mpBasicShapes){ - {0, ".uno:BasicShapes.rectangle"}, - {1, ".uno:BasicShapes.round-rectangle"}, - {2, ".uno:BasicShapes.quadrat"}, - {3, ".uno:BasicShapes.round-quadrat"}, - {4, ".uno:BasicShapes.parallelogram"}, - {5, ".uno:BasicShapes.trapezoid"}, - {6, ".uno:BasicShapes.ellipse"}, - {7, ".uno:BasicShapes.circle"}, - {8, ".uno:BasicShapes.circle-pie"}, - {9, ".uno:CircleCut"}, - {10, ".uno:Arc"}, - {11, ".uno:BasicShapes.block-arc"}, - {12, ".uno:BasicShapes.isosceles-triangle"}, - {13, ".uno:BasicShapes.right-triangle"}, - {14, ".uno:BasicShapes.diamond"}, - {15, ".uno:BasicShapes.pentagon"}, - {16, ".uno:BasicShapes.hexagon"}, - {17, ".uno:BasicShapes.octagon"}, - {18, ".uno:BasicShapes.cross"}, - {19, ".uno:BasicShapes.can"}, - {20, ".uno:BasicShapes.cube"}, - {21, ".uno:BasicShapes.paper"}, - {22, ".uno:BasicShapes.frame"}, - {23, ".uno:BasicShapes.ring"}, - {24, ".uno:BasicShapes.sinusoid"} + m_aBasicShapes = { + u".uno:BasicShapes.rectangle"_ustr, + u".uno:BasicShapes.round-rectangle"_ustr, + u".uno:BasicShapes.quadrat"_ustr, + u".uno:BasicShapes.round-quadrat"_ustr, + u".uno:BasicShapes.parallelogram"_ustr, + u".uno:BasicShapes.trapezoid"_ustr, + u".uno:BasicShapes.ellipse"_ustr, + u".uno:BasicShapes.circle"_ustr, + u".uno:BasicShapes.circle-pie"_ustr, + u".uno:CircleCut"_ustr, + u".uno:Arc"_ustr, + u".uno:BasicShapes.block-arc"_ustr, + u".uno:BasicShapes.isosceles-triangle"_ustr, + u".uno:BasicShapes.right-triangle"_ustr, + u".uno:BasicShapes.diamond"_ustr, + u".uno:BasicShapes.pentagon"_ustr, + u".uno:BasicShapes.hexagon"_ustr, + u".uno:BasicShapes.octagon"_ustr, + u".uno:BasicShapes.cross"_ustr, + u".uno:BasicShapes.can"_ustr, + u".uno:BasicShapes.cube"_ustr, + u".uno:BasicShapes.paper"_ustr, + u".uno:BasicShapes.frame"_ustr, + u".uno:BasicShapes.ring"_ustr, + u".uno:BasicShapes.sinusoid"_ustr }; - mpSymbolShapes = decltype(mpSymbolShapes){ - {0, ".uno:SymbolShapes.smiley"}, - {1, ".uno:SymbolShapes.sun"}, - {2, ".uno:SymbolShapes.moon"}, - {3, ".uno:SymbolShapes.lightning"}, - {4, ".uno:SymbolShapes.heart"}, - {5, ".uno:SymbolShapes.flower"}, - {6, ".uno:SymbolShapes.cloud"}, - {7, ".uno:SymbolShapes.forbidden"}, - {8, ".uno:SymbolShapes.puzzle"}, - {9, ".uno:SymbolShapes.bracket-pair"}, - {10, ".uno:SymbolShapes.left-bracket"}, - {11, ".uno:SymbolShapes.right-bracket"}, - {12, ".uno:SymbolShapes.brace-pair"}, - {13, ".uno:SymbolShapes.left-brace"}, - {14, ".uno:SymbolShapes.right-brace"}, - {15, ".uno:SymbolShapes.quad-bevel"}, - {16, ".uno:SymbolShapes.octagon-bevel"}, - {17, ".uno:SymbolShapes.diamond-bevel"} + m_aSymbolShapes = { + u".uno:SymbolShapes.smiley"_ustr, + u".uno:SymbolShapes.sun"_ustr, + u".uno:SymbolShapes.moon"_ustr, + u".uno:SymbolShapes.lightning"_ustr, + u".uno:SymbolShapes.heart"_ustr, + u".uno:SymbolShapes.flower"_ustr, + u".uno:SymbolShapes.cloud"_ustr, + u".uno:SymbolShapes.forbidden"_ustr, + u".uno:SymbolShapes.puzzle"_ustr, + u".uno:SymbolShapes.bracket-pair"_ustr, + u".uno:SymbolShapes.left-bracket"_ustr, + u".uno:SymbolShapes.right-bracket"_ustr, + u".uno:SymbolShapes.brace-pair"_ustr, + u".uno:SymbolShapes.left-brace"_ustr, + u".uno:SymbolShapes.right-brace"_ustr, + u".uno:SymbolShapes.quad-bevel"_ustr, + u".uno:SymbolShapes.octagon-bevel"_ustr, + u".uno:SymbolShapes.diamond-bevel"_ustr }; - mpBlockArrowShapes = decltype(mpBlockArrowShapes){ - {0, ".uno:ArrowShapes.left-arrow"}, - {1, ".uno:ArrowShapes.right-arrow"}, - {2, ".uno:ArrowShapes.up-arrow"}, - {3, ".uno:ArrowShapes.down-arrow"}, - {4, ".uno:ArrowShapes.left-right-arrow"}, - {5, ".uno:ArrowShapes.up-down-arrow"}, - {6, ".uno:ArrowShapes.up-right-arrow"}, - {7, ".uno:ArrowShapes.up-right-down-arrow"}, - {8, ".uno:ArrowShapes.quad-arrow"}, - {9, ".uno:ArrowShapes.corner-right-arrow"}, - {10, ".uno:ArrowShapes.split-arrow"}, - {11, ".uno:ArrowShapes.striped-right-arrow"}, - {12, ".uno:ArrowShapes.notched-right-arrow"}, - {13, ".uno:ArrowShapes.pentagon-right"}, - {14, ".uno:ArrowShapes.chevron"}, - {15, ".uno:ArrowShapes.right-arrow-callout"}, - {16, ".uno:ArrowShapes.left-arrow-callout"}, - {17, ".uno:ArrowShapes.up-arrow-callout"}, - {18, ".uno:ArrowShapes.left-right-arrow-callout"}, - {19, ".uno:ArrowShapes.up-down-arrow-callout"}, - {20, ".uno:ArrowShapes.up-right-arrow-callout"}, - {21, ".uno:ArrowShapes.quad-arrow-callout"}, - {22, ".uno:ArrowShapes.circular-arrow"}, - {23, ".uno:ArrowShapes.down-arrow-callout"}, - {24, ".uno:ArrowShapes.split-round-arrow"}, - {25, ".uno:ArrowShapes.s-sharped-arrow"} + m_aBlockArrowShapes = { + u".uno:ArrowShapes.left-arrow"_ustr, + u".uno:ArrowShapes.right-arrow"_ustr, + u".uno:ArrowShapes.up-arrow"_ustr, + u".uno:ArrowShapes.down-arrow"_ustr, + u".uno:ArrowShapes.left-right-arrow"_ustr, + u".uno:ArrowShapes.up-down-arrow"_ustr, + u".uno:ArrowShapes.up-right-arrow"_ustr, + u".uno:ArrowShapes.up-right-down-arrow"_ustr, + u".uno:ArrowShapes.quad-arrow"_ustr, + u".uno:ArrowShapes.corner-right-arrow"_ustr, + u".uno:ArrowShapes.split-arrow"_ustr, + u".uno:ArrowShapes.striped-right-arrow"_ustr, + u".uno:ArrowShapes.notched-right-arrow"_ustr, + u".uno:ArrowShapes.pentagon-right"_ustr, + u".uno:ArrowShapes.chevron"_ustr, + u".uno:ArrowShapes.right-arrow-callout"_ustr, + u".uno:ArrowShapes.left-arrow-callout"_ustr, + u".uno:ArrowShapes.up-arrow-callout"_ustr, + u".uno:ArrowShapes.left-right-arrow-callout"_ustr, + u".uno:ArrowShapes.up-down-arrow-callout"_ustr, + u".uno:ArrowShapes.up-right-arrow-callout"_ustr, + u".uno:ArrowShapes.quad-arrow-callout"_ustr, + u".uno:ArrowShapes.circular-arrow"_ustr, + u".uno:ArrowShapes.down-arrow-callout"_ustr, + u".uno:ArrowShapes.split-round-arrow"_ustr, + u".uno:ArrowShapes.s-sharped-arrow"_ustr }; - mpFlowchartShapes = decltype(mpFlowchartShapes){ - {0, ".uno:FlowChartShapes.flowchart-process"}, - {1, ".uno:FlowChartShapes.flowchart-alternate-process"}, - {2, ".uno:FlowChartShapes.flowchart-decision"}, - {3, ".uno:FlowChartShapes.flowchart-data"}, - {4, ".uno:FlowChartShapes.flowchart-predefined-process"}, - {5, ".uno:FlowChartShapes.flowchart-internal-storage"}, - {6, ".uno:FlowChartShapes.flowchart-document"}, - {7, ".uno:FlowChartShapes.flowchart-multidocument"}, - {8, ".uno:FlowChartShapes.flowchart-terminator"}, - {9, ".uno:FlowChartShapes.flowchart-preparation"}, - {10, ".uno:FlowChartShapes.flowchart-manual-input"}, - {11, ".uno:FlowChartShapes.flowchart-manual-operation"}, - {12, ".uno:FlowChartShapes.flowchart-connector"}, - {13, ".uno:FlowChartShapes.flowchart-off-page-connector"}, - {14, ".uno:FlowChartShapes.flowchart-card"}, - {15, ".uno:FlowChartShapes.flowchart-punched-tape"}, - {16, ".uno:FlowChartShapes.flowchart-summing-junction"}, - {17, ".uno:FlowChartShapes.flowchart-or"}, - {18, ".uno:FlowChartShapes.flowchart-collate"}, - {19, ".uno:FlowChartShapes.flowchart-sort"}, - {20, ".uno:FlowChartShapes.flowchart-extract"}, - {21, ".uno:FlowChartShapes.flowchart-merge"}, - {22, ".uno:FlowChartShapes.flowchart-stored-data"}, - {23, ".uno:FlowChartShapes.flowchart-delay"}, - {24, ".uno:FlowChartShapes.flowchart-sequential-access"}, - {25, ".uno:FlowChartShapes.flowchart-magnetic-disk"}, - {26, ".uno:FlowChartShapes.flowchart-direct-access-storage"}, - {27, ".uno:FlowChartShapes.flowchart-display"} + m_aFlowchartShapes = { + u".uno:FlowChartShapes.flowchart-process"_ustr, + u".uno:FlowChartShapes.flowchart-alternate-process"_ustr, + u".uno:FlowChartShapes.flowchart-decision"_ustr, + u".uno:FlowChartShapes.flowchart-data"_ustr, + u".uno:FlowChartShapes.flowchart-predefined-process"_ustr, + u".uno:FlowChartShapes.flowchart-internal-storage"_ustr, + u".uno:FlowChartShapes.flowchart-document"_ustr, + u".uno:FlowChartShapes.flowchart-multidocument"_ustr, + u".uno:FlowChartShapes.flowchart-terminator"_ustr, + u".uno:FlowChartShapes.flowchart-preparation"_ustr, + u".uno:FlowChartShapes.flowchart-manual-input"_ustr, + u".uno:FlowChartShapes.flowchart-manual-operation"_ustr, + u".uno:FlowChartShapes.flowchart-connector"_ustr, + u".uno:FlowChartShapes.flowchart-off-page-connector"_ustr, + u".uno:FlowChartShapes.flowchart-card"_ustr, + u".uno:FlowChartShapes.flowchart-punched-tape"_ustr, + u".uno:FlowChartShapes.flowchart-summing-junction"_ustr, + u".uno:FlowChartShapes.flowchart-or"_ustr, + u".uno:FlowChartShapes.flowchart-collate"_ustr, + u".uno:FlowChartShapes.flowchart-sort"_ustr, + u".uno:FlowChartShapes.flowchart-extract"_ustr, + u".uno:FlowChartShapes.flowchart-merge"_ustr, + u".uno:FlowChartShapes.flowchart-stored-data"_ustr, + u".uno:FlowChartShapes.flowchart-delay"_ustr, + u".uno:FlowChartShapes.flowchart-sequential-access"_ustr, + u".uno:FlowChartShapes.flowchart-magnetic-disk"_ustr, + u".uno:FlowChartShapes.flowchart-direct-access-storage"_ustr, + u".uno:FlowChartShapes.flowchart-display"_ustr }; - mpCalloutShapes = decltype(mpCalloutShapes){ - {0, ".uno:CalloutShapes.rectangular-callout"}, - {1, ".uno:CalloutShapes.round-rectangular-callout"}, - {2, ".uno:CalloutShapes.round-callout"}, - {3, ".uno:CalloutShapes.cloud-callout"}, - {4, ".uno:CalloutShapes.line-callout-1"}, - {5, ".uno:CalloutShapes.line-callout-2"}, - {6, ".uno:CalloutShapes.line-callout-3"} + m_aCalloutShapes = { + u".uno:CalloutShapes.rectangular-callout"_ustr, + u".uno:CalloutShapes.round-rectangular-callout"_ustr, + u".uno:CalloutShapes.round-callout"_ustr, + u".uno:CalloutShapes.cloud-callout"_ustr, + u".uno:CalloutShapes.line-callout-1"_ustr, + u".uno:CalloutShapes.line-callout-2"_ustr, + u".uno:CalloutShapes.line-callout-3"_ustr }; - mpStarShapes = decltype(mpStarShapes){ - {0, ".uno:StarShapes.star4"}, - {1, ".uno:StarShapes.star5"}, - {2, ".uno:StarShapes.star6"}, - {3, ".uno:StarShapes.star8"}, - {4, ".uno:StarShapes.star12"}, - {5, ".uno:StarShapes.star24"}, - {6, ".uno:StarShapes.bang"}, - {7, ".uno:StarShapes.vertical-scroll"}, - {8, ".uno:StarShapes.horizontal-scroll"}, - {9, ".uno:StarShapes.signet"}, - {10, ".uno:StarShapes.doorplate"}, - {11, ".uno:StarShapes.concave-star6"} + m_aStarShapes = { + u".uno:StarShapes.star4"_ustr, + u".uno:StarShapes.star5"_ustr, + u".uno:StarShapes.star6"_ustr, + u".uno:StarShapes.star8"_ustr, + u".uno:StarShapes.star12"_ustr, + u".uno:StarShapes.star24"_ustr, + u".uno:StarShapes.bang"_ustr, + u".uno:StarShapes.vertical-scroll"_ustr, + u".uno:StarShapes.horizontal-scroll"_ustr, + u".uno:StarShapes.signet"_ustr, + u".uno:StarShapes.doorplate"_ustr, + u".uno:StarShapes.concave-star6"_ustr }; - mp3DShapes = decltype(mp3DShapes){ - {0, ".uno:Cube"}, - {1, ".uno:Sphere"}, - {2, ".uno:Cylinder"}, - {3, ".uno:Cone"}, - {4, ".uno:Cyramid"}, - {5, ".uno:Torus"}, - {6, ".uno:Shell3D"}, - {7, ".uno:HalfSphere"} + m_a3DShapes = { + u".uno:Cube"_ustr, + u".uno:Sphere"_ustr, + u".uno:Cylinder"_ustr, + u".uno:Cone"_ustr, + u".uno:Cyramid"_ustr, + u".uno:Torus"_ustr, + u".uno:Shell3D"_ustr, + u".uno:HalfSphere"_ustr }; } } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 0babec0b46d9..69b8e1d3fa24 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -63,7 +63,6 @@ #include #include #include -#include #include #include #include @@ -75,7 +74,6 @@ #include #include #include -#include #include #include #include @@ -187,7 +185,6 @@ static ItemInfoPackage& getItemInfoPackageSdr() { XATTR_LINETRANSPARENCE, new XLineTransparenceItem, SID_ATTR_LINE_TRANSPARENCE, SFX_ITEMINFOFLAG_NONE }, { XATTR_LINEJOINT, new XLineJointItem, SID_ATTR_LINE_JOINT, SFX_ITEMINFOFLAG_NONE }, { XATTR_LINECAP, new XLineCapItem, SID_ATTR_LINE_CAP, SFX_ITEMINFOFLAG_NONE }, - { XATTRSET_LINE, nullptr, 0, SFX_ITEMINFOFLAG_NONE }, { XATTR_FILLSTYLE, new XFillStyleItem, SID_ATTR_FILL_STYLE, SFX_ITEMINFOFLAG_NONE }, { XATTR_FILLCOLOR, new XFillColorItem (OUString(), COL_DEFAULT_SHAPE_FILLING), SID_ATTR_FILL_COLOR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, { XATTR_FILLGRADIENT, new XFillGradientItem(basegfx::BGradient()), SID_ATTR_FILL_GRADIENT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, @@ -209,7 +206,6 @@ static ItemInfoPackage& getItemInfoPackageSdr() { XATTR_FILLBMP_POSOFFSETY, new XFillBmpPosOffsetYItem, 0, SFX_ITEMINFOFLAG_NONE }, { XATTR_FILLBACKGROUND, new XFillBackgroundItem, 0, SFX_ITEMINFOFLAG_NONE }, { XATTR_FILLUSESLIDEBACKGROUND, new XFillUseSlideBackgroundItem, SID_ATTR_FILL_USE_SLIDE_BACKGROUND, SFX_ITEMINFOFLAG_NONE }, - { XATTRSET_FILL, nullptr, 0, SFX_ITEMINFOFLAG_NONE }, { XATTR_FORMTXTSTYLE, new XFormTextStyleItem, SID_FORMTEXT_STYLE, SFX_ITEMINFOFLAG_NONE }, { XATTR_FORMTXTADJUST, new XFormTextAdjustItem, SID_FORMTEXT_ADJUST, SFX_ITEMINFOFLAG_NONE }, { XATTR_FORMTXTDISTANCE, new XFormTextDistanceItem, SID_FORMTEXT_DISTANCE, SFX_ITEMINFOFLAG_NONE }, @@ -467,7 +463,7 @@ static ItemInfoPackage& getItemInfoPackageSdr() } virtual size_t size() const override { return maItemInfos.size(); } - virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& rPool) override + virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { const ItemInfo& rRetval(maItemInfos[nIndex]); @@ -475,12 +471,6 @@ static ItemInfoPackage& getItemInfoPackageSdr() if (nullptr != rRetval.getItem()) return rRetval; - if (XATTRSET_LINE == rRetval.getWhich()) - return *new ItemInfoDynamic(rRetval, new XLineAttrSetItem(SfxItemSet(rPool, WhichRangesContainer(svl::Items)))); - - if (XATTRSET_FILL == rRetval.getWhich()) - return *new ItemInfoDynamic(rRetval, new XFillAttrSetItem(SfxItemSet(rPool, WhichRangesContainer(svl::Items)))); - if (XATTR_FILLBITMAP == rRetval.getWhich()) return *new ItemInfoDynamic(rRetval, new XFillBitmapItem(Graphic())); @@ -563,7 +553,6 @@ OUString SdrItemPool::GetItemName(sal_uInt16 nWhich) case XATTR_LINEENDCENTER : pResId = SIP_XA_LINEENDCENTER;break; case XATTR_LINETRANSPARENCE : pResId = SIP_XA_LINETRANSPARENCE;break; case XATTR_LINEJOINT : pResId = SIP_XA_LINEJOINT;break; - case XATTRSET_LINE : pResId = SIP_XATTRSET_LINE;break; case XATTR_FILLSTYLE : pResId = SIP_XA_FILLSTYLE;break; case XATTR_FILLCOLOR : pResId = SIP_XA_FILLCOLOR;break; @@ -587,8 +576,6 @@ OUString SdrItemPool::GetItemName(sal_uInt16 nWhich) case XATTR_FILLBACKGROUND : pResId = SIP_XA_FILLBACKGROUND;break; case XATTR_FILLUSESLIDEBACKGROUND: pResId = SIP_XA_FILLUSESLIDEBACKGROUND;break; - case XATTRSET_FILL : pResId = SIP_XATTRSET_FILL;break; - case XATTR_FORMTXTSTYLE : pResId = SIP_XA_FORMTXTSTYLE;break; case XATTR_FORMTXTADJUST : pResId = SIP_XA_FORMTXTADJUST;break; case XATTR_FORMTXTDISTANCE : pResId = SIP_XA_FORMTXTDISTANCE;break; diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 5b3b437b3185..8d0bb3c709b5 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2878,7 +2878,7 @@ bool SdrObjEditView::SupportsFormatPaintbrush(SdrInventor nObjectInventor, static const WhichRangesContainer& GetFormatRangeImpl(bool bTextOnly, bool withParagraphAttr = true) { static const WhichRangesContainer gFull( - svl::Items pDefData; const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eSpType ); if ( pDefCustomShape ) pDefData = pDefCustomShape->pDefData; @@ -851,11 +851,12 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) const uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sAdjustmentValues ); if ( pAny ) *pAny >>= seqAdjustmentValues; - if ( pDefCustomShape && pDefData ) // now check if we have to default some adjustment values + if ( pDefCustomShape && !pDefData.empty() ) // now check if we have to default some adjustment values { // first check if there are adjustment values are to be appended sal_Int32 i, nAdjustmentValues = seqAdjustmentValues.getLength(); - sal_Int32 nAdjustmentDefaults = *pDefData++; + sal_Int32 nAdjustmentDefaults = pDefData[0]; + pDefData = pDefData.subspan(1); if ( nAdjustmentDefaults > nAdjustmentValues ) seqAdjustmentValues.realloc( nAdjustmentDefaults ); auto pseqAdjustmentValues = seqAdjustmentValues.getArray(); @@ -942,9 +943,9 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) // Path/Segments static constexpr OUString sSegments( u"Segments"_ustr ); pAny = aGeometryItem.GetPropertyValueByName( sPath, sSegments ); - if ( !pAny && pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements ) + if ( !pAny && pDefCustomShape && !pDefCustomShape->pElements.empty() ) { - sal_Int32 i, nCount = pDefCustomShape->nElements; + sal_Int32 i, nCount = pDefCustomShape->pElements.size(); uno::Sequence seqSegments( nCount ); auto pseqSegments = seqSegments.getArray(); for ( i = 0; i < nCount; i++ ) @@ -1177,9 +1178,9 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons uno::Sequence seqSegments1; if ( *pAny >>= seqSegments1 ) { - if ( pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements ) + if ( pDefCustomShape && !pDefCustomShape->pElements.empty()) { - sal_Int32 i, nCount = pDefCustomShape->nElements; + sal_Int32 i, nCount = pDefCustomShape->pElements.size(); if ( nCount ) { uno::Sequence seqSegments2( nCount ); @@ -1208,7 +1209,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons } } } - else if ( pDefCustomShape && ( ( pDefCustomShape->nElements == 0 ) || ( pDefCustomShape->pElements == nullptr ) ) ) + else if ( pDefCustomShape && pDefCustomShape->pElements.empty() ) bIsDefaultGeometry = true; } break; @@ -2787,7 +2788,7 @@ void SdrObjCustomShape::NbcSetOutlinerParaObject(std::optional SdrObjCustomShape::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrObjCustomShape::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrObjCustomShape(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 4eea5bda4ef4..83afaba99e9b 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -110,6 +110,7 @@ #include #include #include +#include #include #include @@ -1214,6 +1215,19 @@ bool SdrObject::HasLimitedRotation() const return false; } +rtl::Reference SdrObject::CloneSdrObject(SdrModel& rTargetModel) const +{ + if (&rTargetModel == &getSdrModelFromSdrObject()) + // clone to same model, simple method + return implCloneSdrObject(rTargetModel); + + // clone to different model, need to do more for creating a valid + // Style and Properties + rtl::Reference aRetval(implCloneSdrObject(rTargetModel)); + aRetval->GetProperties().postProcessAfterCloneToDifferentModel(*this); + return aRetval; +} + OUString SdrObject::TakeObjNameSingul() const { OUString sName(SvxResId(STR_ObjNameSingulNONE)); @@ -1920,7 +1934,7 @@ bool SdrObject::HasTextEdit() const bool SdrObject::Equals(const SdrObject& rOtherObj) const { - return (m_aAnchor.X() == rOtherObj.m_aAnchor.X() && m_aAnchor.Y() == rOtherObj.m_aAnchor.Y() && + const bool bEqual(m_aAnchor.X() == rOtherObj.m_aAnchor.X() && m_aAnchor.Y() == rOtherObj.m_aAnchor.Y() && m_nOrdNum == rOtherObj.m_nOrdNum && mnNavigationPosition == rOtherObj.mnNavigationPosition && mbSupportTextIndentingOnLineWidthChange == rOtherObj.mbSupportTextIndentingOnLineWidthChange && m_aCustomPromptText == rOtherObj.m_aCustomPromptText && @@ -1929,7 +1943,79 @@ bool SdrObject::Equals(const SdrObject& rOtherObj) const m_bNotVisibleAsMaster == rOtherObj.m_bNotVisibleAsMaster && m_bEmptyPresObj == rOtherObj.m_bEmptyPresObj && mbVisible == rOtherObj.mbVisible && m_bNoPrint == rOtherObj.m_bNoPrint && m_bSizProt == rOtherObj.m_bSizProt && m_bMovProt == rOtherObj.m_bMovProt && m_bVirtObj == rOtherObj.m_bVirtObj && - mnLayerID == rOtherObj.mnLayerID && GetMergedItemSet().Equals(rOtherObj.GetMergedItemSet(), false) ); + mnLayerID == rOtherObj.mnLayerID && IsGroupObject() == rOtherObj.IsGroupObject()); + + if (!bEqual) + // compare results *without* Items are already not equal, done + return false; + + if (IsGroupObject()) + { + // for GroupObjects, do what was done before. NOTE: This will create + // merged ItemSets for Group content, not sure if that is needed. + // It would also be possible to enter content & compare recursively + return GetMergedItemSet().Equals(rOtherObj.GetMergedItemSet(), false); + } + + // Do ContentCompare - Items are compared including parent e.g. Styles. + // The check above what was done before is more 'hard' in the sense that + // it WILL fail for same Item content when e.g. count of hard Items differs, + // but with parent ItemSet is actually equal. ContentCompare is necessary + // after e.g. in AttributeProperties::postProcessAfterCloneToDifferentModel + // the Items of an Object were hard-set/corrected + const SfxItemSet& rSrcItemSet(GetObjectItemSet()); + const SfxItemSet& rDstItemSet(rOtherObj.GetObjectItemSet()); + SfxWhichIter aIter(rSrcItemSet); + const SdrPage* pPage(getSdrPageFromSdrObject()); + const bool bOnMasterPage(nullptr != pPage && pPage->IsMasterPage()); + + for (sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich()) + { + const SfxPoolItem& rOld(rSrcItemSet.Get(nWhich)); + const SfxPoolItem& rNew(rDstItemSet.Get(nWhich)); + + if (!SfxPoolItem::areSame(rOld, rNew)) + { + if (bOnMasterPage) + { + // we have strange effects for Items in Objects on MasterPages on + // some Items that seem to be corrected/set different due to being + // PresObjs or defaults or similar on MasterPage. React on those + // on MasterPages + switch (nWhich) + { + // somewhere defaults for some objects seem to be set on MasterPages + // that define Items (here: for XATTR_FILLGRADIENT and FillStyle_BITMAP). + // These can be ignored when the FillStyle does not *use* these anyways. + // Better do this already for all FillStyles, you never know. + case XATTR_FILLCOLOR: + if (drawing::FillStyle_SOLID != rSrcItemSet.Get(XATTR_FILLSTYLE).GetValue()) + continue; + break; + case XATTR_FILLGRADIENT: + if (drawing::FillStyle_GRADIENT != rSrcItemSet.Get(XATTR_FILLSTYLE).GetValue()) + continue; + break; + case XATTR_FILLHATCH: + if (drawing::FillStyle_HATCH != rSrcItemSet.Get(XATTR_FILLSTYLE).GetValue()) + continue; + break; + case XATTR_FILLBITMAP: + if (drawing::FillStyle_BITMAP != rSrcItemSet.Get(XATTR_FILLSTYLE).GetValue()) + continue; + break; + + default: break; + } + } + + // Item is different, done + return false; + } + } + + // all Items are Content-Equal + return true; } void SdrObject::dumpAsXml(xmlTextWriterPtr pWriter) const @@ -3461,7 +3547,7 @@ public: { } - rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override + rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override { return new EmptyObject(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index d9c45cb2f5a8..1f21395e3323 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -232,7 +232,7 @@ SdrObjKind SdrCaptionObj::GetObjIdentifier() const return SdrObjKind::Caption; } -rtl::Reference SdrCaptionObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrCaptionObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrCaptionObj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index 12a04b95ed19..9d68ef5e4288 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -370,7 +370,7 @@ OUString SdrCircObj::TakeObjNamePlural() const return SvxResId(pID); } -rtl::Reference SdrCircObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrCircObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrCircObj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index b0cb26dae6ab..0d23a5d9eecd 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -1721,7 +1721,7 @@ void SdrEdgeObj::Reformat() } } -rtl::Reference SdrEdgeObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrEdgeObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrEdgeObj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 5c21e9ff74c2..b3d163290f00 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -856,7 +856,7 @@ rtl::Reference SdrGrafObj::getFullDragClone() const return pRetval; } -rtl::Reference SdrGrafObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrGrafObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrGrafObj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 1760373fe791..a426b2f8c36c 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -268,7 +268,7 @@ const tools::Rectangle& SdrObjGroup::GetSnapRect() const } } -rtl::Reference SdrObjGroup::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrObjGroup::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrObjGroup(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index 074676ef1015..c520810f16d0 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -703,7 +703,7 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(tools::Rectangle& rRect) const } } -rtl::Reference SdrMeasureObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrMeasureObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrMeasureObj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index 8f9d251171a4..3cdfa995359f 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -207,7 +207,7 @@ OUString SdrMediaObj::TakeObjNamePlural() const return SvxResId(STR_ObjNamePluralMEDIA); } -rtl::Reference SdrMediaObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrMediaObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrMediaObj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 69902e416175..90107e4e1ce5 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1577,7 +1577,7 @@ OUString SdrOle2Obj::TakeObjNamePlural() const return SvxResId(mpImpl->mbFrame ? STR_ObjNamePluralFrame : STR_ObjNamePluralOLE2); } -rtl::Reference SdrOle2Obj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrOle2Obj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrOle2Obj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdopage.cxx b/svx/source/svdraw/svdopage.cxx index 448758646afe..a04c84c3f6b2 100644 --- a/svx/source/svdraw/svdopage.cxx +++ b/svx/source/svdraw/svdopage.cxx @@ -151,7 +151,7 @@ void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const rInfo.bCanConvToPolyLineToArea=false; } -rtl::Reference SdrPageObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrPageObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrPageObj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index dc55745b9505..ed713ad2751e 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -1821,7 +1821,7 @@ SdrObjKind SdrPathObj::GetObjIdentifier() const return meKind; } -rtl::Reference SdrPathObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrPathObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrPathObj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index 836422abebeb..0c31fbc8f027 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -214,7 +214,7 @@ OUString SdrRectObj::TakeObjNamePlural() const return SvxResId(pResId); } -rtl::Reference SdrRectObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrRectObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrRectObj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index d8bb27266a09..684060b611ea 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1055,7 +1055,7 @@ OUString SdrTextObj::TakeObjNamePlural() const return sName; } -rtl::Reference SdrTextObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrTextObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrTextObj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx index 0726d31ef4c4..3d690f889b9d 100644 --- a/svx/source/svdraw/svdouno.cxx +++ b/svx/source/svdraw/svdouno.cxx @@ -274,7 +274,7 @@ OUString SdrUnoObj::TakeObjNamePlural() const return SvxResId(STR_ObjNamePluralUno); } -rtl::Reference SdrUnoObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrUnoObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrUnoObj(rTargetModel, *this); } diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index 3bcd8202ef1d..dcba9c00707b 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -200,7 +200,7 @@ void SdrVirtObj::RecalcBoundRect() setOutRectangle(aRectangle); } -rtl::Reference SdrVirtObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrVirtObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrVirtObj(rTargetModel, *this); // TTTT not sure if the above works - how could SdrObjFactory::MakeNewObject diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index 49ce1a5a5d7b..06bfbb189e2e 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -174,7 +174,7 @@ SdrText* CellTextProvider::getText(sal_Int32 nIndex) const { } - std::unique_ptr CellProperties::Clone(SdrObject& rObj) const + std::unique_ptr CellProperties::implCloneProperties(SdrObject& rObj) const { OSL_FAIL("CellProperties::Clone(), does not work yet!"); return std::unique_ptr(new CellProperties(*this, rObj,nullptr)); @@ -671,7 +671,7 @@ sal_Int32 Cell::calcPreferredWidth( const Size aSize ) if( GetOutlinerParaObject() ) rOutliner.SetText(*GetOutlinerParaObject()); - sal_Int32 nPreferredWidth = const_cast(rOutliner.GetEditEngine()).CalcTextWidth(); + sal_Int32 nPreferredWidth = rOutliner.GetEditEngine().CalcTextWidth(); rOutliner.Clear(); return GetTextLeftDistance() + GetTextRightDistance() + nPreferredWidth; diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 38b16e05706e..dbbad0f788a2 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -99,7 +99,7 @@ public: TableProperties(const TableProperties& rProps, SdrObject& rObj ); // Clone() operator, normally just calls the local copy constructor - std::unique_ptr Clone(SdrObject& rObj) const override; + std::unique_ptr implCloneProperties(SdrObject& rObj) const override; virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; }; @@ -116,7 +116,7 @@ TableProperties::TableProperties(const TableProperties& rProps, SdrObject& rObj) { } -std::unique_ptr TableProperties::Clone(SdrObject& rObj) const +std::unique_ptr TableProperties::implCloneProperties(SdrObject& rObj) const { return std::unique_ptr(new TableProperties(*this, rObj)); } @@ -1782,7 +1782,7 @@ OUString SdrTableObj::TakeObjNamePlural() const } -rtl::Reference SdrTableObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SdrTableObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SdrTableObj(rTargetModel, *this); } diff --git a/svx/source/table/tablehtmlimporter.cxx b/svx/source/table/tablehtmlimporter.cxx index 17c0613a3025..d1ce06d6bffc 100644 --- a/svx/source/table/tablehtmlimporter.cxx +++ b/svx/source/table/tablehtmlimporter.cxx @@ -178,7 +178,7 @@ SdrTableHTMLParser::SdrTableHTMLParser(SdrTableObj& rTableObj) void SdrTableHTMLParser::Read(SvStream& rStream) { - EditEngine& rEdit = const_cast(mpOutliner->GetEditEngine()); + EditEngine& rEdit = mpOutliner->GetEditEngine(); Link aOldLink(rEdit.GetHtmlImportHdl()); rEdit.SetHtmlImportHdl(LINK(this, SdrTableHTMLParser, HTMLImportHdl)); diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx index 16d6ad91a87b..7b4a4c4d192a 100644 --- a/svx/source/table/tablertfimporter.cxx +++ b/svx/source/table/tablertfimporter.cxx @@ -161,7 +161,7 @@ SdrTableRTFParser::SdrTableRTFParser( SdrTableObj& rTableObj ) void SdrTableRTFParser::Read( SvStream& rStream ) { - EditEngine& rEdit = const_cast< EditEngine& >( mpOutliner->GetEditEngine() ); + EditEngine& rEdit = mpOutliner->GetEditEngine(); Link aOldLink( rEdit.GetRtfImportHdl() ); rEdit.SetRtfImportHdl( LINK( this, SdrTableRTFParser, RTFImportHdl ) ); diff --git a/svx/source/tbxctrls/ColorIconView.cxx b/svx/source/tbxctrls/ColorIconView.cxx index 031f647ca5bc..e0899788e3c7 100644 --- a/svx/source/tbxctrls/ColorIconView.cxx +++ b/svx/source/tbxctrls/ColorIconView.cxx @@ -64,6 +64,13 @@ void ColorIconView::grab_focus() { m_pIconView->grab_focus(); } void ColorIconView::set_sensitive(bool bSensitive) { m_pIconView->set_sensitive(bSensitive); } +void ColorIconView::set_size_request(int nWidth, int nHeight) +{ + m_pIconView->set_size_request(nWidth, nHeight); +} + +Size ColorIconView::get_size_request() const { return m_pIconView->get_size_request(); } + void ColorIconView::set_help_id(const OUString& rName) { m_pIconView->set_help_id(rName); } IMPL_LINK(ColorIconView, ItemActivatedHdl, const weld::TreeIter&, rIter, bool) diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx index 3afdc6d9b8bb..50f5d24a71b6 100644 --- a/svx/source/tbxctrls/StylesPreviewWindow.cxx +++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx @@ -301,16 +301,12 @@ void StyleItemController::DrawEntry(vcl::RenderContext& rRenderContext) return; SfxStyleSheetBasePool* pPool = pShell->GetStyleSheetPool(); - SfxStyleSheetBase* pStyle = nullptr; - if (!pPool) return; - pStyle = pPool->First(m_eStyleFamily); - while (pStyle && pStyle->GetName() != m_aStyleName.commonName - && pStyle->GetName() != m_aStyleName.translatedName) - pStyle = pPool->Next(); - + SfxStyleSheetBase* pStyle = pPool->Find(m_aStyleName.translatedName, m_eStyleFamily); + if (!pStyle) + pStyle = pPool->Find(m_aStyleName.commonName, m_eStyleFamily); if (!pStyle) return; diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx index c15d73262789..848041947877 100644 --- a/svx/source/tbxctrls/SvxColorValueSet.cxx +++ b/svx/source/tbxctrls/SvxColorValueSet.cxx @@ -62,7 +62,7 @@ void SvxColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntry const WinBits aWinBits(GetStyle() & ~WB_VSCROLL); // get size with all fields disabled - const WinBits aWinBitsNoScrollNoFields(GetStyle() & ~(WB_VSCROLL | WB_NAMEFIELD)); + const WinBits aWinBitsNoScrollNoFields(GetStyle() & ~WB_VSCROLL); SetStyle(aWinBitsNoScrollNoFields); const Size aSizeNoScrollNoFields(CalcWindowSizePixel(aItemSize, SvxColorValueSet::getColumnCount())); diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index c3845119d7ae..2641059f18e9 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -119,41 +120,29 @@ ExtrusionDirectionWindow::ExtrusionDirectionWindow( weld::Widget* pParent) : WeldToolbarPopup(pControl->getFrameInterface(), pParent, u"svx/ui/directionwindow.ui"_ustr, u"DirectionWindow"_ustr) , mxControl(pControl) - , mxDirectionSet(new ValueSet(nullptr)) - , mxDirectionSetWin(new weld::CustomWeld(*m_xBuilder, u"valueset"_ustr, *mxDirectionSet)) + , mxDirectionIconView(m_xBuilder->weld_icon_view(u"iconview"_ustr)) , mxPerspective(m_xBuilder->weld_radio_button(u"perspective"_ustr)) , mxParallel(m_xBuilder->weld_radio_button(u"parallel"_ustr)) { - mxDirectionSet->SetStyle(WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT); + mxDirectionIconView->connect_item_activated( + LINK(this, ExtrusionDirectionWindow, IconViewItemActivatedHdl)); for (sal_uInt16 i = DIRECTION_NW; i <= DIRECTION_SE; ++i) { - maImgDirection[i] = Image(StockImage::Yes, aDirectionBmps[i]); + const Bitmap aImgDirection = Image(StockImage::Yes, aDirectionBmps[i]).GetBitmap(); + mxDirectionIconView->insert(i, nullptr, nullptr, &aImgDirection, nullptr); + const OUString sName = SvxResId(aDirectionStrs[i]); + mxDirectionIconView->set_item_accessible_name(i, sName); + mxDirectionIconView->set_item_tooltip_text(i, sName); } - mxDirectionSet->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectValueSetHdl ) ); - mxDirectionSet->SetColCount( 3 ); - mxDirectionSet->EnableFullItemMode( false ); - - for (sal_uInt16 i = DIRECTION_NW; i <= DIRECTION_SE; ++i) - { - mxDirectionSet->InsertItem(i + 1, maImgDirection[i], SvxResId(aDirectionStrs[i])); - } - - Size aSize(72, 72); - mxDirectionSet->GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height()); - mxDirectionSet->SetOutputSizePixel(aSize); - mxPerspective->connect_toggled(LINK(this, ExtrusionDirectionWindow, SelectToolbarMenuHdl)); AddStatusListener( g_sExtrusionDirection ); AddStatusListener( g_sExtrusionProjection ); } -void ExtrusionDirectionWindow::GrabFocus() -{ - mxDirectionSet->GrabFocus(); -} +void ExtrusionDirectionWindow::GrabFocus() { mxDirectionIconView->grab_focus(); } ExtrusionDirectionWindow::~ExtrusionDirectionWindow() { @@ -170,17 +159,14 @@ void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled if( nItemId <= DIRECTION_SE ) { - mxDirectionSet->SelectItem( nItemId+1 ); + mxDirectionIconView->select(nItemId); } else { - mxDirectionSet->SetNoSelection(); + mxDirectionIconView->unselect_all(); } - if (bEnabled) - mxDirectionSet->Enable(); - else - mxDirectionSet->Disable(); + mxDirectionIconView->set_sensitive(bEnabled); } void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection, bool bEnabled ) @@ -223,15 +209,17 @@ void ExtrusionDirectionWindow::statusChanged( } } -IMPL_LINK_NOARG(ExtrusionDirectionWindow, SelectValueSetHdl, ValueSet*, void) +IMPL_LINK(ExtrusionDirectionWindow, IconViewItemActivatedHdl, const weld::TreeIter&, rIter, bool) { Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( g_sExtrusionDirection.copy(5), - gSkewList[mxDirectionSet->GetSelectedItemId()-1]) }; + gSkewList[mxDirectionIconView->get_iter_index_in_parent(rIter)]) }; mxControl->dispatchCommand( g_sExtrusionDirection, aArgs ); mxControl->EndPopupMode(); + + return true; } IMPL_LINK_NOARG(ExtrusionDirectionWindow, SelectToolbarMenuHdl, weld::Toggleable&, void) @@ -594,44 +582,38 @@ ExtrusionLightingWindow::ExtrusionLightingWindow(svt::PopupWindowController* pCo weld::Widget* pParent) : WeldToolbarPopup(pControl->getFrameInterface(), pParent, u"svx/ui/lightingwindow.ui"_ustr, u"LightingWindow"_ustr) , mxControl(pControl) - , mxLightingSet(new ValueSet(nullptr)) - , mxLightingSetWin(new weld::CustomWeld(*m_xBuilder, u"valueset"_ustr, *mxLightingSet)) + , mxLightingIconView(m_xBuilder->weld_icon_view(u"iconview"_ustr)) , mxBright(m_xBuilder->weld_radio_button(u"bright"_ustr)) , mxNormal(m_xBuilder->weld_radio_button(u"normal"_ustr)) , mxDim(m_xBuilder->weld_radio_button(u"dim"_ustr)) { - mxLightingSet->SetStyle(WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT); - for (sal_uInt16 i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; ++i) { if( i != FROM_FRONT ) { - maImgLightingOff[i] = Image(StockImage::Yes, aLightOffBmps[i]); - maImgLightingOn[i] = Image(StockImage::Yes, aLightOnBmps[i]); + maImgLightingOff[i] = Image(StockImage::Yes, aLightOffBmps[i]).GetBitmap(); + maImgLightingOn[i] = Image(StockImage::Yes, aLightOnBmps[i]).GetBitmap(); } - maImgLightingPreview[i] = Image(StockImage::Yes, aLightPreviewBmps[i]); + maImgLightingPreview[i] = Image(StockImage::Yes, aLightPreviewBmps[i]).GetBitmap(); } - mxLightingSet->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING ); + mxLightingIconView->set_help_id(HID_VALUESET_EXTRUSION_LIGHTING); - mxLightingSet->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectValueSetHdl ) ); - mxLightingSet->SetColCount( 3 ); - mxLightingSet->EnableFullItemMode( false ); + mxLightingIconView->connect_item_activated( + LINK(this, ExtrusionLightingWindow, IconViewItemActivatedHdl)); - for (sal_uInt16 i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; ++i) + for (int i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; ++i) { if( i != FROM_FRONT ) { - mxLightingSet->InsertItem( i+1, maImgLightingOff[i] ); + mxLightingIconView->insert(i, nullptr, nullptr, &maImgLightingOff[i], nullptr); } else { - mxLightingSet->InsertItem( 5, maImgLightingPreview[FROM_FRONT] ); + mxLightingIconView->insert(4, nullptr, nullptr, &maImgLightingPreview[FROM_FRONT], + nullptr); } } - Size aSize(72, 72); - mxLightingSet->GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height()); - mxLightingSet->SetOutputSizePixel(aSize); mxBright->connect_toggled(LINK(this, ExtrusionLightingWindow, SelectToolbarMenuHdl)); mxNormal->connect_toggled(LINK(this, ExtrusionLightingWindow, SelectToolbarMenuHdl)); @@ -641,10 +623,7 @@ ExtrusionLightingWindow::ExtrusionLightingWindow(svt::PopupWindowController* pCo AddStatusListener( g_sExtrusionLightingIntensity ); } -void ExtrusionLightingWindow::GrabFocus() -{ - mxLightingSet->GrabFocus(); -} +void ExtrusionLightingWindow::GrabFocus() { mxLightingIconView->grab_focus(); } ExtrusionLightingWindow::~ExtrusionLightingWindow() { @@ -665,26 +644,28 @@ void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled ) if( !bEnabled ) nDirection = FROM_FRONT; - sal_uInt16 nItemId; - for( nItemId = FROM_TOP_LEFT; nItemId <= FROM_BOTTOM_RIGHT; nItemId++ ) + for (int nItemIndex = FROM_TOP_LEFT; nItemIndex <= FROM_BOTTOM_RIGHT; nItemIndex++) { - if( nItemId == FROM_FRONT ) + ScopedVclPtr pDev = VclPtr::Create(); + if (nItemIndex == FROM_FRONT) { - mxLightingSet->SetItemImage( nItemId + 1, maImgLightingPreview[ nDirection ] ); + pDev->SetOutputSizePixel(maImgLightingPreview[nDirection].GetSizePixel()); + pDev->DrawBitmap(Point(), maImgLightingPreview[nDirection]); } else { - mxLightingSet->SetItemImage( - nItemId + 1, - static_cast(nDirection) == nItemId ? maImgLightingOn[nItemId] : maImgLightingOff[nItemId] - ); + const Bitmap& rBitmap = nDirection == nItemIndex ? maImgLightingOn[nItemIndex] + : maImgLightingOff[nItemIndex]; + pDev->SetOutputSizePixel(rBitmap.GetSizePixel()); + pDev->DrawBitmap(Point(), rBitmap); } + mxLightingIconView->set_image(nItemIndex, *pDev); } if (bEnabled) - mxLightingSet->Enable(); + mxLightingIconView->set_sensitive(true); else - mxLightingSet->Disable(); + mxLightingIconView->set_sensitive(false); } void ExtrusionLightingWindow::statusChanged( @@ -719,23 +700,21 @@ void ExtrusionLightingWindow::statusChanged( } } -IMPL_LINK_NOARG(ExtrusionLightingWindow, SelectValueSetHdl, ValueSet*, void) +IMPL_LINK(ExtrusionLightingWindow, IconViewItemActivatedHdl, const weld::TreeIter&, rIter, bool) { - sal_Int32 nDirection = mxLightingSet->GetSelectedItemId(); + sal_Int32 nDirection = mxLightingIconView->get_iter_index_in_parent(rIter); + assert(nDirection >= 0 && nDirection < 9 && "Invalid index"); - if( (nDirection > 0) && (nDirection < 10) ) - { - nDirection--; + Sequence aArgs{ comphelper::makePropertyValue( + g_sExtrusionLightingDirection.copy(5), nDirection) }; - Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue( - g_sExtrusionLightingDirection.copy(5), nDirection) }; + mxControl->dispatchCommand(g_sExtrusionLightingDirection, aArgs); - mxControl->dispatchCommand( g_sExtrusionLightingDirection, aArgs ); - - implSetDirection( nDirection, true ); - } + implSetDirection(nDirection, true); mxControl->EndPopupMode(); + + return true; } IMPL_LINK(ExtrusionLightingWindow, SelectToolbarMenuHdl, weld::Toggleable&, rButton, void) diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx index 60cfc0663b97..a38d1360c35a 100644 --- a/svx/source/tbxctrls/extrusioncontrols.hxx +++ b/svx/source/tbxctrls/extrusioncontrols.hxx @@ -21,10 +21,10 @@ #include #include -#include +#include #include +#include #include -#include // enum to index light images #define FROM_TOP_LEFT 0 @@ -60,15 +60,12 @@ public: private: rtl::Reference mxControl; - std::unique_ptr mxDirectionSet; - std::unique_ptr mxDirectionSetWin; + std::unique_ptr mxDirectionIconView; std::unique_ptr mxPerspective; std::unique_ptr mxParallel; - Image maImgDirection[9]; - DECL_LINK( SelectToolbarMenuHdl, weld::Toggleable&, void ); - DECL_LINK( SelectValueSetHdl, ValueSet*, void ); + DECL_LINK(IconViewItemActivatedHdl, const weld::TreeIter&, bool); void implSetDirection( sal_Int32 nSkew, bool bEnabled ); void implSetProjection( sal_Int32 nProjection, bool bEnabled ); @@ -143,21 +140,21 @@ class ExtrusionLightingWindow final : public WeldToolbarPopup { private: rtl::Reference mxControl; - std::unique_ptr mxLightingSet; - std::unique_ptr mxLightingSetWin; + std::unique_ptr mxLightingIconView; std::unique_ptr mxBright; std::unique_ptr mxNormal; std::unique_ptr mxDim; - Image maImgLightingOff[9]; - Image maImgLightingOn[9]; - Image maImgLightingPreview[9]; + Bitmap maImgLightingOff[9]; + Bitmap maImgLightingOn[9]; + Bitmap maImgLightingPreview[9]; void implSetIntensity( int nLevel, bool bEnabled ); void implSetDirection( int nDirection, bool bEnabled ); DECL_LINK( SelectToolbarMenuHdl, weld::Toggleable&, void ); - DECL_LINK( SelectValueSetHdl, ValueSet*, void ); + DECL_LINK(IconViewItemActivatedHdl, const weld::TreeIter&, bool); + public: ExtrusionLightingWindow(svt::PopupWindowController* pControl, weld::Widget* pParentWindow); virtual void GrabFocus() override; diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 9dd8da5d0170..c1a3ca350876 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -882,6 +882,10 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr } } + // Shapes with no visible content anchor at 0,0 + if (aBound.isEmpty()) + aBound.expand(basegfx::B2DTuple(0, 0)); + aOut->EnableOutput( false ); aOut->SetMapMode( aMap ); if( rSettings.mbUseHighContrast ) diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index 7564a63b24ed..a89228d98101 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -498,9 +498,9 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder() mpOutliner->SetTextObjNoInit( pTextObj ); if( mbIsLocked ) { - const_cast(&(mpOutliner->GetEditEngine()))->SetUpdateLayout( false ); + mpOutliner->GetEditEngine().SetUpdateLayout( false ); mbOldUndoMode = mpOutliner->GetEditEngine().IsUndoEnabled(); - const_cast(&(mpOutliner->GetEditEngine()))->EnableUndo( false ); + mpOutliner->GetEditEngine().EnableUndo( false ); } if (!comphelper::IsFuzzing()) @@ -813,9 +813,9 @@ void SvxTextEditSourceImpl::lock() mbIsLocked = true; if( mpOutliner ) { - const_cast(&(mpOutliner->GetEditEngine()))->SetUpdateLayout( false ); + mpOutliner->GetEditEngine().SetUpdateLayout( false ); mbOldUndoMode = mpOutliner->GetEditEngine().IsUndoEnabled(); - const_cast(&(mpOutliner->GetEditEngine()))->EnableUndo( false ); + mpOutliner->GetEditEngine().EnableUndo( false ); } } @@ -831,8 +831,8 @@ void SvxTextEditSourceImpl::unlock() if( mpOutliner ) { - const_cast(&(mpOutliner->GetEditEngine()))->SetUpdateLayout( true ); - const_cast(&(mpOutliner->GetEditEngine()))->EnableUndo( mbOldUndoMode ); + mpOutliner->GetEditEngine().SetUpdateLayout( true ); + mpOutliner->GetEditEngine().EnableUndo( mbOldUndoMode ); } } diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx index 6bad43eaa784..010cd33fa135 100644 --- a/svx/source/xoutdev/_xpoly.cxx +++ b/svx/source/xoutdev/_xpoly.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -773,52 +774,136 @@ void XPolygon::Scale(double fSx, double fSy) * 2: bottom right 3----2 * 3: bottom left */ +// Subdivide before distorting for more accuracy. void XPolygon::Distort(const tools::Rectangle& rRefRect, const XPolygon& rDistortedRect) { std::as_const(m_pImpXPolygon)->CheckPointDelete(); + if (GetPointCount() < 2) + return; + DBG_ASSERT(rDistortedRect.m_pImpXPolygon->nPoints >= 4, + "Distort: rectangle too small"); - tools::Long Xr, Wr; - tools::Long Yr, Hr; - - Xr = rRefRect.Left(); - Yr = rRefRect.Top(); - Wr = rRefRect.GetWidth(); - Hr = rRefRect.GetHeight(); - - if ( !Wr || !Hr ) + tools::Long Xr = rRefRect.Left(); + tools::Long Yr = rRefRect.Top(); + tools::Long Wr = rRefRect.GetWidth(); + tools::Long Hr = rRefRect.GetHeight(); + if (!Wr || !Hr) return; - tools::Long X1, X2, X3, X4; - tools::Long Y1, Y2, Y3, Y4; - DBG_ASSERT(rDistortedRect.m_pImpXPolygon->nPoints >= 4, - "Distort: rectangle too small"); + XPolygon aOriginal(*this); + sal_uInt16 nOldCnt = aOriginal.GetPointCount(); + bool canSubdivide = !(nOldCnt < 4 || (nOldCnt - 1) % 3 != 0); - X1 = rDistortedRect[0].X(); - Y1 = rDistortedRect[0].Y(); - X2 = rDistortedRect[1].X(); - Y2 = rDistortedRect[1].Y(); - X3 = rDistortedRect[3].X(); - Y3 = rDistortedRect[3].Y(); - X4 = rDistortedRect[2].X(); - Y4 = rDistortedRect[2].Y(); + constexpr sal_uInt16 nMaxSegments = 512; + sal_uInt16 nSegments = canSubdivide ? (nOldCnt - 1) / 3 : 0; + sal_uInt16 nNewCnt = nOldCnt; - sal_uInt16 nPntCnt = m_pImpXPolygon->nPoints; + if (nSegments > 0 && nSegments <= nMaxSegments) + { + constexpr double fSubdivideThreshold = 0.02; + double aSegLen[nMaxSegments]; + bool aSubdivideSeg[nMaxSegments]; + double fTotalLen = 0.0; - for (sal_uInt16 i = 0; i < nPntCnt; i++) + auto dist = [](const Point& a, const Point& b) + { + double dx = a.X() - b.X(), dy = a.Y() - b.Y(); + return std::sqrt(dx*dx + dy*dy); + }; + + for (sal_uInt16 nSeg = 0; nSeg < nSegments; ++nSeg) + { + sal_uInt16 nPos = 3 * nSeg; + const Point& p0 = aOriginal.m_pImpXPolygon->pPointAry[nPos]; + const Point& p1 = aOriginal.m_pImpXPolygon->pPointAry[nPos + 1]; + const Point& p2 = aOriginal.m_pImpXPolygon->pPointAry[nPos + 2]; + const Point& p3 = aOriginal.m_pImpXPolygon->pPointAry[nPos + 3]; + + aSegLen[nSeg] = dist(p0, p1) + dist(p1, p2) + dist(p2, p3); + fTotalLen += aSegLen[nSeg]; + } + + sal_uInt32 nNewCnt32 = 0; + + for (sal_uInt16 nSeg = 0; nSeg < nSegments; ++nSeg) + { + bool bSub = aSegLen[nSeg] > fTotalLen * fSubdivideThreshold; + aSubdivideSeg[nSeg] = bSub; + nNewCnt32 += (bSub ? 24 : 3) + (nSeg == 0 ? 1 : 0); + } + + // If subdivision would overflow the point count, + // fall back on old behavior. + if (nNewCnt32 <= std::numeric_limits::max()) + { + nNewCnt = static_cast(nNewCnt32); + SetPointCount(nNewCnt); + sal_uInt16 nOut = 0; + + for (sal_uInt16 nSeg = 0; nSeg < nSegments; ++nSeg) + { + sal_uInt16 nPos = 3 * nSeg; + if (aSubdivideSeg[nSeg]) + { + for (sal_uInt16 nPiece = 0; nPiece < 8; ++nPiece) + { + XPolygon aPiece(aOriginal); + double fA = static_cast(nPiece) / 8.0; + double fB = static_cast(nPiece + 1) / 8.0; + if (fA != 0.0) + aPiece.SubdivideBezier(nPos, false, fA); + aPiece.SubdivideBezier( + nPos, true, + (fB - fA) / (1.0 - fA)); + sal_uInt16 nFirstPoint = + (nSeg == 0 && nPiece == 0) ? 0 : 1; + for (sal_uInt16 j = nFirstPoint; j < 4; ++j) + { + m_pImpXPolygon->pPointAry[nOut] = + aPiece.m_pImpXPolygon->pPointAry[nPos + j]; + m_pImpXPolygon->pFlagAry[nOut] = + aPiece.m_pImpXPolygon->pFlagAry[nPos + j]; + ++nOut; + } + } + } + else + { + sal_uInt16 nFirstPoint = (nSeg == 0) ? 0 : 1; + for (sal_uInt16 j = nFirstPoint; j < 4; ++j) + { + m_pImpXPolygon->pPointAry[nOut] = + aOriginal.m_pImpXPolygon->pPointAry[nPos + j]; + m_pImpXPolygon->pFlagAry[nOut] = + aOriginal.m_pImpXPolygon->pFlagAry[nPos + j]; + ++nOut; + } + } + } + } + } + + tools::Long X1 = rDistortedRect[0].X(); + tools::Long Y1 = rDistortedRect[0].Y(); + tools::Long X2 = rDistortedRect[1].X(); + tools::Long Y2 = rDistortedRect[1].Y(); + tools::Long X3 = rDistortedRect[3].X(); + tools::Long Y3 = rDistortedRect[3].Y(); + tools::Long X4 = rDistortedRect[2].X(); + tools::Long Y4 = rDistortedRect[2].Y(); + + for (sal_uInt16 i = 0; i < nNewCnt; i++) { - double fTx, fTy, fUx, fUy; Point& rPnt = m_pImpXPolygon->pPointAry[i]; - fTx = static_cast(rPnt.X() - Xr) / Wr; - fTy = static_cast(rPnt.Y() - Yr) / Hr; - fUx = 1.0 - fTx; - fUy = 1.0 - fTy; + double fTx = static_cast(rPnt.X() - Xr) / Wr; + double fTy = static_cast(rPnt.Y() - Yr) / Hr; + double fUx = 1.0 - fTx; + double fUy = 1.0 - fTy; - rPnt.setX( static_cast( fUy * (fUx * X1 + fTx * X2) + - fTy * (fUx * X3 + fTx * X4) ) ); - rPnt.setY( static_cast( fUx * (fUy * Y1 + fTy * Y3) + - fTx * (fUy * Y2 + fTy * Y4) ) ); + rPnt.setX(static_cast(fUy * (fUx * X1 + fTx * X2) + fTy * (fUx * X3 + fTx * X4))); + rPnt.setY(static_cast(fUx * (fUy * Y1 + fTy * Y3) + fTx * (fUy * Y2 + fTy * Y4))); } } diff --git a/svx/source/xoutdev/fillbitmaplink.cxx b/svx/source/xoutdev/fillbitmaplink.cxx index 0a5256430d3e..d5027a984967 100644 --- a/svx/source/xoutdev/fillbitmaplink.cxx +++ b/svx/source/xoutdev/fillbitmaplink.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 285b2712d2fe..cd14a74febb2 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -49,9 +49,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -2832,63 +2830,4 @@ XFormTextHideFormItem* XFormTextHideFormItem::Clone(SfxItemPool* /*pPool*/) cons return new XFormTextHideFormItem(*this); } -// --- SetItems --- - - -/// a line attribute set item -XLineAttrSetItem::XLineAttrSetItem( SfxItemSet&& pItemSet ) : - SfxSetItem( XATTRSET_LINE, std::move(pItemSet)) -{ -} - -XLineAttrSetItem::XLineAttrSetItem( SfxItemPool* pItemPool ) : - SfxSetItem(XATTRSET_LINE, - SfxItemSet::makeFixedSfxItemSet(*pItemPool)) -{ -} - -XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr ) : - SfxSetItem( rLineAttr ) -{ -} - -XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr, - SfxItemPool* pItemPool) : - SfxSetItem( rLineAttr, pItemPool ) -{ -} - -XLineAttrSetItem* XLineAttrSetItem::Clone( SfxItemPool* pPool ) const -{ - return new XLineAttrSetItem( *this, pPool ); -} - -/// fill attribute set item -XFillAttrSetItem::XFillAttrSetItem( SfxItemSet&& pItemSet ) : - SfxSetItem( XATTRSET_FILL, std::move(pItemSet)) -{ -} - -XFillAttrSetItem::XFillAttrSetItem( SfxItemPool* pItemPool ) : - SfxSetItem(XATTRSET_FILL, - SfxItemSet::makeFixedSfxItemSet(*pItemPool)) -{ -} - -XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr ) : - SfxSetItem( rFillAttr ) -{ -} - -XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr, - SfxItemPool* pItemPool ) : - SfxSetItem( rFillAttr, pItemPool ) -{ -} - -XFillAttrSetItem* XFillAttrSetItem::Clone( SfxItemPool* pPool ) const -{ - return new XFillAttrSetItem( *this, pPool ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui index 5c51bceccf7c..973897eefd21 100644 --- a/svx/uiconfig/ui/colorwindow.ui +++ b/svx/uiconfig/ui/colorwindow.ui @@ -123,20 +123,23 @@ + 250 True True - True + start never in + 250 False + 250 True True True True + start 6 - True coloriconview_model 12 0 diff --git a/svx/uiconfig/ui/defaultshapespanel.ui b/svx/uiconfig/ui/defaultshapespanel.ui index f47a3cd673f6..c84f997b64d7 100644 --- a/svx/uiconfig/ui/defaultshapespanel.ui +++ b/svx/uiconfig/ui/defaultshapespanel.ui @@ -1,45 +1,148 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True - False + False True True - False + False True - 6 + 6 vertical 12 True - False + False vertical 3 True - False - 0 - none + False + 0 + none - - 50 + True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - 12 + True + 6 + LinesArrows_model + 6 + 0 + 2 + True True - False + False Lines and Arrows @@ -56,22 +159,25 @@ True - False - 0 - none + False + 0 + none - - 50 + True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - 12 + True + 6 + Curves_model + 6 + 0 + 2 + True True - False + False Curves and Polygons @@ -88,22 +194,25 @@ True - False - 0 - none + False + 0 + none - - 50 + True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - 12 + True + 6 + Connectors_model + 6 + 0 + 2 + True True - False + False Connectors @@ -120,22 +229,25 @@ True - False - 0 - none + False + 0 + none - - 100 + True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - 12 + True + 6 + BasicShapes_model + 6 + 0 + 2 + True True - False + False Basic Shapes @@ -152,22 +264,25 @@ True - False - 0 - none + False + 0 + none - - 75 + True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - 12 + True + 6 + SymbolShapes_model + 6 + 0 + 2 + True True - False + False Symbol Shapes @@ -184,22 +299,25 @@ True - False - 0 - none + False + 0 + none - - 125 + True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - 12 + True + 6 + BlockArrows_model + 6 + 0 + 2 + True True - False + False Block Arrows @@ -216,22 +334,25 @@ True - False - 0 - none + False + 0 + none - - 125 + True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - 12 + True + 6 + Flowcharts_model + 6 + 0 + 2 + True True - False + False Flowchart @@ -248,22 +369,25 @@ True - False - 0 - none + False + 0 + none - - 50 + True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - 12 + True + 6 + Callouts_model + 6 + 0 + 2 + True True - False + False Callouts @@ -280,22 +404,25 @@ True - False - 0 - none + False + 0 + none - - 50 + True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - 12 + True + 6 + Stars_model + 6 + 0 + 2 + True True - False + False Stars and Banners @@ -312,22 +439,25 @@ True - False - 0 - none + False + 0 + none - - 50 + True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - 12 + True + 6 + 3DObjects_model + 6 + 0 + 2 + True True - False + False 3D Objects @@ -350,8 +480,8 @@ - 0 - 0 + 0 + 0 diff --git a/svx/uiconfig/ui/directionwindow.ui b/svx/uiconfig/ui/directionwindow.ui index c8ce767ba67e..c9fafc63541a 100644 --- a/svx/uiconfig/ui/directionwindow.ui +++ b/svx/uiconfig/ui/directionwindow.ui @@ -1,52 +1,51 @@ - + + + + + + + + + + + True - False - svx/res/perspective_16.png + False + svx/res/perspective_16.png True - False - svx/res/parallel_16.png + False + svx/res/parallel_16.png - False - True - 4 + False + True + 4 none True - False + False vertical 6 - + True - True - True - True - never - never - in - - - True - False - - - True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - True - True - - - - + True + 6 + iconview_model + 3 + 0 + 0 + 0 + 2 + 3 + True False @@ -58,13 +57,13 @@ _Perspective True - True - False + True + False image1 - True - True + True + True True - True + True False @@ -76,12 +75,12 @@ P_arallel True - True - False + True + False image2 - True - True - True + True + True + True perspective diff --git a/svx/uiconfig/ui/extrustiondepthdialog.ui b/svx/uiconfig/ui/extrustiondepthdialog.ui index 084c98c74a09..90681dd5f9da 100644 --- a/svx/uiconfig/ui/extrustiondepthdialog.ui +++ b/svx/uiconfig/ui/extrustiondepthdialog.ui @@ -1,37 +1,37 @@ - + 338.666 - 0.1 - 1 + 0.10 + 1 - False - 6 + False + 6 Extrusion Depth True - 0 - 0 - dialog + 0 + 0 + dialog - False + False vertical 12 - False - end + False + end _OK True - True - True - True - True + True + True + True + True True @@ -44,8 +44,8 @@ _Cancel True - True - True + True + True True @@ -58,8 +58,8 @@ _Help True - True - True + True + True True @@ -73,53 +73,53 @@ False True - end + end 0 True - False + False True True - 0 - none + 0 + none - + True - False - True - True - 12 + False 12 6 + True + True + 12 True - True - True - adjustment1 + True + True True + adjustment1 2 - 1 - 0 + 1 + 0 True - False + False _Value - True - depth + True + depth - 0 - 0 + 0 + 0 @@ -127,7 +127,7 @@ True - False + False Depth @@ -148,9 +148,6 @@ cancel help - - - Enter an extrusion depth. diff --git a/svx/uiconfig/ui/floatinglineproperty.ui b/svx/uiconfig/ui/floatinglineproperty.ui index d005903ff34c..2130dc4c6754 100644 --- a/svx/uiconfig/ui/floatinglineproperty.ui +++ b/svx/uiconfig/ui/floatinglineproperty.ui @@ -1,95 +1,116 @@ - + + + 500 + 1 + 10 + + + + + + + + + + + + + + + - False - True - 4 + False + True + 4 none - + True - False + False True True - 6 + 6 - + True - True - True - True - never - never - in + True + linetreeview_model + False + False + False + True - - True - False + - - True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - True - True - + + + 4 + 0 + + + + + + + + + + 4 + 1 + - 0 - 0 + 0 + 0 - + True - False - 12 + False + 12 True - False + False Custom Line Thickness: - True - spin + True + spin end - 0 - 0 + 0 + 0 True - True - adjustment1 + True True + adjustment1 1 - 1 - 0 + 1 + 0 - 0 - 1 + 0 + 1 - - 500 - 1 - 10 - diff --git a/svx/uiconfig/ui/lightingwindow.ui b/svx/uiconfig/ui/lightingwindow.ui index f53e5979b64c..20e46eb11ab3 100644 --- a/svx/uiconfig/ui/lightingwindow.ui +++ b/svx/uiconfig/ui/lightingwindow.ui @@ -1,52 +1,56 @@ - + + + + + + + + + + + True - False - svx/res/brightlit_16.png + False + svx/res/brightlit_16.png True - False - svx/res/normallit_16.png + False + svx/res/normallit_16.png + + + True + False + svx/res/dimlit_16.png - False - True - 4 + False + True + 4 none True - False + False vertical 6 - + True - True - True - True - never - never - in - - - True - False - - - True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - True - True - - - - + True + 6 + iconview_model + 3 + 0 + 0 + 0 + 2 + 3 + True False @@ -58,13 +62,13 @@ _Bright True - True - False + True + False image1 - True - True + True + True True - True + True False @@ -76,12 +80,12 @@ _Normal True - True - False + True + False image2 - True - True - True + True + True + True bright @@ -94,12 +98,12 @@ _Dim True - True - False + True + False image3 - True - True - True + True + True + True bright @@ -111,9 +115,4 @@ - - True - False - svx/res/dimlit_16.png - diff --git a/sw/CppunitTest_sw_core_undo.mk b/sw/CppunitTest_sw_core_undo.mk index ea7f0becf02f..967324d9e9c3 100644 --- a/sw/CppunitTest_sw_core_undo.mk +++ b/sw/CppunitTest_sw_core_undo.mk @@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_undo, \ comphelper \ cppu \ cppuhelper \ + editeng \ sal \ sfx \ subsequenttest \ diff --git a/sw/inc/EnhancedPDFExportHelper.hxx b/sw/inc/EnhancedPDFExportHelper.hxx index 9fbbf8428e23..a2c6bbd37494 100644 --- a/sw/inc/EnhancedPDFExportHelper.hxx +++ b/sw/inc/EnhancedPDFExportHelper.hxx @@ -26,6 +26,7 @@ #include "swtypes.hxx" #include +#include #include namespace vcl @@ -121,9 +122,15 @@ struct Por_Info Ruby: 0-> Ruby 1-> RT 2-> RB */ int const m_Mode; + /// the element to enter, created before the portion paints, or -1 to create one + const sal_Int32 m_nExistingId; - Por_Info(const SwLinePortion& rPor, const SwTextPainter& rTextPainter, int const nMode) - : mrPor(rPor), mrTextPainter(rTextPainter), m_Mode(nMode) {}; + Por_Info(const SwLinePortion& rPor, const SwTextPainter& rTextPainter, int const nMode, + const sal_Int32 nExistingId = -1) + : mrPor(rPor) + , mrTextPainter(rTextPainter) + , m_Mode(nMode) + , m_nExistingId(nExistingId){}; }; struct lt_TableColumn @@ -154,7 +161,8 @@ class SwTaggedPDFHelper const Por_Info* mpPorInfo; void OpenTagImpl(void const* pKey); - sal_Int32 BeginTagImpl(void const* pKey,vcl::pdf::StructElement aTagRole, const OUString& rTagName); + sal_Int32 BeginTagImpl(void const* pKey, vcl::pdf::StructElement aTagRole, + const OUString& rTagName, sal_Int32 nExistingId = -1); void BeginTag(vcl::pdf::StructElement aTagRole, const OUString& rTagName); void EndTag(); void DeferTag(); @@ -189,6 +197,10 @@ class SwTaggedPDFHelper public: + /// a Ruby's RB and RT, created before either sub-line paints so that they end up in that order + static std::pair CreateRubyKids(const OutputDevice& rOut, + const SwFrame& rFrame); + // pFrameInfo != 0 => BeginBlockStructureElement // pPorInfo != 0 => BeginInlineStructureElement // pFrameInfo, pPorInfo = 0 => BeginNonStructureElement diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index d21dac474ced..82094b0988dc 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -136,7 +136,7 @@ namespace sw { bool ReplaceImpl(SwPaM & rCursor, OUString const& rReplacement, bool const bRegExp, SwDoc & rDoc, SwRootFrame const*const pLayout); -/// Helperfunction to resolve backward references in regular expressions +/// Helper function to resolve backward references in regular expressions std::optional ReplaceBackReferences(const i18nutil::SearchOptions2& rSearchOpt, SwPaM* pPam, SwRootFrame const* pLayout ); @@ -664,7 +664,7 @@ public: // select a table row, column or box (based on the current cursor) bool SelTableRow() { return SelTableRowOrCol( true ); } bool SelTableCol() { return SelTableRowOrCol( false ); } - bool SelTableBox(); + SW_DLLPUBLIC bool SelTableBox(); SW_DLLPUBLIC bool SelTable(); @@ -870,7 +870,7 @@ public: bool CheckTableBoxContent( const SwPosition* pPos = nullptr ); void SaveTableBoxContent( const SwPosition* pPos = nullptr ); void ClearTableBoxContent(); - bool EndAllTableBoxEdit(); + SW_DLLPUBLIC bool EndAllTableBoxEdit(); void SetSelTableCells( bool bFlag ) { m_bSelTableCells = bFlag; } bool IsSelTableCells() const { return m_bSelTableCells; } diff --git a/sw/inc/databindingnamespaces.hxx b/sw/inc/databindingnamespaces.hxx index 883a934de89a..467000d95b9b 100644 --- a/sw/inc/databindingnamespaces.hxx +++ b/sw/inc/databindingnamespaces.hxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index 5e87b3e58d5f..dca8508977b1 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -209,7 +209,6 @@ public: in later headers. */ class SwDrawVirtObj final : public SdrVirtObj { - private: // data for connection to writer layout /** anchored drawing object instance for the 'virtual' drawing object */ @@ -228,6 +227,8 @@ class SwDrawVirtObj final : public SdrVirtObj // protected destructor virtual ~SwDrawVirtObj() override; + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SwDrawVirtObj( SdrModel& rSdrModel, @@ -239,8 +240,6 @@ class SwDrawVirtObj final : public SdrVirtObj /// access to offset virtual Point GetOffset() const override; - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - /// connection to writer layout const SwAnchoredObject& GetAnchoredObj() const { return maAnchoredDrawObj; } SwAnchoredObject& AnchoredObj() { return maAnchoredDrawObj; } diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 16ad6058b7fe..60ab9535da64 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -35,10 +35,8 @@ #include #include "tox.hxx" #include "frmfmt.hxx" -#include "frameformats.hxx" #include "charfmt.hxx" #include "docary.hxx" -#include "charformats.hxx" #include "pagedesc.hxx" #include "tblenum.hxx" #include "ndarr.hxx" @@ -66,6 +64,7 @@ class SvxMacro; class SwAutoCompleteWord; class SwAutoCorrExceptWord; class SwCellFrame; +class SwCharFormats; class SwCellStyleTable; class SwCursorShell; class SwCursor; @@ -147,6 +146,8 @@ namespace sw { enum class RedlineMode; enum class FieldmarkMode; enum class ParagraphBreakMode; + template class FrameFormats; + typedef FrameFormats<::SwTableFormat*> TableFrameFormats; class MetaFieldManager; class UndoManager; class IShellCursorSupplier; @@ -807,8 +808,7 @@ public: SW_DLLPUBLIC SwCharFormat *MakeCharFormat(const UIName &rFormatName, SwCharFormat *pDerivedFrom); void DelCharFormat(size_t nFormat, bool bBroadcast = false); void DelCharFormat(SwCharFormat const * pFormat, bool bBroadcast = false); - SwCharFormat* FindCharFormatByName( const UIName& rName ) const - { return mpCharFormatTable->FindFormatByName(rName); } + SW_DLLPUBLIC SwCharFormat* FindCharFormatByName( const UIName& rName ) const; // Formatcollections (styles) // TXT @@ -1595,7 +1595,7 @@ public: const SfxItemSet* pSet ); void SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& ); - // Only for SW-textbloxks! Does not pay any attention to layout! + // Only for SW text blocks! Does not pay any attention to layout! void ClearDoc(); // Deletes all content! // Query /set data for PagePreview. diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index bc14afba28bd..9332023fd1b4 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -299,6 +299,8 @@ public: /// Same as IsObjSelectable(), but return the object as well. SdrObject* GetObjAt(const Point& rPt); bool IsInsideSelectedObj( const Point& rPt ); ///< returns enum values + /** Returns true if it is a background object, and is covered by text at the given point. */ + bool IsTextOverBgObjectAt(const Point& rPt, const SdrObject* pObj); /** Test if there is a draw object at that position and if it should be selected. The 'should' is aimed at Writer text fly frames which may be in front of the draw object. */ diff --git a/sw/inc/swregion.hxx b/sw/inc/swregion.hxx index 338a30649c7a..1a951ab1658b 100644 --- a/sw/inc/swregion.hxx +++ b/sw/inc/swregion.hxx @@ -35,6 +35,7 @@ typedef std::vector SwRects; class SwRegionRects : public SwRects { SwRect m_aOrigin; // Origin area, limits the total area e.g. for Invert() + SwRects* m_pSubtracted = nullptr; inline void InsertRect( const SwRect &rRect, const sal_uInt16 nPos, bool &rDel); @@ -45,6 +46,11 @@ public: // most likely want to call ChangeOrigin() afterwards. explicit SwRegionRects( sal_uInt16 nInit = 20 ); + // Append every rectangle punched from here on, for a caller that wants the pieces a + // selection was built from and not only the region Invert() leaves. Invert() punches + // into a region of its own, so its own work is not recorded. + void RecordSubtracted(SwRects* pRects) { m_pSubtracted = pRects; } + // For punching from aOrigin. void operator-=( const SwRect& rRect ); void operator+=( const SwRect& rRect ); diff --git a/sw/inc/unocrsr.hxx b/sw/inc/unocrsr.hxx index e00ff8e38c01..d74dfd250bae 100644 --- a/sw/inc/unocrsr.hxx +++ b/sw/inc/unocrsr.hxx @@ -141,7 +141,11 @@ namespace sw SwUnoCursor* operator->() const { return get(); } SwUnoCursor& operator*() const - { return *get(); } + { + // shared_ptr::operator* is used instead of get() so that it will assert that the + // pointer is not null. See tdf#173585 + return *m_pCursor; + } UnoCursorPointer& operator=(const UnoCursorPointer& aOther) { if (m_pCursor) diff --git a/sw/qa/core/doc/DocumentRedlineManager.cxx b/sw/qa/core/doc/DocumentRedlineManager.cxx index 3ed6784a1190..a89f8a3c4032 100644 --- a/sw/qa/core/doc/DocumentRedlineManager.cxx +++ b/sw/qa/core/doc/DocumentRedlineManager.cxx @@ -620,6 +620,59 @@ CPPUNIT_TEST_FIXTURE(Test, testFormatThenFormatOther) CPPUNIT_ASSERT_EQUAL(WEIGHT_NORMAL, aSet.Get(RES_CHRATR_WEIGHT).GetValue()); CPPUNIT_ASSERT_EQUAL(ITALIC_NONE, aSet.Get(RES_CHRATR_POSTURE).GetValue()); } + +CPPUNIT_TEST_FIXTURE(Test, testFormatThenFormatAfterOtherFormat) +{ + // Given a "AAA BBB CCC DDD EEE" document with bold format + // redlines authored by Alice: + createSwDoc("fmt-twice.docx"); + SwDocShell* pDocShell = getSwDocShell(); + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + SwDoc* pDoc = pDocShell->GetDoc(); + IDocumentRedlineAccess& rIDRA = pDoc->getIDocumentRedlineAccess(); + SwRedlineTable& rRedlines = rIDRA.GetRedlineTable(); + CPPUNIT_ASSERT_EQUAL(static_cast(2), rRedlines.size()); + CPPUNIT_ASSERT_EQUAL(u"Alice"_ustr, rRedlines[1]->GetAuthorString()); + + // When a different author selects the second range and applies italic: + SwModule* pModule = SwModule::get(); + pModule->SetRedlineAuthor(u"Bob"_ustr); + comphelper::ScopeGuard g( + [pModule] { pModule->SetRedlineAuthor(SwResId(STR_REDLINE_UNKNOWN_AUTHOR)); }); + pWrtShell->SttEndDoc(/*bStt=*/true); + // Skip "AAA ". + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 4, /*bBasicCall=*/false); + // Select "BBB CCC DDD". + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 11, /*bBasicCall=*/false); + SwView& rView = pWrtShell->GetView(); + { + SvxPostureItem aPostureItem(ITALIC_NORMAL, RES_CHRATR_POSTURE); + SfxItemSet aSet( + SfxItemSet::makeFixedSfxItemSet(rView.GetPool())); + aSet.Put(aPostureItem); + pWrtShell->SetAttrSet(aSet); + } + + // Then make sure Bob's redline replaced Alice's on "BBB CCC DDD": + CPPUNIT_ASSERT_EQUAL(static_cast(2), rRedlines.size()); + CPPUNIT_ASSERT_EQUAL(u"Bob"_ustr, rRedlines[1]->GetAuthorString()); + + // And when rejecting Bob's redline: + pWrtShell->RejectRedline(1, /*bDirect=*/false); + + // Then make sure both Alice's bold and Bob's italic are gone from "BBB CCC DDD": + pWrtShell->SttEndDoc(/*bStt=*/true); + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 5, /*bBasicCall=*/false); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet( + pDoc->GetAttrPool())); + pWrtShell->GetCurAttr(aSet); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 5 (WEIGHT_NORMAL) + // - Actual : 8 (WEIGHT_BOLD) + // i.e. Alice's bold survived the reject. + CPPUNIT_ASSERT_EQUAL(WEIGHT_NORMAL, aSet.Get(RES_CHRATR_WEIGHT).GetValue()); + CPPUNIT_ASSERT_EQUAL(ITALIC_NONE, aSet.Get(RES_CHRATR_POSTURE).GetValue()); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/core/doc/data/fmt-twice.docx b/sw/qa/core/doc/data/fmt-twice.docx new file mode 100644 index 000000000000..53e68d550d64 Binary files /dev/null and b/sw/qa/core/doc/data/fmt-twice.docx differ diff --git a/sw/qa/core/doc/data/textbox-shape-zorder.docx b/sw/qa/core/doc/data/textbox-shape-zorder.docx new file mode 100644 index 000000000000..11e43241e44e Binary files /dev/null and b/sw/qa/core/doc/data/textbox-shape-zorder.docx differ diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index 564b938ebd60..9224d3114bf7 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -240,6 +240,38 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxZOrder) CPPUNIT_ASSERT_EQUAL(static_cast(2), pEllipseShape->GetOrdNum()); } +CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testShapeZOrderOverTextBox) +{ + // Given a document with a shape that has a text box at the bottom and two plain shapes over + // it, the three of them asking for that order: + createSwDoc("textbox-shape-zorder.docx"); + + // Then the shapes have to keep the order the document gives them. + uno::Reference xBottom(getShapeByName(u"WithTextBox"), uno::UNO_QUERY); + uno::Reference xMiddle(getShapeByName(u"Middle"), uno::UNO_QUERY); + uno::Reference xTop(getShapeByName(u"Top"), uno::UNO_QUERY); + CPPUNIT_ASSERT(xBottom.is()); + CPPUNIT_ASSERT(xMiddle.is()); + CPPUNIT_ASSERT(xTop.is()); + + sal_Int32 nBottom = 0; + sal_Int32 nMiddle = 0; + sal_Int32 nTop = 0; + xBottom->getPropertyValue(u"ZOrder"_ustr) >>= nBottom; + xMiddle->getPropertyValue(u"ZOrder"_ustr) >>= nMiddle; + xTop->getPropertyValue(u"ZOrder"_ustr) >>= nTop; + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 2 + // The shape over the text box was put one place too high and ended up over the shape that + // should have covered it: the import added a place for the text frame of the text box, + // which the z-order it read back does not count. + CPPUNIT_ASSERT_EQUAL(static_cast(0), nBottom); + CPPUNIT_ASSERT_EQUAL(static_cast(1), nMiddle); + CPPUNIT_ASSERT_EQUAL(static_cast(2), nTop); +} + CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextBoxMakeFlyFrame) { // Given a document with an as-char textbox (as-char draw format + at-char fly format): diff --git a/sw/qa/core/docnode/data/ofz566727923.doc b/sw/qa/core/docnode/data/ofz566727923.doc new file mode 100644 index 000000000000..4c836d081569 Binary files /dev/null and b/sw/qa/core/docnode/data/ofz566727923.doc differ diff --git a/sw/qa/core/docnode/docnode.cxx b/sw/qa/core/docnode/docnode.cxx index 4f1af31c66c1..8bb60b1ad3e9 100644 --- a/sw/qa/core/docnode/docnode.cxx +++ b/sw/qa/core/docnode/docnode.cxx @@ -68,35 +68,48 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156267) CPPUNIT_ASSERT_EQUAL(1, getPages()); } +namespace +{ +/// Counts the boxes of all tables in the document, and the cell sections in the document. +std::pair CountTableBoxesAndCellSections(SwDoc& rDoc) +{ + SwNodes& rNodes = rDoc.GetNodes(); + size_t nBoxes = 0; + int nCellSections = 0; + for (SwNodeOffset nNode(0); nNode < rNodes.Count(); ++nNode) + { + if (const SwTableNode* pTableNode = rNodes[nNode]->GetTableNode()) + nBoxes += pTableNode->GetTable().GetTabSortBoxes().size(); + const SwStartNode* pStartNode = rNodes[nNode]->GetStartNode(); + if (pStartNode && pStartNode->GetStartNodeType() == SwTableBoxStartNode) + ++nCellSections; + } + return { nBoxes, nCellSections }; +} +} + CPPUNIT_TEST_FIXTURE(Test, testTableBoxKeepsItsCellSection) { // Given a document whose tracked deletion carries on across a cell mark, so applying it at // import empties one cell of the table: createSwDoc("ofz515655013.doc"); - // Then every box of the table still has a cell section of its own: - SwDoc* pDoc = getSwDoc(); - SwNodes& rNodes = pDoc->GetNodes(); - const SwTableNode* pTableNode = nullptr; - for (SwNodeOffset nNode(0); nNode < rNodes.Count(); ++nNode) - { - if (rNodes[nNode]->IsTableNode()) - { - pTableNode = rNodes[nNode]->GetTableNode(); - break; - } - } - CPPUNIT_ASSERT(pTableNode); - int nCellSections = 0; - for (SwNodeOffset nNode = pTableNode->GetIndex(); nNode < pTableNode->EndOfSectionIndex(); - ++nNode) - { - const SwStartNode* pStartNode = rNodes[nNode]->GetStartNode(); - if (pStartNode && pStartNode->GetStartNodeType() == SwTableBoxStartNode) - ++nCellSections; - } - CPPUNIT_ASSERT_EQUAL(static_cast(6), pTableNode->GetTable().GetTabSortBoxes().size()); - CPPUNIT_ASSERT_EQUAL(6, nCellSections); + // Then every box of every table still has a cell section of its own: + auto[nBoxes, nCellSections] = CountTableBoxesAndCellSections(*getSwDoc()); + CPPUNIT_ASSERT_EQUAL(static_cast(26), nBoxes); + CPPUNIT_ASSERT_EQUAL(26, nCellSections); +} + +CPPUNIT_TEST_FIXTURE(Test, testTableKeepsCellInsideDeletion) +{ + // Given a document whose tracked deletion starts in one cell and ends two cells later, so the + // cell between them lies wholly inside the deletion: + createSwDoc("ofz566727923.doc"); + + // Then every box of every table still has a cell section of its own: + auto[nBoxes, nCellSections] = CountTableBoxesAndCellSections(*getSwDoc()); + CPPUNIT_ASSERT_EQUAL(static_cast(25), nBoxes); + CPPUNIT_ASSERT_EQUAL(25, nCellSections); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx index 12434415569e..e099b589adbf 100644 --- a/sw/qa/core/layout/ftnfrm.cxx +++ b/sw/qa/core/layout/ftnfrm.cxx @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/sw/qa/core/layout/tabfrm.cxx b/sw/qa/core/layout/tabfrm.cxx index d0e6e07a9e92..cdf7f490dfed 100644 --- a/sw/qa/core/layout/tabfrm.cxx +++ b/sw/qa/core/layout/tabfrm.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include namespace diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx b/sw/qa/core/objectpositioning/objectpositioning.cxx index 4c2aef1f56d5..fbb973c80347 100644 --- a/sw/qa/core/objectpositioning/objectpositioning.cxx +++ b/sw/qa/core/objectpositioning/objectpositioning.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/qa/core/text/EnhancedPDFExportHelper.cxx b/sw/qa/core/text/EnhancedPDFExportHelper.cxx index f95aa27e6a1f..b3b626304dbf 100644 --- a/sw/qa/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/qa/core/text/EnhancedPDFExportHelper.cxx @@ -1,8 +1,6 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -12,11 +10,14 @@ #include #include +#include #include #include +#include #include #include +#include #include namespace @@ -31,6 +32,71 @@ public: } }; +// the text an element's own marked content holds, excluding any nested element's +OUString lcl_GetOwnText(vcl::pdf::PDFiumStructureElement& rElement, + const std::unordered_map& rTexts) +{ + OUString aText; + for (int i = 0; i < rElement.getNumberOfChildren(); ++i) + { + if (const int nMarkedContentID = rElement.getChildMarkedContentID(i); nMarkedContentID >= 0) + { + const auto it = rTexts.find(nMarkedContentID); + if (it != rTexts.end()) + aText += it->second; + } + } + return aText.trim(); +} + +// every element holding text or a description, in document order, with the language it +// specifies - one specifying none is listed without a language, and inherits its parent's +OUString lcl_CollectLanguages(vcl::pdf::PDFiumStructureElement& rElement, + const std::unordered_map& rTexts) +{ + OUString aLanguages; + OUString aLabel(lcl_GetOwnText(rElement, rTexts)); + if (aLabel.isEmpty()) + { + // a frame holds no text of its own, so its description identifies it + aLabel = rElement.getAltText(); + } + if (!aLabel.isEmpty()) + { + const OUString aLanguage(rElement.getLang()); + aLanguages = rElement.getType() + (aLanguage.isEmpty() ? u""_ustr : " " + aLanguage) + ": " + + aLabel + "\n"; + } + + for (int i = 0; i < rElement.getNumberOfChildren(); ++i) + { + if (const auto pChild = rElement.getChild(i)) + aLanguages += lcl_CollectLanguages(*pChild, rTexts); + } + return aLanguages; +} + +// the kids of every Ruby, in the order they are emitted, each with the text it covers +OUString lcl_CollectRubies(vcl::pdf::PDFiumStructureElement& rElement, + const std::unordered_map& rTexts) +{ + OUString aRubies; + if (rElement.getType() == "Ruby") + { + for (int i = 0; i < rElement.getNumberOfChildren(); ++i) + { + if (const auto pKid = rElement.getChild(i)) + aRubies += pKid->getType() + ": " + lcl_GetOwnText(*pKid, rTexts) + "\n"; + } + } + for (int i = 0; i < rElement.getNumberOfChildren(); ++i) + { + if (const auto pChild = rElement.getChild(i)) + aRubies += lcl_CollectRubies(*pChild, rTexts); + } + return aRubies; +} + CPPUNIT_TEST_FIXTURE(Test, testTdf171022) { createSwDoc("structure-destinations.fodt"); @@ -47,11 +113,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf171022) // the outline item, the footnote's two links, the shape's link and the citation's std::vector aOutlineTypes; std::vector aLinkTypes; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pAction = dynamic_cast(pObject->Lookup("A"_ostr)); if (!pAction) continue; @@ -119,11 +182,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFootnoteNoteType) // the type of the one element a footnote frame opens const auto aFootnoteType = [](vcl::filter::PDFDocument& rDocument) -> OString { - for (const auto& rDocElement : rDocument.GetElements()) + for (auto* pObject : rDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("S"_ostr)); if (pType && (pType->GetValue() == "Note" || pType->GetValue() == "FENote")) return pType->GetValue(); @@ -175,12 +235,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTOCItemRef) // name the element its entry reaches OStringBuffer aTargets; std::unordered_set aSeen; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; - auto pType = dynamic_cast(pObject->Lookup("S"_ostr)); if (!pType || pType->GetValue() != "TOCI") continue; @@ -220,12 +276,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFormulaAltFromSource) CPPUNIT_ASSERT(aDocument.Read(*maTempFile.GetStream(StreamMode::READ))); OUStringBuffer aAlts; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; - auto pType = dynamic_cast(pObject->Lookup("S"_ostr)); if (!pType || pType->GetValue() != "Formula") continue; @@ -255,12 +307,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFormulaPlacement) OString aInALine; OString aInAParagraph; OString aOnThePage; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; - auto pType = dynamic_cast(pObject->Lookup("S"_ostr)); if (!pType || pType->GetValue() != "Formula") continue; @@ -309,12 +357,8 @@ CPPUNIT_TEST_FIXTURE(Test, testLayoutAttributeUnits) vcl::filter::PDFDictionaryElement* pIndented = nullptr; vcl::filter::PDFDictionaryElement* pHanging = nullptr; vcl::filter::PDFDictionaryElement* pCell = nullptr; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; - auto pType = dynamic_cast(pObject->Lookup("S"_ostr)); auto pAttributes = dynamic_cast(pObject->Lookup("A"_ostr)); @@ -360,43 +404,260 @@ CPPUNIT_TEST_FIXTURE(Test, testParagraphLanguage) { createSwDoc("paragraph-language.fodt"); + uno::Sequence aFilterData{ comphelper::makePropertyValue(u"UseTaggedPDF"_ustr, true) }; + save(TestFilter::PDF_WRITER, + { comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) }); + + // the value the entries below state where they state one, and what the rest inherit + vcl::filter::PDFDocument aDocument; + CPPUNIT_ASSERT(aDocument.Read(*maTempFile.GetStream(StreamMode::READ))); + auto pCatalog = aDocument.GetCatalog(); + CPPUNIT_ASSERT(pCatalog); + CPPUNIT_ASSERT(pCatalog->GetDictionary()); + auto pDocumentLanguage = dynamic_cast( + pCatalog->GetDictionary()->LookupElement("Lang"_ostr)); + CPPUNIT_ASSERT(pDocumentLanguage); + CPPUNIT_ASSERT_EQUAL("en-US"_ostr, pDocumentLanguage->GetValue()); + + auto pPdfDocument = parsePDFExport(vcl::pdf::PDFiumLibrary::get()); + auto pPdfPage = pPdfDocument->openPage(0); + CPPUNIT_ASSERT(pPdfPage); + auto pTextPage = pPdfPage->getTextPage(); + + // the text behind each marked content id, to identify the element covering it + std::unordered_map aTexts; + for (int i = 0; i < pPdfPage->getObjectCount(); ++i) + { + auto pObject = pPdfPage->getObject(i); + if (const int nMarkedContentID = pObject->getMarkedContentID(); nMarkedContentID >= 0) + aTexts[nMarkedContentID] += pObject->getText(pTextPage); + } + + auto pTree = pPdfPage->getStructureTree(); + CPPUNIT_ASSERT(pTree); + OUString aLanguages; + for (int i = 0; i < pTree->getNumberOfChildren(); ++i) + { + if (const auto pChild = pTree->getChild(i)) + aLanguages += lcl_CollectLanguages(*pChild, aTexts); + } + + CPPUNIT_ASSERT_EQUAL( + // specifies no language, being in the document's, so it inherits + u"P: A paragraph in the language of the document.\n" + "P de-DE: Ein Absatz, der ganz und gar deutsch ist.\n" + // the gap is where the German span took its words out of the paragraph + "P: English with in it.\n" + "Span de-DE: ein paar deutsche Worte\n" + "P de-DE: Ein deutscher Absatz mit darin.\n" + // the run differs from its paragraph, not from the document + "Span en-US: a few English words\n" + // a paragraph holding an anchor specified no language before, a Span carrying it + "P de-DE: Ein deutscher Absatz mit einem Rahmen.\n" + // the shape's own element, so its description does not inherit the paragraph's + "Div en-US: A shape described in the language of the document\n" + // the shape's text, tagged by drawinglayer since fr1 has no parent style + "P en-US: Text inside the frame.\n" + "P de-DE: Ein deutscher Absatz mit einem Textrahmen.\n" + // a Writer text frame, identified by its description + "Div en-US: Described in the language of the document\n" + // specifies none: the frame's Div specifies en-US for what it contains + "P: Text in a Writer frame.\n" + "P de-DE: Ein deutscher Absatz mit einem Bild.\n" + "Figure en-US: A picture described in the language of the document\n"_ustr, + aLanguages); +} + +// the rectangle of every link annotation, down the page, each annotation carrying the +// /StructParent that ISO 14289-1 7.18.5 needs to find its Link element +std::vector lcl_CollectTaggedLinkRects(vcl::filter::PDFDocument& rDocument) +{ + std::vector aRects; + for (auto* pObject : rDocument.GetObjects()) + { + auto pSubtype = dynamic_cast(pObject->Lookup("Subtype"_ostr)); + if (!pSubtype || pSubtype->GetValue() != "Link") + continue; + CPPUNIT_ASSERT_MESSAGE("a link annotation with no /StructParent", + pObject->Lookup("StructParent"_ostr)); + auto pRect = dynamic_cast(pObject->Lookup("Rect"_ostr)); + CPPUNIT_ASSERT(pRect); + CPPUNIT_ASSERT_EQUAL(size_t(4), pRect->GetElements().size()); + const auto aCorner = [pRect](size_t nIndex) { + auto pNumber = dynamic_cast(pRect->GetElement(nIndex)); + CPPUNIT_ASSERT(pNumber); + return pNumber->GetValue(); + }; + aRects.emplace_back(aCorner(0), aCorner(1), aCorner(2), aCorner(3)); + } + // PDF y coordinates increase upwards, so the highest bottom is the first line + std::ranges::sort(aRects, + [](const basegfx::B2DRectangle& rLeft, const basegfx::B2DRectangle& rRight) { + return rLeft.getMinY() > rRight.getMinY(); + }); + return aRects; +} + +CPPUNIT_TEST_FIXTURE(Test, testLinkEndsInRuby) +{ + createSwDoc("link-ends-in-ruby.fodt"); + uno::Sequence aFilterData{ comphelper::makePropertyValue(u"UseTaggedPDF"_ustr, true) }; save(TestFilter::PDF_WRITER, { comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) }); vcl::filter::PDFDocument aDocument; - maTempFile.CloseStream(); CPPUNIT_ASSERT(aDocument.Read(*maTempFile.GetStream(StreamMode::READ))); - // every structure element that names a language, sorted: they are emitted by object and - // not by document order - std::vector aLanguages; - for (const auto& rDocElement : aDocument.GetElements()) + // one rectangle per line the link covers, and no third one over the empty band beside + // the ruby, which no structure element could cover + const std::vector aRects(lcl_CollectTaggedLinkRects(aDocument)); + CPPUNIT_ASSERT_EQUAL(size_t(2), aRects.size()); + // the first line holds text alone; the second carries the ruby, and its rectangle + // stands over the ruby's band so that the phonetic annotation takes the click + CPPUNIT_ASSERT_DOUBLES_EQUAL(13.8, aRects[0].getHeight(), 0.5); + CPPUNIT_ASSERT_DOUBLES_EQUAL(20.7, aRects[1].getHeight(), 0.5); +} + +CPPUNIT_TEST_FIXTURE(Test, testLinkEndsInRubyVertical) +{ + createSwDoc("link-ends-in-ruby-vertical.fodt"); + + uno::Sequence aFilterData{ comphelper::makePropertyValue(u"UseTaggedPDF"_ustr, true) }; + save(TestFilter::PDF_WRITER, + { comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) }); + + vcl::filter::PDFDocument aDocument; + CPPUNIT_ASSERT(aDocument.Read(*maTempFile.GetStream(StreamMode::READ))); + + // the region split hands this line back in pieces, one of them holding the ruby and + // none of the line's text, which nothing paints in and so nothing tags; the count is + // what this pins - the width was already right before the pieces were joined + const std::vector aRects(lcl_CollectTaggedLinkRects(aDocument)); + CPPUNIT_ASSERT_EQUAL(size_t(1), aRects.size()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(20.7, aRects[0].getWidth(), 0.5); +} + +CPPUNIT_TEST_FIXTURE(Test, testLinkEndsInRubyVerticalWrapped) +{ + createSwDoc("link-ends-in-ruby-vertical-wrapped.fodt"); + + uno::Sequence aFilterData{ comphelper::makePropertyValue(u"UseTaggedPDF"_ustr, true) }; + save(TestFilter::PDF_WRITER, + { comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) }); + + vcl::filter::PDFDocument aDocument; + CPPUNIT_ASSERT(aDocument.Read(*maTempFile.GetStream(StreamMode::READ))); + + // an annotation for each of the three lines, all tagged, which the collector asserts + std::vector aRects(lcl_CollectTaggedLinkRects(aDocument)); + CPPUNIT_ASSERT_EQUAL(size_t(3), aRects.size()); + // the text runs down the page from the right, so the widest x is the first line + std::ranges::sort(aRects, + [](const basegfx::B2DRectangle& rLeft, const basegfx::B2DRectangle& rRight) { + return rLeft.getMinX() > rRight.getMinX(); + }); + // only the third line carries the ruby, and only it is as wide as a ruby makes a line + CPPUNIT_ASSERT_DOUBLES_EQUAL(13.8, aRects[0].getWidth(), 0.5); + CPPUNIT_ASSERT_DOUBLES_EQUAL(13.8, aRects[1].getWidth(), 0.5); + CPPUNIT_ASSERT_DOUBLES_EQUAL(20.7, aRects[2].getWidth(), 0.5); +} + +CPPUNIT_TEST_FIXTURE(Test, testLinkPartRubyOneLine) +{ + createSwDoc("link-part-ruby-one-line.fodt"); + + uno::Sequence aFilterData{ comphelper::makePropertyValue(u"UseTaggedPDF"_ustr, true) }; + save(TestFilter::PDF_WRITER, + { comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) }); + + vcl::filter::PDFDocument aDocument; + CPPUNIT_ASSERT(aDocument.Read(*maTempFile.GetStream(StreamMode::READ))); + + // an annotation is a plain box, so a ruby over the link's second half raises the whole + // rectangle; leaving the first half its own height would need a quadrilateral + const std::vector aRects(lcl_CollectTaggedLinkRects(aDocument)); + CPPUNIT_ASSERT_EQUAL(size_t(1), aRects.size()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(20.7, aRects[0].getHeight(), 0.5); +} + +CPPUNIT_TEST_FIXTURE(Test, testLinkStartsAfterRuby) +{ + createSwDoc("link-starts-after-ruby.fodt"); + + uno::Sequence aFilterData{ comphelper::makePropertyValue(u"UseTaggedPDF"_ustr, true) }; + save(TestFilter::PDF_WRITER, + { comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) }); + + vcl::filter::PDFDocument aDocument; + CPPUNIT_ASSERT(aDocument.Read(*maTempFile.GetStream(StreamMode::READ))); + + const std::vector aRects(lcl_CollectTaggedLinkRects(aDocument)); + CPPUNIT_ASSERT_EQUAL(size_t(1), aRects.size()); + // the ruby raises the line, so the link standing beside it is as tall as the line + CPPUNIT_ASSERT_DOUBLES_EQUAL(20.7, aRects[0].getHeight(), 0.5); + // the ruby belongs to no link, so the rectangle starts to the right of it, not at the + // left text margin of 56.7pt + CPPUNIT_ASSERT_GREATER(65.0, aRects[0].getMinX()); +} + +CPPUNIT_TEST_FIXTURE(Test, testLinkStartsAtAbuttingRuby) +{ + createSwDoc("link-starts-at-abutting-ruby.fodt"); + + uno::Sequence aFilterData{ comphelper::makePropertyValue(u"UseTaggedPDF"_ustr, true) }; + save(TestFilter::PDF_WRITER, + { comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) }); + + vcl::filter::PDFDocument aDocument; + CPPUNIT_ASSERT(aDocument.Read(*maTempFile.GetStream(StreamMode::READ))); + + const std::vector aRects(lcl_CollectTaggedLinkRects(aDocument)); + CPPUNIT_ASSERT_EQUAL(size_t(1), aRects.size()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(20.7, aRects[0].getHeight(), 0.5); + // a hit test at the link's first character lands in the ruby before it, which the link + // does not cover, so the rectangle starts at the second ruby + CPPUNIT_ASSERT_GREATER(65.0, aRects[0].getMinX()); +} + +CPPUNIT_TEST_FIXTURE(Test, testRubyStructureOrder) +{ + createSwDoc("ruby-positions.fodt"); + + uno::Sequence aFilterData{ comphelper::makePropertyValue(u"UseTaggedPDF"_ustr, true) }; + save(TestFilter::PDF_WRITER, + { comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) }); + + auto pPdfDocument = parsePDFExport(vcl::pdf::PDFiumLibrary::get()); + auto pPdfPage = pPdfDocument->openPage(0); + CPPUNIT_ASSERT(pPdfPage); + auto pTextPage = pPdfPage->getTextPage(); + + // the text behind each marked content id, to identify the element covering it + std::unordered_map aTexts; + for (int i = 0; i < pPdfPage->getObjectCount(); ++i) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; - - auto pType = dynamic_cast(pObject->Lookup("S"_ostr)); - auto pLang - = dynamic_cast(pObject->Lookup("Lang"_ostr)); - if (!pType || !pLang) - continue; - - aLanguages.push_back(pType->GetValue() + "=" + pLang->GetValue()); + auto pObject = pPdfPage->getObject(i); + if (const int nMarkedContentID = pObject->getMarkedContentID(); nMarkedContentID >= 0) + aTexts[nMarkedContentID] += pObject->getText(pTextPage); } - std::sort(aLanguages.begin(), aLanguages.end()); - CPPUNIT_ASSERT_EQUAL(size_t(5), aLanguages.size()); - // the German words in an English paragraph, and the text of the paragraph holding a frame, - // which says nothing itself because what is anchored there hangs under it - CPPUNIT_ASSERT_EQUAL("Span=de-DE"_ostr, aLanguages[0]); - CPPUNIT_ASSERT_EQUAL("Span=de-DE"_ostr, aLanguages[1]); - // Without the fix this was de-DE: the run differs from its paragraph, not from the document - CPPUNIT_ASSERT_EQUAL("Span=en-US"_ostr, aLanguages[2]); - // and without it neither German paragraph named a language at all - CPPUNIT_ASSERT_EQUAL("Standard=de-DE"_ostr, aLanguages[3]); - CPPUNIT_ASSERT_EQUAL("Standard=de-DE"_ostr, aLanguages[4]); + auto pTree = pPdfPage->getStructureTree(); + CPPUNIT_ASSERT(pTree); + OUString aRubies; + for (int i = 0; i < pTree->getNumberOfChildren(); ++i) + { + if (const auto pChild = pTree->getChild(i)) + aRubies += lcl_CollectRubies(*pChild, aTexts); + } + + // ISO 32000-2 Table 369 requires RB first. An annotation above its base paints first and + // is still the RT; one below paints second and is still the RT + CPPUNIT_ASSERT_EQUAL(u"RB: base above\n" + "RT: anno above\n" + "RB: base below\n" + "RT: anno below\n"_ustr, + aRubies); } } diff --git a/sw/qa/core/text/data/link-ends-in-ruby-vertical-wrapped.fodt b/sw/qa/core/text/data/link-ends-in-ruby-vertical-wrapped.fodt new file mode 100644 index 000000000000..a8763d79c69e --- /dev/null +++ b/sw/qa/core/text/data/link-ends-in-ruby-vertical-wrapped.fodt @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A hyperlink long enough to wrap, ending in a phonetic annotation whose band is taller than the rest of the line A hyperlink long enough to wrap, ending in a phonetic annotation whose band is taller than the rest of the line A hyperlink long enough to wrap, ending in a phonetic annotation whose band is taller than the rest of the line A hyperlink long enough to wrap, ending in a phonetic annotation whose band is taller than the rest of the line baseruby + + + diff --git a/sw/qa/core/text/data/link-ends-in-ruby-vertical.fodt b/sw/qa/core/text/data/link-ends-in-ruby-vertical.fodt new file mode 100644 index 000000000000..1a6e03ea217a --- /dev/null +++ b/sw/qa/core/text/data/link-ends-in-ruby-vertical.fodt @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A hyperlink long enough to wrap, ending in a phonetic annotation whose band is taller than the rest of the line baseruby + + + diff --git a/sw/qa/core/text/data/link-ends-in-ruby.fodt b/sw/qa/core/text/data/link-ends-in-ruby.fodt new file mode 100644 index 000000000000..488e3479921c --- /dev/null +++ b/sw/qa/core/text/data/link-ends-in-ruby.fodt @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A hyperlink long enough to wrap, ending in a phonetic annotation whose band is taller than the rest of the line baseruby + + + diff --git a/sw/qa/core/text/data/link-part-ruby-one-line.fodt b/sw/qa/core/text/data/link-part-ruby-one-line.fodt new file mode 100644 index 000000000000..5420774f421b --- /dev/null +++ b/sw/qa/core/text/data/link-part-ruby-one-line.fodt @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + plain half then baseruby + + + diff --git a/sw/qa/core/text/data/link-starts-after-ruby.fodt b/sw/qa/core/text/data/link-starts-after-ruby.fodt new file mode 100644 index 000000000000..5126d517094c --- /dev/null +++ b/sw/qa/core/text/data/link-starts-after-ruby.fodt @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + baserubylink after the ruby + + + diff --git a/sw/qa/core/text/data/link-starts-at-abutting-ruby.fodt b/sw/qa/core/text/data/link-starts-at-abutting-ruby.fodt new file mode 100644 index 000000000000..287e2e957f75 --- /dev/null +++ b/sw/qa/core/text/data/link-starts-at-abutting-ruby.fodt @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + baserubywordyomi and more + + + diff --git a/sw/qa/core/text/data/paragraph-language.fodt b/sw/qa/core/text/data/paragraph-language.fodt index ad7c53e52e12..941855249155 100644 --- a/sw/qa/core/text/data/paragraph-language.fodt +++ b/sw/qa/core/text/data/paragraph-language.fodt @@ -17,6 +17,9 @@ + + + @@ -30,7 +33,9 @@ Ein Absatz, der ganz und gar deutsch ist. English with ein paar deutsche Worte in it. Ein deutscher Absatz mit a few English words darin. - Ein deutscher Absatz mit einem Rahmen.Text inside the frame. + Ein deutscher Absatz mit einem Rahmen.Text inside the frame.A shape described in the language of the document + Ein deutscher Absatz mit einem Textrahmen.Text in a Writer frame.Described in the language of the document + Ein deutscher Absatz mit einem Bild.iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==A picture described in the language of the document diff --git a/sw/qa/core/text/data/ruby-positions.fodt b/sw/qa/core/text/data/ruby-positions.fodt new file mode 100644 index 000000000000..d143d7625c03 --- /dev/null +++ b/sw/qa/core/text/data/ruby-positions.fodt @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + base aboveanno above + base belowanno below + + + diff --git a/sw/qa/core/undo/data/tdf169795.odt b/sw/qa/core/undo/data/tdf169795.odt new file mode 100644 index 000000000000..c675f82c7ed5 Binary files /dev/null and b/sw/qa/core/undo/data/tdf169795.odt differ diff --git a/sw/qa/core/undo/undo.cxx b/sw/qa/core/undo/undo.cxx index 339fed31c1f2..951a89a09c97 100644 --- a/sw/qa/core/undo/undo.cxx +++ b/sw/qa/core/undo/undo.cxx @@ -25,6 +25,28 @@ #include #include #include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include +#include /// Covers sw/source/core/undo/ fixes. class SwCoreUndoTest : public SwModelTestBase @@ -105,6 +127,175 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTableCopyRedline) pWrtShell->Undo(); } +namespace +{ +/// Put the view cursor into the given cell of the given table. +void lcl_GotoCell(const uno::Reference& xComponent, SwXTextDocument* pTextDoc, + const OUString& rTable, const OUString& rCell) +{ + uno::Reference xSupplier(xComponent, uno::UNO_QUERY_THROW); + uno::Reference xTable(xSupplier->getTextTables()->getByName(rTable), + uno::UNO_QUERY_THROW); + uno::Reference xCell(xTable->getCellByName(rCell), uno::UNO_QUERY_THROW); + uno::Reference xCursorSupplier(pTextDoc->getCurrentController(), + uno::UNO_QUERY_THROW); + xCursorSupplier->getViewCursor()->gotoRange(xCell->getStart(), /*bExpand=*/false); +} + +/// The text of the given cell of the given table. +OUString lcl_GetCellText(const uno::Reference& xComponent, const OUString& rTable, + const OUString& rCell) +{ + uno::Reference xSupplier(xComponent, uno::UNO_QUERY_THROW); + uno::Reference xTable(xSupplier->getTextTables()->getByName(rTable), + uno::UNO_QUERY_THROW); + uno::Reference xCell(xTable->getCellByName(rCell), uno::UNO_QUERY_THROW); + return xCell->getString(); +} + +/// The formula of the given cell of the given table, empty when it holds none. +OUString lcl_GetCellFormula(const uno::Reference& xComponent, + const OUString& rTable, const OUString& rCell) +{ + uno::Reference xSupplier(xComponent, uno::UNO_QUERY_THROW); + uno::Reference xTable(xSupplier->getTextTables()->getByName(rTable), + uno::UNO_QUERY_THROW); + uno::Reference xCell(xTable->getCellByName(rCell)); + CPPUNIT_ASSERT(xCell.is()); + return xCell->getFormula(); +} + +/// The tracked changes of the document, as a ":" list. +OUString lcl_GetRedlines(SwDoc* pDoc) +{ + OUString aRet; + const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + for (SwRedlineTable::size_type i = 0; i < rTable.size(); ++i) + { + if (!aRet.isEmpty()) + aRet += " "; + aRet += SwRedlineTypeToOUString(rTable[i]->GetType()) + ":" + rTable[i]->GetText(); + } + return aRet; +} + +/// Every cursor position has to stay inside the text of the node it points at. +void lcl_AssertCursorInText(SwWrtShell* pWrtShell) +{ + for (const SwPaM& rPaM : pWrtShell->GetCursor()->GetRingContainer()) + { + for (const SwPosition* pPos : { rPaM.GetPoint(), rPaM.GetMark() }) + { + const SwContentNode* pContentNode = pPos->GetNode().GetContentNode(); + if (!pContentNode) + continue; + CPPUNIT_ASSERT_LESSEQUAL(pContentNode->Len(), pPos->GetContentIndex()); + } + } +} +} + +CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTdf169795CopyCellWithFormula) +{ + // Given a document with two tables and change recording enabled, where the cell to copy + // holds a formula and the cell to copy it over does not: + createSwDoc("tdf169795.odt"); + SwDocShell* pDocShell = getSwDocShell(); + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + SwXTextDocument* pTextDoc = getSwTextDoc(); + SwDoc* pDoc = pWrtShell->GetDoc(); + pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowInsert + | RedlineFlags::ShowDelete); + CPPUNIT_ASSERT_EQUAL(OUString(), lcl_GetCellFormula(mxComponent, u"Table1"_ustr, u"D2"_ustr)); + + // When copying that whole cell, "$100.00", over "$10.00": + lcl_GotoCell(mxComponent, pTextDoc, u"Table2"_ustr, u"D3"_ustr); + pWrtShell->SelTableBox(); + rtl::Reference pTransfer = new SwTransferable(*pWrtShell); + pTransfer->Copy(); + TransferableDataHelper aHelper(pTransfer); + lcl_GotoCell(mxComponent, pTextDoc, u"Table1"_ustr, u"D2"_ustr); + pWrtShell->SelTableBox(); + SwTransferable::Paste(*pWrtShell, aHelper); + + // Then no change is recorded over the cell: what it shows is worked out from the formula in + // its new place, not text that somebody wrote, so there is nothing to accept or reject. + // Without the accompanying fix in place, the copy was recorded as a change over text that + // the recalculation then rewrote, and the records left over that text described text that + // was no longer there. + CPPUNIT_ASSERT_EQUAL(OUString(), lcl_GetRedlines(pDoc)); + CPPUNIT_ASSERT(!lcl_GetCellFormula(mxComponent, u"Table1"_ustr, u"D2"_ustr).isEmpty()); + CPPUNIT_ASSERT_EQUAL(u"$10.00"_ustr, lcl_GetCellText(mxComponent, u"Table1"_ustr, u"D2"_ustr)); + + // And undo takes the formula away again, leaving the old value behind. + pWrtShell->Undo(); + CPPUNIT_ASSERT_EQUAL(OUString(), lcl_GetRedlines(pDoc)); + CPPUNIT_ASSERT_EQUAL(OUString(), lcl_GetCellFormula(mxComponent, u"Table1"_ustr, u"D2"_ustr)); + CPPUNIT_ASSERT_EQUAL(u"$10.00"_ustr, lcl_GetCellText(mxComponent, u"Table1"_ustr, u"D2"_ustr)); + + // The cursor has to stay inside the text it points at. Without the fix, undo left it on the + // range of the pasted text, which the undo removed again, so it pointed past the end of the + // cell text: content index 11 of a 6 character long node. + lcl_AssertCursorInText(pWrtShell); + + // ... and counting words over that selection must not run out of the text either; this is + // what the status bar does, and what crashed in SwScanner. + SwDocStat aDocStat; + pWrtShell->CountWords(aDocStat); + + // Redo puts the formula back, again without recording a change, and again with a cursor that + // describes something. Without the fix, redo went down the route the copy had not taken. + pWrtShell->Redo(); + CPPUNIT_ASSERT_EQUAL(OUString(), lcl_GetRedlines(pDoc)); + CPPUNIT_ASSERT(!lcl_GetCellFormula(mxComponent, u"Table1"_ustr, u"D2"_ustr).isEmpty()); + lcl_AssertCursorInText(pWrtShell); + pWrtShell->CountWords(aDocStat); +} + +CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testTdf169795NumFormatCellPasteKeepsTrackedChanges) +{ + // Given a document with number cells and change recording enabled: + createSwDoc("tdf169795.odt"); + SwDocShell* pDocShell = getSwDocShell(); + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + SwXTextDocument* pTextDoc = getSwTextDoc(); + SwDoc* pDoc = pWrtShell->GetDoc(); + pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowInsert + | RedlineFlags::ShowDelete); + + // When copying one currency cell over another one: + lcl_GotoCell(mxComponent, pTextDoc, u"Table1"_ustr, u"C3"_ustr); + pWrtShell->SelTableBox(); + rtl::Reference pTransfer = new SwTransferable(*pWrtShell); + pTransfer->Copy(); + TransferableDataHelper aHelper(pTransfer); + lcl_GotoCell(mxComponent, pTextDoc, u"Table1"_ustr, u"C2"_ustr); + pWrtShell->SelTableBox(); + SwTransferable::Paste(*pWrtShell, aHelper); + + // Then the old value has to be kept as a deletion. + // Without the accompanying fix in place, the number format of the box regenerated the text + // of the cell right after the copy, which dropped the deletion: only the insertion was left, + // and the old value was gone for good. + OUString aExpected(u"Insert:$2.00 Delete:$1.00"_ustr); + CPPUNIT_ASSERT_EQUAL(aExpected, lcl_GetRedlines(pDoc)); + + // Leaving the cell must not drop it either, that is where the cell is checked against its + // number format. + pWrtShell->EndAllTableBoxEdit(); + CPPUNIT_ASSERT_EQUAL(aExpected, lcl_GetRedlines(pDoc)); + + // And undo and redo have to be symmetric: undo leaves the old value alone, + pWrtShell->Undo(); + CPPUNIT_ASSERT_EQUAL(OUString(), lcl_GetRedlines(pDoc)); + CPPUNIT_ASSERT_EQUAL(u"$1.00"_ustr, lcl_GetCellText(mxComponent, u"Table1"_ustr, u"C2"_ustr)); + + // ... and redo puts the very same pair of changes back. Without the fix, redo produced two + // empty redlines instead, which piled up over further undo and redo rounds. + pWrtShell->Redo(); + CPPUNIT_ASSERT_EQUAL(aExpected, lcl_GetRedlines(pDoc)); +} + CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testImagePropsCreateUndoAndModifyDoc) { createSwDoc("image-as-character.odt"); @@ -152,6 +343,68 @@ CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testImagePropsCreateUndoAndModifyDoc) CPPUNIT_ASSERT(!pWrtShell->GetLastUndoInfo(nullptr, nullptr, nullptr)); } +CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testCropImageSingleUndo) +{ + // Cropping an image by dragging a handle is a single undo step. + createSwDoc("image-as-character.odt"); + SwXTextDocument* pTextDoc = getSwTextDoc(); + uno::Any aImage = pTextDoc->getGraphicObjects()->getByName(u"Image1"_ustr); + uno::Reference xImage(aImage, uno::UNO_QUERY_THROW); + + auto getCrop = [&xImage] { + css::text::GraphicCrop aCrop; + xImage->getPropertyValue(u"GraphicCrop"_ustr) >>= aCrop; + return aCrop; + }; + + const auto& rFormats = *getSwDoc()->GetSpzFrameFormats(); + CPPUNIT_ASSERT_EQUAL(static_cast(1), rFormats.size()); + const Size aOldSize = rFormats[0]->GetFrameSize().GetSize(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getCrop().Left); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getCrop().Top); + + // Select the image and enter crop mode. + uno::Reference xSelectionSupplier( + pTextDoc->getCurrentController(), uno::UNO_QUERY_THROW); + xSelectionSupplier->select(aImage); + getSwDocShell()->GetView()->StopShellTimer(); + dispatchCommand(mxComponent, u".uno:Crop"_ustr, {}); + + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + const SdrHdlList& rHdlList = pWrtShell->GetDrawView()->GetHdlList(); + const SdrHdl* pTopLeft = rHdlList.GetHdl(0); + const SdrHdl* pBottomRight = rHdlList.GetHdl(7); + CPPUNIT_ASSERT(pTopLeft); + CPPUNIT_ASSERT(pBottomRight); + CPPUNIT_ASSERT_EQUAL(SdrHdlKind::UpperLeft, pTopLeft->GetKind()); + CPPUNIT_ASSERT_EQUAL(SdrHdlKind::LowerRight, pBottomRight->GetKind()); + + // Drag the upper left handle a quarter of the way towards the lower right one. + const Point aNewPos( + pTopLeft->GetPos().X() + (pBottomRight->GetPos().X() - pTopLeft->GetPos().X()) / 4, + pTopLeft->GetPos().Y() + (pBottomRight->GetPos().Y() - pTopLeft->GetPos().Y()) / 4); + uno::Sequence aArgs(comphelper::InitPropertySequence({ + { u"HandleNum"_ustr, uno::Any(sal_Int32(0)) }, + { u"NewPosX"_ustr, uno::Any(static_cast(aNewPos.X())) }, + { u"NewPosY"_ustr, uno::Any(static_cast(aNewPos.Y())) }, + })); + dispatchCommand(mxComponent, u".uno:MoveShapeHandle"_ustr, aArgs); + + CPPUNIT_ASSERT_GREATER(sal_Int32(0), getCrop().Left); + CPPUNIT_ASSERT_GREATER(sal_Int32(0), getCrop().Top); + CPPUNIT_ASSERT_LESS(aOldSize.Width(), rFormats[0]->GetFrameSize().GetWidth()); + + dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); + + // Without the fix, the crop was left for a second undo, so this failed with: + // - Expected: 0 + // - Actual : 1270 + // i.e. the frame had its original size back while the graphic stayed cropped. + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getCrop().Left); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getCrop().Top); + CPPUNIT_ASSERT_EQUAL(aOldSize, rFormats[0]->GetFrameSize().GetSize()); +} + CPPUNIT_TEST_FIXTURE(SwCoreUndoTest, testAnchorTypeChangePosition) { // Given a document with a textbox (draw + fly format pair) + an inner image: diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index 9161f0ea1c65..5bc5929f6324 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 47261bff8ed6..12a7232e1b13 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -1530,11 +1530,8 @@ CPPUNIT_TEST_FIXTURE(Test, testListLabelPDFExport) CPPUNIT_ASSERT_EQUAL(static_cast(6), nLblTJ + nLblTj); auto nL(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject0 : aDocument.GetObjects()) { - auto pObject0 = dynamic_cast(rDocElement.get()); - if (!pObject0) - continue; auto pType0 = dynamic_cast(pObject0->Lookup("Type"_ostr)); if (!pType0 || pType0->GetValue() != "StructElem") { diff --git a/sw/qa/extras/layout/data/table-style-contextual-spacing-rows-before.docx b/sw/qa/extras/layout/data/table-style-contextual-spacing-rows-before.docx new file mode 100644 index 000000000000..8e2bcc46aaec Binary files /dev/null and b/sw/qa/extras/layout/data/table-style-contextual-spacing-rows-before.docx differ diff --git a/sw/qa/extras/layout/data/table-style-contextual-spacing-rows.docx b/sw/qa/extras/layout/data/table-style-contextual-spacing-rows.docx new file mode 100644 index 000000000000..bb8ab0380b04 Binary files /dev/null and b/sw/qa/extras/layout/data/table-style-contextual-spacing-rows.docx differ diff --git a/sw/qa/extras/layout/data/tdf119908_smart_hyphenation_de.odt b/sw/qa/extras/layout/data/tdf119908_smart_hyphenation_de.odt new file mode 100644 index 000000000000..d1cc1754b634 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf119908_smart_hyphenation_de.odt differ diff --git a/sw/qa/extras/layout/data/tdf173389_smart_hyphenation_de.odt b/sw/qa/extras/layout/data/tdf173389_smart_hyphenation_de.odt new file mode 100644 index 000000000000..1450465fb500 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf173389_smart_hyphenation_de.odt differ diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 51e0d1e54499..74d8e173ca8f 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -868,44 +868,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_hu) if (!xSpell.is() || !xSpell->hasLanguage(static_cast(eLang))) return; - std::vector> aCompound = { - { u"jogorvoslatért"_ustr, "hy:3" }, { u"valamint"_ustr, "hy:4" }, - { u"alapfokon"_ustr, "pa:fokon" }, { u"jótéteményekben"_ustr, "hy:2" }, - { u"elismerésének"_ustr, "hy:2" }, - }; - - // tests supported by the actual spelling dictionary - bool aTests[5]; - - // check Hunspell-based morphological analysis & hyphenation - bool bHunspell = xSpell->isValid("", static_cast(eLang), - uno::Sequence()); - if (bHunspell) - { - // check dictionary support of compound splitting - for (size_t i = 0; i < aCompound.size(); ++i) - { - aTests[i] = false; - // get morphological analysis of the test word - uno::Reference xTmpRes = xSpell->spell( - "" + aCompound[i].first + "", - static_cast(eLang), uno::Sequence()); - if (xTmpRes.is()) - { - uno::Sequence seq = xTmpRes->getAlternatives(); - if (seq.hasElements()) - { - sal_Int32 nEndOfFirstAnalysis = seq[0].indexOf(""); - // use only the first analysis, like the lingucomponent implementation - OUString morph(seq[0].copy(0, nEndOfFirstAnalysis)); - - // check compound data - aTests[i] = morph.indexOf(aCompound[i].second) > -1; - } - } - } - } - createSwDoc("tdf119908_smart_hyphenation_hu.odt"); // Ensure that all text portions are calculated before testing. SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); @@ -915,7 +877,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_hu) xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - // 53 hyphenations on 5 pages using compound-based smart hyphenation + // 53 hyphenations on 5 pages using non-compound-based smart hyphenation // This was 67 without smart hyphenation and 53 without compound-based smart hyphenation // (using only the plain or interoperable smart hyphenation). @@ -1057,12 +1019,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_hu) // no compound-based "smart" hyphenation of the compound "jog|orvoslat" // This is hyphenated as "jogor-voslat", not "jog-orvoslat" - if (bHunspell && aTests[0]) - { - assertXPath(pXmlDoc, "/root/page[1]/body/txt[10]/SwParaPortion/SwLineLayout[2]", "portion", - u"alapvető jogokat sértő eljárások ellen az illetékes hazai bíróságokhoz " - u"tényleges jogor"); - } + assertXPath(pXmlDoc, "/root/page[1]/body/txt[10]/SwParaPortion/SwLineLayout[2]", "portion", + u"alapvető jogokat sértő eljárások ellen az illetékes hazai bíróságokhoz " + u"tényleges jogor"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[10]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", 1); @@ -1117,12 +1076,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_hu) // no compound-based "smart" hyphenation of the compound "vala|mint" // This is hyphenated as "va-lamint" without enabled compound-based "smart" hyphenation - if (bHunspell && aTests[1]) - { - assertXPath(pXmlDoc, "/root/page[1]/body/txt[22]/SwParaPortion/SwLineLayout[1]", "portion", - u"Minden személynek joga van minden országot, ideértve saját hazáját is, " - u"elhagyni, va"); - } + assertXPath(pXmlDoc, "/root/page[1]/body/txt[22]/SwParaPortion/SwLineLayout[1]", "portion", + u"Minden személynek joga van minden országot, ideértve saját hazáját is, " + u"elhagyni, va"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[22]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", 1); @@ -1261,12 +1217,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_hu) // no compound-based "smart" hyphenation of the compound "alap|fokon" // This is hyphenated as "alapfo-kon", not "alap-fokon" - if (bHunspell && aTests[2]) - { - assertXPath( - pXmlDoc, "/root/page[1]/body/txt[13]/SwParaPortion/SwLineLayout[1]", "portion", - u"Minden személynek joga van az oktatáshoz. Az oktatásnak legalábbis elemi és alapfo"); - } + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[13]/SwParaPortion/SwLineLayout[1]", "portion", + u"Minden személynek joga van az oktatáshoz. Az oktatásnak legalábbis elemi és alapfo"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[13]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", 1); @@ -1291,14 +1244,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_hu) // no compound-based "smart" hyphenation of the compound "jó|téteményekben" // This is not hyphenated, when compound-based smart hyphenation is disabled - if (bHunspell && aTests[3]) - { - assertXPath( - pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[2]", "portion", - u"a művészetek élvezéséhez, valamint a tudomány haladásában és az abból származó "); - assertXPath(pXmlDoc, - "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", 0); - } + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[2]", "portion", + u"a művészetek élvezéséhez, valamint a tudomány haladásában és az abból származó "); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 0); assertXPath( pXmlDoc, "/root/page[1]/body/txt[18]/SwParaPortion/SwLineLayout[1]", "portion", @@ -1339,14 +1288,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_hu) // no compound-based "smart" hyphenation of the compound "el|ismerésének" // This is not hyphenated by the plain, i.e. not compound-based "smart" hyphenation. - if (bHunspell && aTests[4]) - { - assertXPath(pXmlDoc, "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[2]", "portion", - u"zásoknak lehet alávetve, amelyeket a törvény kizárólag mások jogai és " - u"szabadságai "); - assertXPath(pXmlDoc, - "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", 0); - } + assertXPath(pXmlDoc, "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[2]", "portion", + u"zásoknak lehet alávetve, amelyeket a törvény kizárólag mások jogai és " + u"szabadságai "); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 0); + + // follow-up to the non-compound-based "smart" hyphenation in the previous line + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[3]", "portion", + u"elismerésének és tiszteletben tartásának biztosítása, valamint a demokratikus társada"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[3]/SwHyphPortion", + 1); + + // follow-up to the non-compound-based "smart" hyphenation in the first line of the paragraph + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[4]", "portion", + u"lom erkölcse, közrendje és általános jóléte jogos követelményeinek kielégítése érdeké"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[4]/SwHyphPortion", + 1); assertXPath( pXmlDoc, "/root/page[1]/body/txt[5]/SwParaPortion/SwLineLayout[1]", "portion", @@ -1361,8 +1323,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_hu) pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[1]", "portion", u"A jelen Nyilatkozat egyetlen rendelkezése sem értelmezhető úgy, hogy az valamely "); - if (bHunspell && aTests[4]) - assertXPath(pXmlDoc, "/root/page[1]/body/txt/SwParaPortion/SwLineLayout/SwHyphPortion", 5); + assertXPath(pXmlDoc, "/root/page[1]/body/txt/SwParaPortion/SwLineLayout/SwHyphPortion", 6); } // check smart hyphenation and compound-based smart hyphenation @@ -1828,7 +1789,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf173389_smart_hyphenation_hu) pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 2766, /*bBasicCall=*/false); pWrtShell->Delete(); - // 5 hyphenations on page 5 + // 6 hyphenations on page 5 pViewShell->Reformat(); pXmlDoc = parseLayoutDump(); @@ -1893,43 +1854,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_nl) if (!xSpell.is() || !xSpell->hasLanguage(static_cast(eLang))) return; - std::vector> aCompound = { - { u"arbeidsvoorwaarden"_ustr, "pa:arbeids" }, - { u"doeleinden"_ustr, "pa:doel" }, - }; - - // tests supported by the actual spelling dictionary - bool aTests[2]; - - // check Hunspell-based morphological analysis & hyphenation - bool bHunspell = xSpell->isValid("", static_cast(eLang), - uno::Sequence()); - if (bHunspell) - { - // check dictionary support of compound splitting - for (size_t i = 0; i < aCompound.size(); ++i) - { - aTests[i] = false; - // get morphological analysis of the test word - uno::Reference xTmpRes = xSpell->spell( - "" + aCompound[i].first + "", - static_cast(eLang), uno::Sequence()); - if (xTmpRes.is()) - { - uno::Sequence seq = xTmpRes->getAlternatives(); - if (seq.hasElements()) - { - sal_Int32 nEndOfFirstAnalysis = seq[0].indexOf(""); - // use only the first analysis, like the lingucomponent implementation - OUString morph(seq[0].copy(0, nEndOfFirstAnalysis)); - - // check compound data - aTests[i] = morph.indexOf(aCompound[i].second) > -1; - } - } - } - } - createSwDoc("tdf119908_smart_hyphenation_nl.odt"); // Ensure that all text portions are calculated before testing. SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); @@ -1949,14 +1873,11 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_nl) pXmlDoc = parseLayoutDump(); // no compound-based "smart" hyphenation of the compound "arbeids|voorwaarden" - // This is hyphenated as "ar-beidsvoorwaarden" previously, not "arbeids-voorwaarden" + // This is hyphenated as "ar-beidsvoorwaarden", not "arbeids-voorwaarden" - if (bHunspell && aTests[0]) - { - assertXPath(pXmlDoc, "/root/page[1]/body/txt[25]/SwParaPortion/SwLineLayout[1]", "portion", - u"Een ieder heeft recht op arbeid, op vrije keuze van beroep, op rechtmatige " - u"en gunstige ar"); - } + assertXPath(pXmlDoc, "/root/page[1]/body/txt[25]/SwParaPortion/SwLineLayout[1]", "portion", + u"Een ieder heeft recht op arbeid, op vrije keuze van beroep, op rechtmatige " + u"en gunstige ar"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[25]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", 1); @@ -1969,15 +1890,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_nl) pViewShell->Reformat(); pXmlDoc = parseLayoutDump(); - // compound-based "smart" hyphenation of the compound "doel|einden" - // This is hyphenated as "doelein-den" previously, not "doel-einden" + // no compound-based "smart" hyphenation of the compound "doel|einden" + // This is hyphenated as "doelein-den", not "doel-einden" - if (bHunspell && aTests[1]) - { - assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "portion", - u"Deze rechten en vrijheden mogen in geen geval worden uitgeoefend in strijd " - u"met de doelein"); - } + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "portion", + u"Deze rechten en vrijheden mogen in geen geval worden uitgeoefend in strijd " + u"met de doelein"); assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", 1); } @@ -2085,6 +2003,862 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf173389_smart_hyphenation_nl) 1); } +// check smart hyphenation and disabled compound-based smart hyphenation +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908_smart_hyphenation_de) +{ + uno::Reference xHyphenator = LinguMgr::GetHyphenator(); + if (!xHyphenator->hasLocale(lang::Locale(u"de"_ustr, u"DE"_ustr, OUString()))) + return; + + // compound-based hyphenation needs Hunspell morphological analysis + uno::Reference xSpell = LinguMgr::GetSpellChecker(); + LanguageType eLang + = LanguageTag::convertToLanguageType(lang::Locale(u"de"_ustr, u"DE"_ustr, OUString())); + if (!xSpell.is() || !xSpell->hasLanguage(static_cast(eLang))) + return; + + createSwDoc("tdf119908_smart_hyphenation_de.odt"); + // Ensure that all text portions are calculated before testing. + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + + CPPUNIT_ASSERT(pViewShell); + pViewShell->Reformat(); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + + // 30 hyphenations on 5 pages using non-compound-based smart hyphenation + // This was 35 without smart hyphenation + + // 9 hyphenations on page 1 + + // "smart" hyphenation: disabled hyphenation of "geführt" by shrinking + // This was "ge-führt" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[1]", "portion", + u"da die Nichtanerkennung und Verachtung der Menschenrechte zu Akten der Barbarei " + u"geführt "); + + // "smart" hyphenation: disabled hyphenation of "damit" by shrinking + // This was "da-mit" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[5]/SwParaPortion/SwLineLayout[1]", "portion", + u"da es notwendig ist, die Menschenrechte durch die Herrschaft des Rechtes zu " + u"schützen, damit "); + + // no compound-based "smart" hyphenation of the compound "Unter|drückung" + // This is hyphenated as "Un-terdrückung", not "Unter-drückung" + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[5]/SwParaPortion/SwLineLayout[2]", "portion", + u"der Mensch nicht gezwungen wird, als letztes Mittel zum Aufstand gegen Tyrannei und Un"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[5]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" hyphenation: disabled hyphenation of "Nationen" by shrinking + // This was "Natio-nen" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[1]", "portion", + u"da es notwendig ist, die Entwicklung freundschaftlicher Beziehungen zwischen den " + u"Nationen "); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[1]", "portion", + u"da die Völker der Vereinten Nationen in der Charta ihren Glauben an die " + u"grundlegenden Men"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // no compound-based "smart" hyphenation of the compound "Gleich|berechtigung" + // This is hyphenated as "Gleichberech-tigung", not "Gleichberechti-gung" + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[2]", "portion", + u"schenrechte, an die Würde und den Wert der menschlichen Person und an die Gleichberech"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" hyphenation: disabled hyphenation of "Nationen" by shrinking + // This was "Natio-nen" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[1]", "portion", + u"da die Mitgliedstaaten sich verpflichtet haben, in Zusammenarbeit mit den " + u"Vereinten Nationen "); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[2]", "portion", + u"auf die allgemeine Achtung und Einhaltung der Menschenrechte und Grundfreiheiten hinzu"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "für", not "für die" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[9]/SwParaPortion/SwLineLayout[1]", "portion", + u"da ein gemeinsames Verständnis dieser Rechte und Freiheiten von größter " + u"Wichtigkeit für die "); + + // "smart" hyphenation: disabled hyphenation of "nationale" by shrinking + // This was "natio-nale" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[11]/SwParaPortion/SwLineLayout[4]", "portion", + u"die Achtung vor diesen Rechten und Freiheiten zu fördern und durch " + u"fortschreitende nationale "); + + // follow-up to the "smart" hyphenation in the previous line + // This was "Ein-haltung", now "Einhal-tung" + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[11]/SwParaPortion/SwLineLayout[5]", "portion", + u"und internationale Maßnahmen ihre allgemeine und tatsächliche Anerkennung und Einhal"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[11]/SwParaPortion/SwLineLayout[5]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat Anspruch auf die in dieser Erklärung verkündeten Rechte und Freiheiten " + u"ohne ir"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[2]", "portion", + u"gendeinen Unterschied, etwa nach Rasse, Hautfarbe, Geschlecht, Sprache, " + u"Religion, politi"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "Geburt", not "Geburt oder" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[3]", "portion", + u"scher oder sonstiger Überzeugung, nationaler oder sozialer Herkunft, Vermögen, " + u"Geburt oder "); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[2]", "portion", + u"oder internationalen Stellung des Landes oder Gebiets, dem eine Person angehört, gleich"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "besitzt", not "besitzt oder" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[3]", "portion", + u"gültig ob dieses unabhängig ist, unter Treuhandschaft steht, keine " + u"Selbstregierung besitzt oder "); + + // no compound-based "smart" hyphenation of the compound "Sklaven|handel" + // This is hyphenated as "Sklavenhan-del", not "Sklaven-handel", + // 1) like without "smart" hyphenation and 2) with compound-based hyphenation + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[20]/SwParaPortion/SwLineLayout[1]", "portion", + u"Niemand darf in Sklaverei oder Leibeigenschaft gehalten werden; Sklaverei und " + u"Sklavenhan"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[20]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt/SwParaPortion/SwLineLayout/SwHyphPortion", 9); + + // delete page 1 to update hyphenation on the next page + + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 3170, /*bBasicCall=*/false); + pWrtShell->Delete(); + + // 7 hyphenations on page 2 + + pViewShell->Reformat(); + pXmlDoc = parseLayoutDump(); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[1]", "portion", + u"Alle Menschen sind vor dem Gesetz gleich und haben ohne Unterschied Anspruch auf glei"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[2]", "portion", + u"chen Schutz durch das Gesetz. Alle haben Anspruch auf gleichen Schutz gegen jede Diskri"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" hyphenation: disabled hyphenation of "derartigen" by shrinking + // This was "derarti-gen" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[3]", "portion", + u"minierung, die gegen diese Erklärung verstößt, und gegen jede Aufhetzung zu " + u"einer derartigen "); + + // "smart" hyphenation: disabled hyphenation of "Gesetz" by shrinking + // This was "Ge-setz" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[2]", "portion", + u"Gerichten gegen Handlungen, durch die seine ihm nach der Verfassung oder nach " + u"dem Gesetz "); + + // "smart" hyphenation: disabled hyphenation of "erhobenen" by shrinking + // This was "erhobe-nen" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[12]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat bei der Feststellung seiner Rechte und Pflichten sowie bei einer gegen " + u"ihn erhobenen "); + + // follow-up to the "smart" hyphenation in the previous line + // This was "öf-fentliches", now "öffentli-ches" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[12]/SwParaPortion/SwLineLayout[2]", "portion", + u"strafrechtlichen Beschuldigung in voller Gleichheit Anspruch auf ein gerechtes " + u"und öffentli"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[12]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "für", not "für seine" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[14]/SwParaPortion/SwLineLayout[2]", "portion", + u"zu gelten, solange seine Schuld nicht in einem öffentlichen Verfahren, in dem er " + u"alle für seine "); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[3]", "portion", + u"keine schwerere Strafe als die zum Zeitpunkt der Begehung der strafbaren Handlung ange"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[3]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "Wohnung", not "Wohnung und" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[1]", "portion", + u"Niemand darf willkürlichen Eingriffen in sein Privatleben, seine Familie, seine " + u"Wohnung und "); + + // follow-up to the "smart" justification in the previous line + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[2]", "portion", + u"seinen Schriftverkehr oder Beeinträchtigungen seiner Ehre und seines Rufes " + u"ausgesetzt wer"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // follow-up to the "smart" justification in the previous line + // This was "Beeinträch-tigungen", not "Beeinträchtigun-gen". + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[3]", "portion", + u"den. Jeder hat Anspruch auf rechtlichen Schutz gegen solche Eingriffe oder " + u"Beeinträchtigun"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[3]/SwHyphPortion", + 1); + + // "smart" hyphenation: enabled hyphenation by shrinking ("wer-den") + // This wasn't hyphenated before, resulting in exceeding maximum word spacing + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[26]/SwParaPortion/SwLineLayout[1]", "portion", + u"Niemandem darf seine Staatsangehörigkeit willkürlich entzogen noch das Recht " + u"versagt wer"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[26]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt/SwParaPortion/SwLineLayout/SwHyphPortion", 7); + + // delete page 2 to update hyphenation on the next page + + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 2734, /*bBasicCall=*/false); + pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 2734, /*bBasicCall=*/false); + pWrtShell->Delete(); + + // 7 hyphenations on page 3 + + pViewShell->Reformat(); + pXmlDoc = parseLayoutDump(); + + // "smart" hyphenation: enabled hyphenation by shrinking ("Staats-angehörigkeit") + // compound-based "smart" hyphenation keeps it (analysis: "Staats|angehörigkeit") + // This wasn't hyphenated before + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "portion", + u"Heiratsfähige Frauen und Männer haben ohne Beschränkung auf Grund der Rasse, der Staats"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // smart hyphenation: better spacing by shrinking + // This was "innezu-haben" (now "innezuha-ben") + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[5]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht, sowohl allein als auch in Gemeinschaft mit anderen Eigentum " + u"innezuha"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[5]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[2]", "portion", + u"die Freiheit ein, seine Religion oder Überzeugung zu wechseln, sowie die " + u"Freiheit, seine Re"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "Recht", not "Recht schließt" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[10]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht auf Meinungsfreiheit und freie Meinungsäußerung; dieses " + u"Recht schließt "); + + // "smart" hyphenation: better word spacing by shrinking + // This was "zu-sammenzuschließen" (now "zusam-menzuschließen"). + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[12]/SwParaPortion/SwLineLayout[1]", "portion", + u"Alle Menschen haben das Recht, sich friedlich zu versammeln und zu Vereinigungen zusam"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[12]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht, an der Gestaltung der öffentlichen Angelegenheiten seines " + u"Landes un"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // "smart" hyphenation: disabled hyphenation of "darauf" by shrinking + // This was "dar-auf" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[19]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat als Mitglied der Gesellschaft das Recht auf soziale Sicherheit und " + u"Anspruch darauf, "); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[19]/SwParaPortion/SwLineLayout[2]", "portion", + u"durch innerstaatliche Maßnahmen und internationale Zusammenarbeit sowie unter Berück"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[19]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // smart hyphenation: better spacing by shrinking + // compound-based hyphenation keeps the same break point (analysis: "Arbeits|bedingungen") + // This was "Ar-beitsbedingungen" (now "Arbeits-bedingungen") + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[21]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht auf Arbeit, auf freie Berufswahl, auf gerechte und " + u"befriedigende Arbeits"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[21]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt/SwParaPortion/SwLineLayout/SwHyphPortion", 7); + + // delete page 3 to update hyphenation on the next page + + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 2945, /*bBasicCall=*/false); + pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 2945, /*bBasicCall=*/false); + pWrtShell->Delete(); + + // 7 hyphenations on page 4 + + pViewShell->Reformat(); + pXmlDoc = parseLayoutDump(); + + // smart hyphenation: better spacing by shrinking + // This was "Be-grenzung" (now "Begren-zung") + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht auf Erholung und Freizeit und insbesondere auf eine " + u"vernünftige Begren"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht auf Bildung. Die Bildung ist unentgeltlich, zum mindesten der Grund"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // "smart" hyphenation: enabled hyphenation by shrinking ("Hoch-schulunterricht") + // compound-based "smart" hyphenations keeps it (analysis: "Hoch|schul|unterricht") + // This wasn't hyphenated before + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[3]", "portion", + u"Fach- und Berufsschulunterricht müssen allgemein verfügbar gemacht werden, und der Hoch"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[3]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[1]", "portion", + u"Die Bildung muß auf die volle Entfaltung der menschlichen Persönlichkeit und auf " + u"die Stär"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // "smart" hyphenation: better spacing by shrinking + // This wasn't hyphenated before (now "teil-zuhaben") + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[10]/SwParaPortion/SwLineLayout[2]", "portion", + u"Künsten zu erfreuen und am wissenschaftlichen Fortschritt und dessen " + u"Errungenschaften teil"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[10]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" hyphenation: disabled hyphenation of "Erklärung" by shrinking + // This was "Erklä-rung" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[13]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat Anspruch auf eine soziale und internationale Ordnung, in der die in " + u"dieser Erklärung "); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder ist bei der Ausübung seiner Rechte und Freiheiten nur den Beschränkungen unterwor"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "Achtung", not "Achtung der" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[2]", "portion", + u"fen, die das Gesetz ausschließlich zu dem Zweck vorsieht, die Anerkennung und " + u"Achtung der "); + + // "smart" hyphenation: enabled hyphenation by shrinking ("Grund-sätzen") + // compound-based "smart" hyphenations keeps it (analysis: "Grund|sätzen") + // This wasn't hyphenated before + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[1]", "portion", + u"Diese Rechte und Freiheiten dürfen in keinem Fall im Widerspruch zu den Zielen " + u"und Grund"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "oder", not "oder eine" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[19]/SwParaPortion/SwLineLayout[2]", "portion", + u"eine Gruppe oder eine Person irgendein Recht begründet, eine Tätigkeit auszuüben " + u"oder eine "); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt/SwParaPortion/SwLineLayout/SwHyphPortion", 7); +} + +// check smart hyphenation and enabled compound-based smart hyphenation +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf173389_smart_hyphenation_de) +{ + uno::Reference xHyphenator = LinguMgr::GetHyphenator(); + if (!xHyphenator->hasLocale(lang::Locale(u"de"_ustr, u"DE"_ustr, OUString()))) + return; + + // compound-based hyphenation needs Hunspell morphological analysis + uno::Reference xSpell = LinguMgr::GetSpellChecker(); + LanguageType eLang + = LanguageTag::convertToLanguageType(lang::Locale(u"de"_ustr, u"DE"_ustr, OUString())); + if (!xSpell.is() || !xSpell->hasLanguage(static_cast(eLang))) + return; + + createSwDoc("tdf173389_smart_hyphenation_de.odt"); + // Ensure that all text portions are calculated before testing. + SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell(); + + CPPUNIT_ASSERT(pViewShell); + pViewShell->Reformat(); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + + // 30 hyphenations on 5 pages using non-compound-based smart hyphenation + // This was 35 without smart hyphenation + + // 9 hyphenations on page 1 + + // "smart" hyphenation: disabled hyphenation of "geführt" by shrinking + // This was "ge-führt" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[4]/SwParaPortion/SwLineLayout[1]", "portion", + u"da die Nichtanerkennung und Verachtung der Menschenrechte zu Akten der Barbarei " + u"geführt "); + + // "smart" hyphenation: disabled hyphenation of "damit" by shrinking + // This was "da-mit" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[5]/SwParaPortion/SwLineLayout[1]", "portion", + u"da es notwendig ist, die Menschenrechte durch die Herrschaft des Rechtes zu " + u"schützen, damit "); + + // compound-based "smart" hyphenation of the compound "Unter|drückung" + // This is hyphenated as "Unter-drückung", not "Un-terdrückung" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[5]/SwParaPortion/SwLineLayout[2]", "portion", + u"der Mensch nicht gezwungen wird, als letztes Mittel zum Aufstand gegen Tyrannei " + u"und Unter"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[5]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" hyphenation: disabled hyphenation of "Nationen" by shrinking + // This was "Natio-nen" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[1]", "portion", + u"da es notwendig ist, die Entwicklung freundschaftlicher Beziehungen zwischen den " + u"Nationen "); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[1]", "portion", + u"da die Völker der Vereinten Nationen in der Charta ihren Glauben an die " + u"grundlegenden Men"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // compound-based "smart" hyphenation of the compound "Gleich|berechtigung" + // This is hyphenated as "Gleichberechti-gung", not "Gleichberech-tigung" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[2]", "portion", + u"schenrechte, an die Würde und den Wert der menschlichen Person und an die " + u"Gleichberechti"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" hyphenation: disabled hyphenation of "Nationen" by shrinking + // This was "Natio-nen" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[1]", "portion", + u"da die Mitgliedstaaten sich verpflichtet haben, in Zusammenarbeit mit den " + u"Vereinten Nationen "); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[2]", "portion", + u"auf die allgemeine Achtung und Einhaltung der Menschenrechte und Grundfreiheiten hinzu"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "für", not "für die" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[9]/SwParaPortion/SwLineLayout[1]", "portion", + u"da ein gemeinsames Verständnis dieser Rechte und Freiheiten von größter " + u"Wichtigkeit für die "); + + // "smart" hyphenation: disabled hyphenation of "nationale" by shrinking + // This was "natio-nale" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[11]/SwParaPortion/SwLineLayout[4]", "portion", + u"die Achtung vor diesen Rechten und Freiheiten zu fördern und durch " + u"fortschreitende nationale "); + + // follow-up to the "smart" hyphenation in the previous line + // This was "Ein-haltung", now "Einhal-tung" + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[11]/SwParaPortion/SwLineLayout[5]", "portion", + u"und internationale Maßnahmen ihre allgemeine und tatsächliche Anerkennung und Einhal"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[11]/SwParaPortion/SwLineLayout[5]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat Anspruch auf die in dieser Erklärung verkündeten Rechte und Freiheiten " + u"ohne ir"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[2]", "portion", + u"gendeinen Unterschied, etwa nach Rasse, Hautfarbe, Geschlecht, Sprache, " + u"Religion, politi"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "Geburt", not "Geburt oder" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[3]", "portion", + u"scher oder sonstiger Überzeugung, nationaler oder sozialer Herkunft, Vermögen, " + u"Geburt oder "); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[2]", "portion", + u"oder internationalen Stellung des Landes oder Gebiets, dem eine Person angehört, gleich"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "besitzt", not "besitzt oder" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[3]", "portion", + u"gültig ob dieses unabhängig ist, unter Treuhandschaft steht, keine " + u"Selbstregierung besitzt oder "); + + // compound-based "smart" hyphenation of the compound "Sklaven|handel" + // This is hyphenated as "Sklaven-handel" (not "Sklavenhan-del" like with + // non-compound-based hyphenation) + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[20]/SwParaPortion/SwLineLayout[1]", "portion", + u"Niemand darf in Sklaverei oder Leibeigenschaft gehalten werden; Sklaverei und " + u"Sklaven"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[20]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt/SwParaPortion/SwLineLayout/SwHyphPortion", 9); + + // delete page 1 to update hyphenation on the next page + + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 3170, /*bBasicCall=*/false); + pWrtShell->Delete(); + + // 7 hyphenations on page 2 + + pViewShell->Reformat(); + pXmlDoc = parseLayoutDump(); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[1]", "portion", + u"Alle Menschen sind vor dem Gesetz gleich und haben ohne Unterschied Anspruch auf glei"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[2]", "portion", + u"chen Schutz durch das Gesetz. Alle haben Anspruch auf gleichen Schutz gegen jede Diskri"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" hyphenation: disabled hyphenation of "derartigen" by shrinking + // This was "derarti-gen" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[3]", "portion", + u"minierung, die gegen diese Erklärung verstößt, und gegen jede Aufhetzung zu " + u"einer derartigen "); + + // "smart" hyphenation: disabled hyphenation of "Gesetz" by shrinking + // This was "Ge-setz" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[2]", "portion", + u"Gerichten gegen Handlungen, durch die seine ihm nach der Verfassung oder nach " + u"dem Gesetz "); + + // "smart" hyphenation: disabled hyphenation of "erhobenen" by shrinking + // This was "erhobe-nen" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[12]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat bei der Feststellung seiner Rechte und Pflichten sowie bei einer gegen " + u"ihn erhobenen "); + + // follow-up to the "smart" hyphenation in the previous line + // This was "öf-fentliches", now "öffentli-ches" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[12]/SwParaPortion/SwLineLayout[2]", "portion", + u"strafrechtlichen Beschuldigung in voller Gleichheit Anspruch auf ein gerechtes " + u"und öffentli"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[12]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "für", not "für seine" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[14]/SwParaPortion/SwLineLayout[2]", "portion", + u"zu gelten, solange seine Schuld nicht in einem öffentlichen Verfahren, in dem er " + u"alle für seine "); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[3]", "portion", + u"keine schwerere Strafe als die zum Zeitpunkt der Begehung der strafbaren Handlung ange"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[3]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "Wohnung", not "Wohnung und" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[1]", "portion", + u"Niemand darf willkürlichen Eingriffen in sein Privatleben, seine Familie, seine " + u"Wohnung und "); + + // follow-up to the "smart" justification in the previous line + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[2]", "portion", + u"seinen Schriftverkehr oder Beeinträchtigungen seiner Ehre und seines Rufes " + u"ausgesetzt wer"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // follow-up to the "smart" justification in the previous line + // This was "Beeinträch-tigungen", not "Beeinträchtigun-gen". + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[3]", "portion", + u"den. Jeder hat Anspruch auf rechtlichen Schutz gegen solche Eingriffe oder " + u"Beeinträchtigun"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[3]/SwHyphPortion", + 1); + + // "smart" hyphenation: enabled hyphenation by shrinking ("wer-den") + // This wasn't hyphenated before, resulting in exceeding maximum word spacing + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[26]/SwParaPortion/SwLineLayout[1]", "portion", + u"Niemandem darf seine Staatsangehörigkeit willkürlich entzogen noch das Recht " + u"versagt wer"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[26]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt/SwParaPortion/SwLineLayout/SwHyphPortion", 7); + + // delete page 2 to update hyphenation on the next page + + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 2734, /*bBasicCall=*/false); + pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 2734, /*bBasicCall=*/false); + pWrtShell->Delete(); + + // 7 hyphenations on page 3 + + pViewShell->Reformat(); + pXmlDoc = parseLayoutDump(); + + // "smart" hyphenation: enabled hyphenation by shrinking ("Staats-angehörigkeit") + // compound-based "smart" hyphenation keeps it (analysis: "Staats|angehörigkeit") + // This wasn't hyphenated before + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "portion", + u"Heiratsfähige Frauen und Männer haben ohne Beschränkung auf Grund der Rasse, der Staats"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // smart hyphenation: better spacing by shrinking + // This was "innezu-haben" (now "innezuha-ben") + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[5]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht, sowohl allein als auch in Gemeinschaft mit anderen Eigentum " + u"innezuha"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[5]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[2]", "portion", + u"die Freiheit ein, seine Religion oder Überzeugung zu wechseln, sowie die " + u"Freiheit, seine Re"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[8]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "Recht", not "Recht schließt" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[10]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht auf Meinungsfreiheit und freie Meinungsäußerung; dieses " + u"Recht schließt "); + + // "smart" hyphenation: better word spacing by shrinking + // This was "zu-sammenzuschließen" (now "zusam-menzuschließen"). + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[12]/SwParaPortion/SwLineLayout[1]", "portion", + u"Alle Menschen haben das Recht, sich friedlich zu versammeln und zu Vereinigungen zusam"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[12]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht, an der Gestaltung der öffentlichen Angelegenheiten seines " + u"Landes un"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[15]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // "smart" hyphenation: disabled hyphenation of "darauf" by shrinking + // This was "dar-auf" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[19]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat als Mitglied der Gesellschaft das Recht auf soziale Sicherheit und " + u"Anspruch darauf, "); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[19]/SwParaPortion/SwLineLayout[2]", "portion", + u"durch innerstaatliche Maßnahmen und internationale Zusammenarbeit sowie unter Berück"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[19]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // smart hyphenation: better spacing by shrinking + // compound-based hyphenation keeps the same break point (analysis: "Arbeits|bedingungen") + // This was "Ar-beitsbedingungen" (now "Arbeits-bedingungen") + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[21]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht auf Arbeit, auf freie Berufswahl, auf gerechte und " + u"befriedigende Arbeits"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[21]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt/SwParaPortion/SwLineLayout/SwHyphPortion", 7); + + // delete page 3 to update hyphenation on the next page + + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 2945, /*bBasicCall=*/false); + pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 2945, /*bBasicCall=*/false); + pWrtShell->Delete(); + + // 7 hyphenations on page 4 + + pViewShell->Reformat(); + pXmlDoc = parseLayoutDump(); + + // smart hyphenation: better spacing by shrinking + // This was "Be-grenzung" (now "Begren-zung") + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht auf Erholung und Freizeit und insbesondere auf eine " + u"vernünftige Begren"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat das Recht auf Bildung. Die Bildung ist unentgeltlich, zum mindesten der Grund"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // "smart" hyphenation: enabled hyphenation by shrinking ("Hoch-schulunterricht") + // compound-based "smart" hyphenations keeps it (analysis: "Hoch|schul|unterricht") + // This wasn't hyphenated before + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[3]", "portion", + u"Fach- und Berufsschulunterricht müssen allgemein verfügbar gemacht werden, und der Hoch"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[6]/SwParaPortion/SwLineLayout[3]/SwHyphPortion", + 1); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[1]", "portion", + u"Die Bildung muß auf die volle Entfaltung der menschlichen Persönlichkeit und auf " + u"die Stär"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[7]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // "smart" hyphenation: better spacing by shrinking + // This wasn't hyphenated before (now "teil-zuhaben") + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[10]/SwParaPortion/SwLineLayout[2]", "portion", + u"Künsten zu erfreuen und am wissenschaftlichen Fortschritt und dessen " + u"Errungenschaften teil"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[10]/SwParaPortion/SwLineLayout[2]/SwHyphPortion", + 1); + + // "smart" hyphenation: disabled hyphenation of "Erklärung" by shrinking + // This was "Erklä-rung" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[13]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder hat Anspruch auf eine soziale und internationale Ordnung, in der die in " + u"dieser Erklärung "); + + assertXPath( + pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[1]", "portion", + u"Jeder ist bei der Ausübung seiner Rechte und Freiheiten nur den Beschränkungen unterwor"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "Achtung", not "Achtung der" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[16]/SwParaPortion/SwLineLayout[2]", "portion", + u"fen, die das Gesetz ausschließlich zu dem Zweck vorsieht, die Anerkennung und " + u"Achtung der "); + + // "smart" hyphenation: enabled hyphenation by shrinking ("Grund-sätzen") + // compound-based "smart" hyphenations keeps it (analysis: "Grund|sätzen") + // This wasn't hyphenated before + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[1]", "portion", + u"Diese Rechte und Freiheiten dürfen in keinem Fall im Widerspruch zu den Zielen " + u"und Grund"); + assertXPath(pXmlDoc, "/root/page[1]/body/txt[17]/SwParaPortion/SwLineLayout[1]/SwHyphPortion", + 1); + + // "smart" justification: better word spacing by shrinking + // This ended with "oder", not "oder eine" + + assertXPath(pXmlDoc, "/root/page[1]/body/txt[19]/SwParaPortion/SwLineLayout[2]", "portion", + u"eine Gruppe oder eine Person irgendein Recht begründet, eine Tätigkeit auszuüben " + u"oder eine "); + + assertXPath(pXmlDoc, "/root/page[1]/body/txt/SwParaPortion/SwLineLayout/SwHyphPortion", 7); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158333) { createSwDoc("tdf130088.docx"); diff --git a/sw/qa/extras/layout/layout6.cxx b/sw/qa/extras/layout/layout6.cxx index 2332906853e6..7ccfd8fe9c3f 100644 --- a/sw/qa/extras/layout/layout6.cxx +++ b/sw/qa/extras/layout/layout6.cxx @@ -2747,6 +2747,38 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testTdf173348SpaceOnlyLine) assertXPath(pXmlDoc, "//column[2]//SwLineLayout", "portion", u"CG 11 11 11 11"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testTableStyleContextualSpacingRows) +{ + // Given a table whose style turns on contextual spacing, with one paragraph per cell and the + // same paragraph style in every cell, while that style sets 18pt of space below a paragraph: + createSwDoc("table-style-contextual-spacing-rows.docx"); + + // Then make sure a row is no taller than its single line of text: + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + const sal_Int32 nParaSpacing = 360; + const sal_Int32 nRowHeight + = getXPath(pXmlDoc, "/root/page/body/tab/row[1]/infos/bounds", "height").toInt32(); + // Without the fix in place, this test would have failed, because the paragraph that ends a + // cell kept its space below, so every row was at least the 18pt of that spacing taller. + CPPUNIT_ASSERT_LESS(nParaSpacing, nRowHeight); +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter6, testTableStyleContextualSpacingRowsBefore) +{ + // Given the same table, with the paragraph style setting 18pt of space above a paragraph + // instead of below it: + createSwDoc("table-style-contextual-spacing-rows-before.docx"); + + // Then make sure a row is no taller than its single line of text: + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + const sal_Int32 nParaSpacing = 360; + const sal_Int32 nRowHeight + = getXPath(pXmlDoc, "/root/page/body/tab/row[2]/infos/bounds", "height").toInt32(); + // Without the fix in place, this test would have failed, because the paragraph that starts a + // cell kept its space above, so every row was at least the 18pt of that spacing taller. + CPPUNIT_ASSERT_LESS(nParaSpacing, nRowHeight); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 5d46782fcfe7..0dc66a687b5f 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/qa/extras/ooxmlexport/data/math-bold-italic-export.fodt b/sw/qa/extras/ooxmlexport/data/math-bold-italic-export.fodt new file mode 100644 index 000000000000..407e8eb2e3e7 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/math-bold-italic-export.fodt @@ -0,0 +1,515 @@ + + + + 2026-09-24T13:47:32.5759128002026-09-24T13:51:10.070572400PT3M38S1Collabora_Office/26.04.0.20260912$Windows_X86_64 LibreOffice_project/1fa6e37bdca82adca9e05363c9a53ecbd6deb354 + + + 2 + 0 + 17591 + 12628 + true + false + + + view2 + 4198 + 2501 + 0 + 2 + 17590 + 12628 + 0 + 1 + false + 250 + false + false + 1272,31,1728,1360;1;,,,; + false + false + false + false + false + + + + + false + + + + 1 + true + false + true + false + true + true + + + true + false + false + 0 + true + false + true + false + false + 0 + false + true + false + false + false + high-resolution + false + false + true + false + false + false + false + false + true + false + true + true + false + + false + false + false + true + false + true + false + 1535549 + 1535549 + false + false + false + false + false + true + false + true + true + false + false + false + false + false + true + true + true + true + false + false + false + false + false + false + true + false + false + false + false + false + false + false + false + false + true + 0 + true + false + false + true + false + false + false + false + false + false + false + false + false + true + false + false + 0 + true + true + true + true + false + true + false + false + true + false + false + true + + false + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Test cases + + + + + + + a + b + + + bold {a over b} + + + + VkNMTVRGAQAxAAAAAAAAAAEAGwAAAAkAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAboAAAA5 + AgAAHwAAAJYAAQACAAAACQCLAAEAAgAAAP//gQABABAAAAAAAAAAAAAAALkAAAA4AgAAiwAB + AAIAAAAAGJUAAQAEAAAAAAAAAJYAAQACAAAACQCLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQ + AExpYmVyYXRpb24gU2VyaWYAAAAAAADwAAAAAAAAAAAACAAAAAAAAgD/AwAAAAAAAAABAP8D + AAAAAAAAAAAAAACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAXAAAA + IgAAANcAAAABAGF4AAAAAAABAAEAYQCMAAEAAAAAAIsAAQACAAAAHwCFAAEABQAAAAAAAAAB + hAABAAUAAAAAAAAAAIoAAQBCAAAABQA8AAAACgBPcGVuU3ltYm9sAAAAAAAA8AAAAP//AAAA + AAUAAAAAAAAA/wMAAAAAAAAAAQD/AwAAAAAAAAAAAAAAiAABAAIAAAABAIcAAQAFAAAA//// + /wCGAAEABAAAAAAAAABnAAEAEAAAAAwAAAAXAQAArQAAACIBAACMAAEAAAAAAIsAAQACAAAA + HwCKAAEASAAAAAUAQgAAABAATGliZXJhdGlvbiBTZXJpZgAAAAAAAPAAAAAAAAAAAAAIAAAA + AAACAP8DAAAAAAAAAAEA/wMAAAAAAAAAAAAAAIgAAQACAAAAAQCHAAEABQAAAP////8AhgAB + AAQAAAAAAAAAcgACABcAAAAiAAAABQIAAAEAYngAAAAAAAEAAQBiAIwAAQAAAAAAjAABAAAA + AACMAAEAAAAAAA== + + + + + + + + + + 2 + + + ital sqrt {2} + + + + VkNMTVRGAQAxAAAAAAAAAAEAGwAAAAkAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAASABAAAg + AQAAHwAAAJYAAQACAAAACQCLAAEAAgAAAP//gQABABAAAAAAAAAAAAAAAB8BAAAfAQAAiwAB + AAIAAAAAGJUAAQAEAAAAAAAAAJYAAQACAAAACQCLAAEAAgAAAB8AigABAEIAAAAFADwAAAAK + AE9wZW5TeW1ib2wAAKkAAAAlAQAA//8AAAAABQAAAAAAAAD/AwAAAAAAAAABAP8DAAAAAADv + AAAAAACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAaAAAABAAAAPkA + AAABAAAAGiKAAAAAAAABAAEAGiKMAAEAAAAAAIsAAQACAAAAHwCFAAEABQAAAAAAAAABhAAB + AAUAAAAAAAAAAIoAAQBCAAAABQA8AAAACgBPcGVuU3ltYm9sAACpAAAAJQEAAP//AAAAAAUA + AAAAAAAA/wMAAAAAAAAAAQD/AwAAAAAA7wAAAAAAiAABAAIAAAABAIcAAQAFAAAA/////wCG + AAEABAAAAAAAAABnAAEAEAAAAIQAAAANAAAAGwEAABQAAACMAAEAAAAAAIsAAQACAAAAHwCK + AAEASAAAAAUAQgAAABAATGliZXJhdGlvbiBTZXJpZgAAAAAAAPAAAAAAAAAAAAAFAAAAAAAC + AP8DAAAAAAAAAAEA/wMAAAAAAAAAAAAAAIgAAQACAAAAAQCHAAEABQAAAP////8AhgABAAQA + AAAAAAAAcgACABcAAACfAAAA7AAAAAEAMngAAAAAAAEAAQAyAIwAAQAAAAAAjAABAAAAAACM + AAEAAAAAAA== + + + + + + + + + + + ∑ + + i + = + 1 + + n + + i + + + bold sum from {i=1} to n i + + + + VkNMTVRGAQAxAAAAAAAAAAEAGwAAAAkAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAZkBAACL + AgAAMgAAAJYAAQACAAAACQCLAAEAAgAAAP//gQABABAAAAAAAAAAAAAAAJgBAACKAgAAiwAB + AAIAAAAAGJUAAQAEAAAAAAAAAJYAAQACAAAACQCLAAEAAgAAAB8AigABAEIAAAAFADwAAAAK + AE9wZW5TeW1ib2wAAAAAAABeAQAA//8AAAAACAAAAAAAAAD/AwAAAAAAAAABAP8DAAAAAAAA + AAAAAACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAaAAAAAAAAALYB + AAABAAAAESIVAQAAAAABAAEAESKMAAEAAAAAAIsAAQACAAAAHwCKAAEASAAAAAUAQgAAABAA + TGliZXJhdGlvbiBTZXJpZgAAAAAAAJAAAAAAAAAAAAAIAAAAAAACAP8DAAAAAAAAAAEA/wMA + AAAAAAAAAAAAAIgAAQACAAAAAQCHAAEABQAAAP////8AhgABAAQAAAAAAAAAcgACABcAAAAV + AAAAawIAAAEAaSgAAAAAAAEAAQBpAIwAAQAAAAAAiwABAAIAAAAfAIoAAQBCAAAABQA8AAAA + CgBPcGVuU3ltYm9sAAAAAAAAkAAAAP//AAAAAAgAAAAAAAAA/wMAAAAAAAAAAQD/AwAAAAAA + AAAAAAAAiAABAAIAAAABAIcAAQAFAAAA/////wCGAAEABAAAAAAAAAByAAIAGgAAAEgAAABr + AgAAAQAAAD0AcgAAAAAAAQABAD0AjAABAAAAAACLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQ + AExpYmVyYXRpb24gU2VyaWYAAAAAAACQAAAAAAAAAAAACAAAAAAAAAD/AwAAAAAAAAABAP8D + AAAAAAAAAAAAAACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAXAAAA + vgAAAGsCAAABADFIAAAAAAABAAEAMQCMAAEAAAAAAIsAAQACAAAAHwCKAAEASAAAAAUAQgAA + ABAATGliZXJhdGlvbiBTZXJpZgAAAAAAAJAAAAAAAAAAAAAIAAAAAAACAP8DAAAAAAAAAAEA + /wMAAAAAAAAAAAAAAIgAAQACAAAAAQCHAAEABQAAAP////8AhgABAAQAAAAAAAAAcgACABcA + AABlAAAAgQAAAAEAblAAAAAAAAEAAQBuAIwAAQAAAAAAiwABAAIAAAAfAIoAAQBIAAAABQBC + AAAAEABMaWJlcmF0aW9uIFNlcmlmAAAAAAAA8AAAAAAAAAAAAAgAAAAAAAIA/wMAAAAAAAAA + AQD/AwAAAAAAAAAAAAAAiAABAAIAAAABAIcAAQAFAAAA/////wCGAAEABAAAAAAAAAByAAIA + FwAAAEkBAACWAQAAAQBpQwAAAAAAAQABAGkAjAABAAAAAACMAAEAAAAAAIwAAQAAAAAA + + + + + + + + + + + a + b + + + + color red bold {a over b} + + + + VkNMTVRGAQAxAAAAAAAAAAEAGwAAAAkAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAboAAAA5 + AgAAIgAAAJYAAQACAAAACQCLAAEAAgAAAP//gQABABAAAAAAAAAAAAAAALkAAAA4AgAAiwAB + AAIAAAAAGJUAAQAEAAAAAAAAAJYAAQACAAAACQCLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQ + AExpYmVyYXRpb24gU2VyaWYAAAAAAADwAAAAAAAAAAAACAAAAAAAAgD/AwAAAAAAAAABAP8D + AAAAAAAAAAAAAACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAD/AIYAAQAEAAAA + AAD/AHIAAgAXAAAAIgAAANcAAAABAGF4AAAAAAABAAEAYQCMAAEAAAAAAIsAAQACAAAAHwCF + AAEABQAAAAAA/wABhAABAAUAAAAAAAAAAIoAAQBCAAAABQA8AAAACgBPcGVuU3ltYm9sAAAA + AAAA8AAAAP//AAAAAAUAAAAAAAAA/wMAAAAAAAAAAQD/AwAAAAAAAAAAAAAAiAABAAIAAAAB + AIcAAQAFAAAA/////wCGAAEABAAAAAAA/wCGAAEABAAAAAAA/wBnAAEAEAAAAAwAAAAXAQAA + rQAAACIBAACMAAEAAAAAAIsAAQACAAAAHwCKAAEASAAAAAUAQgAAABAATGliZXJhdGlvbiBT + ZXJpZgAAAAAAAPAAAAAAAAAAAAAIAAAAAAACAP8DAAAAAAAAAAEA/wMAAAAAAAAAAAAAAIgA + AQACAAAAAQCHAAEABQAAAP////8AhgABAAQAAAAAAP8AhgABAAQAAAAAAP8AcgACABcAAAAi + AAAABQIAAAEAYngAAAAAAAEAAQBiAIwAAQAAAAAAjAABAAAAAACMAAEAAAAAAA== + + + + + + + + + abc + + bold "abc" + + + + VkNMTVRGAQAxAAAAAAAAAAEAGwAAAAkAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAXUBAAAL + AQAADwAAAJYAAQACAAAACQCLAAEAAgAAAP//gQABABAAAAAAAAAAAAAAAHQBAAAKAQAAiwAB + AAIAAAAAGJUAAQAEAAAAAAAAAJYAAQACAAAACQCLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQ + AExpYmVyYXRpb24gU2VyaWYAAAAAAADwAAAAAAAAAAAACAAAAAAAAAD/AwAAAAAAAAABAP8D + AAAAAAAAAAAAAACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAdAAAA + BQAAANcAAAADAGFiY2gBAAAAAAMAAwBhAGIAYwCMAAEAAAAAAIwAAQAAAAAAjAABAAAAAAA= + + + + + + + + + abc + + ital "abc" + + + + VkNMTVRGAQAxAAAAAAAAAAEAGwAAAAkAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAWoBAAAL + AQAADwAAAJYAAQACAAAACQCLAAEAAgAAAP//gQABABAAAAAAAAAAAAAAAGkBAAAKAQAAiwAB + AAIAAAAAGJUAAQAEAAAAAAAAAJYAAQACAAAACQCLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQ + AExpYmVyYXRpb24gU2VyaWYAAAAAAADwAAAAAAAAAAAABQAAAAAAAgD/AwAAAAAAAAABAP8D + AAAAAAAAAAAAAACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAdAAAA + BQAAANcAAAADAGFiY1sBAAAAAAMAAwBhAGIAYwCMAAEAAAAAAIwAAQAAAAAAjAABAAAAAAA= + + + + + + + + + x + + nitalic x + + + + VkNMTVRGAQAxAAAAAAAAAAEAGwAAAAkAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAY0AAAAL + AQAADwAAAJYAAQACAAAACQCLAAEAAgAAAP//gQABABAAAAAAAAAAAAAAAIwAAAAKAQAAiwAB + AAIAAAAAGJUAAQAEAAAAAAAAAJYAAQACAAAACQCLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQ + AExpYmVyYXRpb24gU2VyaWYAAAAAAADwAAAAAAAAAAAABQAAAAAAAAD/AwAAAAAAAAABAP8D + AAAAAAAAAAAAAACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAXAAAA + CgAAANcAAAABAHh4AAAAAAABAAEAeACMAAEAAAAAAIwAAQAAAAAAjAABAAAAAAA= + + + + + + diff --git a/sw/qa/extras/ooxmlexport/data/math-bold-italic.docx b/sw/qa/extras/ooxmlexport/data/math-bold-italic.docx new file mode 100644 index 000000000000..adde77b7ded5 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/math-bold-italic.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/math-font-size.docx b/sw/qa/extras/ooxmlexport/data/math-font-size.docx new file mode 100644 index 000000000000..55fdda889f35 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/math-font-size.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx index 4607f172ecaf..d6d6e3137530 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx @@ -483,7 +483,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf169024_verticalTopFrame) // gets exported as 'bottom' in DOCX, and import maps 'bottom' to top of Line of Text again auto verify = [this]() { - // To Character anchored Line of Text need to be LINE_TOP in order for the GUI to pick it up + // To Character anchored Line of Text needs to be LINE_TOP in order for the GUI to pick it up CPPUNIT_ASSERT_EQUAL(text::RelOrientation::TEXT_LINE, getProperty(getShape(1), u"VertOrientRelation"_ustr)); CPPUNIT_ASSERT_EQUAL(text::VertOrientation::LINE_TOP, @@ -508,7 +508,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf169024) createSwDoc("tdf90153.docx"); //saveAndReload(TestFilter::DOCX); - // To Character anchored Line of Text need to be LINE_BOTTOM in order for the GUI to pick it up + // To Character anchored Line of Text needs to be LINE_BOTTOM in order for the GUI to pick it up CPPUNIT_ASSERT_EQUAL(text::RelOrientation::TEXT_LINE, getProperty(getShape(1), u"VertOrientRelation"_ustr)); CPPUNIT_ASSERT_EQUAL(text::VertOrientation::LINE_BOTTOM, diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index 1f6e72c1f8d0..4aff3fb2e4e1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -394,6 +394,91 @@ CPPUNIT_TEST_FIXTURE(Test, testMathFractionBarColor) assertXPath(pXmlDoc, "//w:p[4]//m:oMath/m:r[1]/w:rPr/w:color", "val", u"FF0000"); } +CPPUNIT_TEST_FIXTURE(Test, testMathBoldItalic) +{ + createSwDoc("math-bold-italic.docx"); + + // The bold and italic in the m:ctrlPr of the fraction belong to its bar, not to the + // terms. + CHECK_FORMULA(u"{bold {x}} over {2I}"_ustr, getFormula(getRun(getParagraph(1), 1))); + + // The second formula follows a line of text in its paragraph + uno::Reference xParagraph(getParagraph(2), uno::UNO_QUERY); + uno::Reference xRuns = xParagraph->createEnumeration(); + uno::Reference xFormulaRun; + while (!xFormulaRun && xRuns->hasMoreElements()) + { + uno::Reference xRun(xRuns->nextElement(), uno::UNO_QUERY); + if (getProperty(xRun, u"TextPortionType"_ustr) == "Frame") + xFormulaRun = xRun; + } + CPPUNIT_ASSERT(xFormulaRun.is()); + CHECK_FORMULA(u"color red {\" \"} {xBI} over {2B}"_ustr, getFormula(xFormulaRun)); + + CHECK_FORMULA(u"f left (bold {x} right ) = {a} rsub {bold {0}} + sum from {n=1} to " + u"{\u221E} {left ({bold {a}} rsub {bold {n}} cos {{bold {n\u03C0x}} over " + u"{L}} + {b} rsub {n} bold {sin} {{n\u03C0x} over {L}} right )}"_ustr, + getFormula(getRun(getParagraph(3), 1))); + CHECK_FORMULA(u"{bold nitalic {e}} ^ {x} =1+ {nitalic {x}} over {1!} + {{color hex EE0000 " + u"{bold {x}}} ^ {2}} over {2!} + {{x} ^ {3}} over {3!} +\u2026, \" \"\" \" " + u"-\u221E0"_ustr, + getFormula(getRun(getParagraph(8), 1))); + + saveAndReload(TestFilter::DOCX); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); + + assertXPath(pXmlDoc, "//w:p[1]//m:f/m:num/m:r/m:rPr/m:sty", "val", u"bi"); + assertXPath(pXmlDoc, "//w:p[1]//m:f/m:den/m:r/m:rPr", 0); + // The fraction's control properties carry the size it is drawn at and nothing else: a + // bold or italic there belongs to the bar alone, and a command around the fraction would + // reach the terms as well. The size comes first, so the three counts below are taken on + // a path that is there. + assertXPath(pXmlDoc, "//w:p[1]//m:f/m:fPr/m:ctrlPr/w:rPr/w:sz", 1); + assertXPath(pXmlDoc, "//w:p[1]//m:f/m:fPr/m:ctrlPr/w:rPr/w:b", 0); + assertXPath(pXmlDoc, "//w:p[1]//m:f/m:fPr/m:ctrlPr/w:rPr/w:i", 0); + assertXPath(pXmlDoc, "//w:p[1]//m:f/m:fPr/m:ctrlPr/w:rPr/w:color", 0); + assertXPath(pXmlDoc, "//w:p[2]//m:oMath/m:r[1]/w:rPr/w:b", 0); + assertXPath(pXmlDoc, "(//w:p[3]//m:sSub)[1]/m:sub/m:r/m:rPr/m:sty", "val", u"b"); + assertXPath(pXmlDoc, "(//w:p[3]//m:f)[1]/m:num/m:r/m:rPr/m:sty", "val", u"bi"); + assertXPath(pXmlDoc, "(//w:p[3]//m:f)[2]/m:num/m:r/m:rPr", 0); + assertXPath(pXmlDoc, "//w:p[3]//m:r[m:t='cos']/m:rPr/m:sty", "val", u"p"); + assertXPath(pXmlDoc, "//w:p[3]//m:r[m:t='sin']/m:rPr/m:sty", "val", u"b"); + assertXPath(pXmlDoc, "//w:p[5]//m:r[m:t='e']/m:rPr/m:sty", "val", u"b"); + assertXPath(pXmlDoc, "//w:p[5]//m:r[m:rPr/m:sty/@m:val='p']", 1); + assertXPathContent(pXmlDoc, "//w:p[5]//m:r[m:rPr/m:sty/@m:val='p']/m:t", u"x"); + assertXPath(pXmlDoc, "//w:p[5]//m:r[w:rPr/w:color]/m:rPr/m:sty", "val", u"bi"); + assertXPath(pXmlDoc, "//w:p[5]//m:r[w:rPr/w:color]/w:rPr/w:color", "val", u"EE0000"); + assertXPath(pXmlDoc, "(//w:p[6]//m:r[m:t='cos'])[2]/m:rPr/m:sty", "val", u"b"); + assertXPath(pXmlDoc, "(//w:p[6]//m:r[m:t='cos'])[3]/m:rPr/m:sty", "val", u"bi"); + assertXPath(pXmlDoc, "//w:p[8]//m:r[m:t='sin']/m:rPr/m:sty", "val", u"i"); + assertXPath(pXmlDoc, "//w:p[8]//m:r[m:t='if']/m:rPr/m:nor", 1); + assertXPath(pXmlDoc, "//w:p[8]//m:r[m:t='if']/m:rPr/m:sty", 0); + assertXPath(pXmlDoc, "//w:p[8]//m:r[m:t='if']/w:rPr/w:b", 1); +} + +CPPUNIT_TEST_FIXTURE(Test, testMathBoldItalicCtrlPr) +{ + createSwDoc("math-bold-italic-export.fodt"); + save(TestFilter::DOCX); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); + + // A bold or ital command around a construct reaches the part that it draws itself + assertXPath(pXmlDoc, "(//m:oMath)[1]/m:f/m:fPr/m:ctrlPr/w:rPr/w:b", 1); + assertXPath(pXmlDoc, "(//m:oMath)[1]/m:f/m:fPr/m:ctrlPr/w:rPr/w:i", 0); + assertXPath(pXmlDoc, "(//m:oMath)[2]/m:rad/m:radPr/m:ctrlPr/w:rPr/w:i", 1); + assertXPath(pXmlDoc, "(//m:oMath)[3]/m:nary/m:naryPr/m:ctrlPr/w:rPr/w:b", 1); + assertXPath(pXmlDoc, "(//m:oMath)[4]/m:f/m:fPr/m:ctrlPr/w:rPr/w:b", 1); + assertXPath(pXmlDoc, "(//m:oMath)[4]/m:f/m:fPr/m:ctrlPr/w:rPr/w:color", "val", u"FF0000"); + assertXPath(pXmlDoc, "(//m:oMath)[5]/m:r/w:rPr/w:b", 1); + assertXPath(pXmlDoc, "(//m:oMath)[6]/m:r/w:rPr/w:i", 1); + assertXPath(pXmlDoc, "(//m:oMath)[7]/m:r/m:rPr/m:sty", "val", u"p"); +} + DECLARE_OOXMLEXPORT_TEST(testMathD, "math-d.docx") { CHECK_FORMULA( u"left (x mline y mline z right )"_ustr, getFormula( getRun( getParagraph( 1 ), 1 ))); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport27.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport27.cxx index a7a99ac3761c..1276b6fa5605 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport27.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport27.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -419,6 +420,37 @@ CPPUNIT_TEST_FIXTURE(Test, testTableAlignmentFromTableStyle) verify(); } +CPPUNIT_TEST_FIXTURE(Test, testEquationFontSize) +{ + // Each equation is drawn at the size its run properties give it, and an equation whose runs + // give none takes the 11pt of the text around it. Without the fix all three came out at the + // 12pt default of the formula editor. + createSwDoc("math-font-size.docx"); + + const sal_Int16 aExpectedSizes[] = { 8, 11, 20 }; + for (size_t i = 0; i < std::size(aExpectedSizes); ++i) + { + uno::Reference xFormula(getShape(i + 1), + uno::UNO_QUERY); + CPPUNIT_ASSERT(xFormula.is()); + CPPUNIT_ASSERT_EQUAL( + aExpectedSizes[i], + getProperty(xFormula->getEmbeddedObject(), u"BaseFontHeight"_ustr)); + } + + save(TestFilter::DOCX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); + // The size goes back out on the equation's runs, in half points, so the sizes survive a + // round trip. Without the fix the export wrote no size at all. + assertXPath(pXmlDoc, "//w:p[1]/m:oMath/m:r/w:rPr/w:sz", "val", u"16"); + assertXPath(pXmlDoc, "//w:p[2]/m:oMath/m:r/w:rPr/w:sz", "val", u"22"); + assertXPath(pXmlDoc, "//w:p[3]/m:oMath/m:f/m:num/m:r/w:rPr/w:sz", "val", u"40"); + // The fraction bar is drawn by the fraction itself, and takes its size from the control + // properties rather than from the runs above and below it. + assertXPath(pXmlDoc, "//w:p[3]/m:oMath/m:f/m:fPr/m:ctrlPr/w:rPr/w:sz", "val", u"40"); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 80477f5cc43d..1d475cfa2490 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -19,6 +19,7 @@ #include #include +#include #include class Test : public SwModelTestBase diff --git a/sw/qa/extras/ooxmlimport/data/linked-picture.docx b/sw/qa/extras/ooxmlimport/data/linked-picture.docx new file mode 100644 index 000000000000..8099491bf7e1 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/linked-picture.docx differ diff --git a/sw/qa/extras/ooxmlimport/data/linked-picture.png b/sw/qa/extras/ooxmlimport/data/linked-picture.png new file mode 100644 index 000000000000..fdad35484e7c Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/linked-picture.png differ diff --git a/sw/qa/extras/ooxmlimport/data/tdf170236.docx b/sw/qa/extras/ooxmlimport/data/tdf170236.docx new file mode 100644 index 000000000000..1d6fdd1e88d2 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf170236.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 7442fdb86677..54349c0896a5 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1960,6 +1960,31 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineFormulaTextMode) testFitsOnOnePage(); } +CPPUNIT_TEST_FIXTURE(Test, testTdf170236CommentInFormula) +{ + // tdf#170236: a w:commentReference inside an m:oMath formula was dropped on import + createSwDoc("tdf170236.docx"); + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + + bool bFoundAnnotation = false; + while (xFields->hasMoreElements()) + { + uno::Reference xServiceInfo(xFields->nextElement(), uno::UNO_QUERY); + if (xServiceInfo->supportsService(u"com.sun.star.text.textfield.Annotation"_ustr)) + { + bFoundAnnotation = true; + uno::Reference xPropertySet(xServiceInfo, uno::UNO_QUERY); + OUString aContent; + xPropertySet->getPropertyValue(u"Content"_ustr) >>= aContent; + CPPUNIT_ASSERT_EQUAL(u"Hello World!"_ustr, aContent); + break; + } + } + CPPUNIT_ASSERT_MESSAGE("No annotation found in document", bFoundAnnotation); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT } // end of anonymous namespace diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 5714e3a33307..820909fc0a59 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -18,9 +18,11 @@ #include +#include #include #include #include +#include #include #include #include @@ -39,6 +41,7 @@ #include #include #include +#include #include #include @@ -772,9 +775,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf169843_set_letter_formula) createSwDoc("tdf169843.docx"); // Without the fix in place, this test would have failed with - // - Expected: " " setR " " - // - Actual : " "R " " - CPPUNIT_ASSERT_EQUAL(u"\" \" setR \" \""_ustr, getFormula(getRun(getParagraph(1), 1))); + // - Expected: bold {" " setR } " " + // - Actual : bold { R} " " + CPPUNIT_ASSERT_EQUAL(u"bold {\" \" setR } \" \""_ustr, getFormula(getRun(getParagraph(1), 1))); } CPPUNIT_TEST_FIXTURE(Test, testTdf119200) @@ -1511,6 +1514,21 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf165348_lockFileOnRepair) ucb::InteractiveAugmentedIOException); } +CPPUNIT_TEST_FIXTURE(Test, testLinkedPictureNotReadOnLoad) +{ + // Given a document whose picture is only a link to a file next to it, loaded with link + // updates off: + loadFromFile(u"linked-picture.docx", + { comphelper::makePropertyValue(u"UpdateDocMode"_ustr, + sal_Int16(document::UpdateDocMode::NO_UPDATE)) }); + + // Then the linked file is not read, so the picture has no pixels: + auto xGraphic = getProperty>(getShape(1), u"Graphic"_ustr); + // Without the accompanying fix in place, this test would have failed, the import read the + // linked file and the picture was a bitmap. + CPPUNIT_ASSERT(Graphic(xGraphic).GetType() != GraphicType::Bitmap); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT } // end of anonymous namespace diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index d01458c1a59f..db168e30560a 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index 3c1ea262135e..1f87027e6eaf 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -405,6 +406,30 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTextSearch) pCursor->GetPointNode().GetTextNode()->GetText()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTextSearchNoResults) +{ + // Check searching for a string with no matches. This should check tdf#173585 + + // Create a new empty Writer document + createSwDoc(); + + // Search for “Hello” in italics + uno::Reference xSearch(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference xSearchDescriptor(xSearch->createSearchDescriptor(), + uno::UNO_QUERY_THROW); + + xSearchDescriptor->setSearchString(u"Hello"_ustr); + + uno::Sequence aAttributes(comphelper::InitPropertySequence( + { { "CharPosture", uno::Any(css::awt::FontSlant_ITALIC) } })); + xSearchDescriptor->setSearchAttributes(aAttributes); + + uno::Reference xIndex = xSearch->findAll(xSearchDescriptor); + + // There should be no matches + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndex->getCount()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf131431) { // the goal of this test is to check if replaceAll does not go into an infinite loop diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index deef3f2c1fa1..8a7064b50edd 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -26,6 +26,7 @@ #include #include +#include #include #include #include diff --git a/sw/qa/filter/html/data/hidden-text.html b/sw/qa/filter/html/data/hidden-text.html new file mode 100644 index 000000000000..f06fafbddafa --- /dev/null +++ b/sw/qa/filter/html/data/hidden-text.html @@ -0,0 +1 @@ +

keep hidden

diff --git a/sw/qa/filter/html/html.cxx b/sw/qa/filter/html/html.cxx index fc94a12e822f..6193e38b5f8f 100644 --- a/sw/qa/filter/html/html.cxx +++ b/sw/qa/filter/html/html.cxx @@ -14,6 +14,10 @@ #include #include +#include +#include +#include +#include #include #include @@ -328,6 +332,40 @@ CPPUNIT_TEST_FIXTURE(Test, testMailmergeCopy) } } +CPPUNIT_TEST_FIXTURE(Test, testDisplayNoneImport) +{ + // Given an HTML document with a "display: none" span: + setImportFilterName(TestFilter::HTML_WRITER); + // When importing that document: + createSwDoc("hidden-text.html"); + + // Then make sure the pasted run is imported as hidden text + // (SvxCharHiddenItem, i.e. RES_CHRATR_HIDDEN): + SwDoc* pDoc = getSwDocShell()->GetDoc(); + SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1); + SwTextNode* pTextNode = aIdx.GetNode().GetTextNode(); + CPPUNIT_ASSERT(pTextNode); + // Without the accompanying fix in place, this test would have failed, the paragraph had no + // spans with direct char formats. + CPPUNIT_ASSERT(pTextNode->HasHints()); + const SwpHints& rHints = pTextNode->GetSwpHints(); + const SwFormatAutoFormat* pAutoFmt = nullptr; + for (size_t i = 0; i < rHints.Count(); ++i) + { + const SwTextAttr* pHint = rHints.Get(i); + if (pHint->Which() == RES_TXTATR_AUTOFMT) + { + pAutoFmt = &pHint->GetAutoFormat(); + break; + } + } + CPPUNIT_ASSERT(pAutoFmt); + const SfxItemSet& rSet = *pAutoFmt->GetStyleHandle(); + const SvxCharHiddenItem* pHidden = rSet.GetItemIfSet(RES_CHRATR_HIDDEN); + CPPUNIT_ASSERT(pHidden); + CPPUNIT_ASSERT(pHidden->GetValue()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/filter/md/md.cxx b/sw/qa/filter/md/md.cxx index 9fc7a012e5d8..66625ab2451d 100644 --- a/sw/qa/filter/md/md.cxx +++ b/sw/qa/filter/md/md.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/sw/qa/uibase/shells/textsh.cxx b/sw/qa/uibase/shells/textsh.cxx index 3721569977f0..9796933b753f 100644 --- a/sw/qa/uibase/shells/textsh.cxx +++ b/sw/qa/uibase/shells/textsh.cxx @@ -17,6 +17,7 @@ #include #include +#include #include #include #include diff --git a/sw/qa/uitest/trackedChanges/tdf150443.py b/sw/qa/uitest/trackedChanges/tdf150443.py index 5f8af5a62a2c..b27663f8fcf2 100644 --- a/sw/qa/uitest/trackedChanges/tdf150443.py +++ b/sw/qa/uitest/trackedChanges/tdf150443.py @@ -26,7 +26,7 @@ class tdf150443(UITestCase): xsearch = xDialog.getChild("search") xsearch.executeAction("CLICK", tuple()) #first search xToolkit.processEventsToIdle() - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "4") + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") # Disable this for now. It seems like sometimes, depending on load, the manage changes dialog box will not # appear, and then the getChild call will fail. Either that or the wrong window is top-level. diff --git a/sw/qa/uitest/writer_tests6/tdf157569_formula_font_size.py b/sw/qa/uitest/writer_tests6/tdf157569_formula_font_size.py index 59b3b56f3c74..988070f54081 100644 --- a/sw/qa/uitest/writer_tests6/tdf157569_formula_font_size.py +++ b/sw/qa/uitest/writer_tests6/tdf157569_formula_font_size.py @@ -20,13 +20,13 @@ class tdf157569(UITestCase): nHeight = xShape.getSize().Height nWidth = xShape.getSize().Width - # Without the fix in place, this test would have failed with - # AssertionError: 1663 != 944 - self.assertEqual(1663, nHeight) + # The formula takes the 11pt of the text around it, which the document defaults + # hold, rather than the 12pt default of the formula editor. + self.assertEqual(1529, nHeight) if platform.system() == "Windows": - self.assertEqual(2157, nWidth) # no idea why it's different on Windows + self.assertEqual(1976, nWidth) # no idea why it's different on Windows else: - self.assertEqual(2118, nWidth) + self.assertEqual(1940, nWidth) xDoc = self.xUITest.getTopFocusWindow() xEditWin = xDoc.getChild("writer_edit") diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index 5868fa4ae449..83ebd1b05f1a 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx b/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx index d023c30e08f1..3e55a8394533 100644 --- a/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx +++ b/sw/qa/writerfilter/dmapper/DomainMapperTableHandler.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -333,6 +334,29 @@ CPPUNIT_TEST_FIXTURE(Test, testDOCXFloatingTableHidemark) CPPUNIT_ASSERT_EQUAL(static_cast(1), rPage2Objs.size()); CPPUNIT_ASSERT(!pPage2->GetNext()); } + +CPPUNIT_TEST_FIXTURE(Test, testTableStyleContextualSpacing) +{ + // Given a document with a table style that turns on contextual spacing, while the default + // paragraph style sets a spacing below the paragraph: + // When loading that document: + loadFromFile(u"table-style-contextual-spacing.docx"); + + // Then make sure the in-table paragraph gets the contextual spacing of the table style: + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference xParaEnum = xText->createEnumeration(); + uno::Reference xTable(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference xCell(xTable->getCellByName(u"A1"_ustr), + uno::UNO_QUERY); + xParaEnum = xCell->createEnumeration(); + uno::Reference xParaProps(xParaEnum->nextElement(), uno::UNO_QUERY); + bool bContextMargin{}; + xParaProps->getPropertyValue(u"ParaContextMargin"_ustr) >>= bContextMargin; + // Without the accompanying fix in place, this test would have failed, because the contextual + // spacing of the table style never reached the paragraphs of the cells. + CPPUNIT_ASSERT(bContextMargin); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx index 375340c002b1..859ec0084f38 100644 --- a/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/qa/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include #include diff --git a/sw/qa/writerfilter/dmapper/data/table-style-contextual-spacing.docx b/sw/qa/writerfilter/dmapper/data/table-style-contextual-spacing.docx new file mode 100644 index 000000000000..818f540980b3 Binary files /dev/null and b/sw/qa/writerfilter/dmapper/data/table-style-contextual-spacing.docx differ diff --git a/sw/qa/writerfilter/ooxml/ooxml.cxx b/sw/qa/writerfilter/ooxml/ooxml.cxx index 90a3fb85b774..e975d8e56106 100644 --- a/sw/qa/writerfilter/ooxml/ooxml.cxx +++ b/sw/qa/writerfilter/ooxml/ooxml.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/qa/writerfilter/rtftok/data/cell-then-intbl.rtf b/sw/qa/writerfilter/rtftok/data/cell-then-intbl.rtf new file mode 100644 index 000000000000..f80c1b8720cd --- /dev/null +++ b/sw/qa/writerfilter/rtftok/data/cell-then-intbl.rtf @@ -0,0 +1 @@ +{\rtf1\cell x\intbl} \ No newline at end of file diff --git a/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx b/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx index 72780e7a4b2b..7c2a3ed6c114 100644 --- a/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx +++ b/sw/qa/writerfilter/rtftok/rtfdispatchsymbol.cxx @@ -84,6 +84,23 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableThenSectBreak) // i.e. the floating table was on the 2nd page, not on the 1st page. assertXPath(pXmlDoc, "/root/page[1]/sorted_objs/fly", 1); } + +CPPUNIT_TEST_FIXTURE(Test, testCellThenIntbl) +{ + // Given a document where the \intbl comes after the \cell: + // When loading that file: + loadFromFile(u"cell-then-intbl.rtf"); + + // Then make sure that the text after the cell end is in the document: + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference xParagraphs = xText->createEnumeration(); + uno::Reference xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY); + // Without the accompanying fix in place, this test would have failed, the import replayed + // the buffered cell end with no properties to put it in. + CPPUNIT_ASSERT_EQUAL(u"x"_ustr, xParagraph->getString()); + CPPUNIT_ASSERT(!xParagraphs->hasMoreElements()); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/writerfilter/rtftok/rtfdocumentimpl.cxx b/sw/qa/writerfilter/rtftok/rtfdocumentimpl.cxx index 23c1c8fda9c2..f918d1680b3c 100644 --- a/sw/qa/writerfilter/rtftok/rtfdocumentimpl.cxx +++ b/sw/qa/writerfilter/rtftok/rtfdocumentimpl.cxx @@ -19,6 +19,7 @@ #include #include +#include using namespace ::com::sun::star; diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx index e6db5de76dfe..d651b8203dcd 100644 --- a/sw/source/core/attr/cellatr.cxx +++ b/sw/source/core/attr/cellatr.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index cdcf4cc2d612..e36afa1b60fd 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/bastyp/swregion.cxx b/sw/source/core/bastyp/swregion.cxx index 97e271811ab8..8872c2e85203 100644 --- a/sw/source/core/bastyp/swregion.cxx +++ b/sw/source/core/bastyp/swregion.cxx @@ -65,6 +65,8 @@ void SwRegionRects::operator+=( const SwRect &rRect ) */ void SwRegionRects::operator-=( const SwRect &rRect ) { + if (m_pSubtracted) + m_pSubtracted->push_back(rRect); sal_uInt16 nMax = size(); for ( sal_uInt16 i = 0; i < nMax; ++i ) { diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 119e8ab3421a..2cd9507cbd67 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -4276,6 +4276,25 @@ void SwCursorShell::ClearUpCursors() pStartCursor->DeleteMark(); bChanged = true; } + + // sw_PosOk only asks whether the position is in a content node, so a + // content index pointing past the end of the text survives it. + // It should not happen, but still happened when an undo left it behind when + // it rebuilt the text it had selected. + // Keep the offsets inside the node, so that users of the selection cannot run + // out of bounds. + for (SwPaM& rPaM : pStartCursor->GetRingContainer()) + { + for (SwPosition* pPos : { rPaM.GetPoint(), rPaM.GetMark() }) + { + const SwContentNode* pContentNode = pPos->GetNode().GetContentNode(); + if (pContentNode && pPos->GetContentIndex() > pContentNode->Len()) + { + pPos->SetContent(pContentNode->Len()); + bChanged = true; + } + } + } if (pStartCursor->GetPoint()->GetNode().IsTableNode()) { // tdf#106959: When cursor points to start of a table, the proper content diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index a38b0e3a9c24..5480eb03474a 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 63bddbebe95b..a7382cc754b4 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -53,6 +53,14 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::util; +static bool lcl_ColorsAreBasicallyEqual(const ::Color& rColor1, const ::Color& rColor2) +{ + if (rColor1 == COL_AUTO || rColor2 == COL_AUTO) + return rColor1 == rColor2; + + return rColor1.IsRGBEqual(rColor2); +} + // Special case for SvxFontItem: only compare the name static bool CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 ) { @@ -68,7 +76,7 @@ static bool CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 ) if (rBrush1.getComplexColor().isUsed() && rBrush2.getComplexColor().isUsed()) return rItem1 == rItem2; - return rBrush1.GetColor().IsRGBEqual(rBrush2.GetColor()); + return lcl_ColorsAreBasicallyEqual(rBrush1.GetColor(), rBrush2.GetColor()); } case RES_CHRATR_OVERLINE: case RES_CHRATR_UNDERLINE: @@ -78,16 +86,14 @@ static bool CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 ) if (rUnderline1.getComplexColor().isUsed() && rUnderline2.getComplexColor().isUsed()) return rItem1 == rItem2; - return rUnderline1.GetColor().IsRGBEqual(rUnderline2.GetColor()) + return lcl_ColorsAreBasicallyEqual(rUnderline1.GetColor(), rUnderline2.GetColor()) && rUnderline1.GetLineStyle() == rUnderline2.GetLineStyle(); } case RES_CHRATR_COLOR: { ::Color Color1 = rItem1.StaticWhichCast(RES_CHRATR_COLOR).GetValue(); ::Color Color2 = rItem2.StaticWhichCast(RES_CHRATR_COLOR).GetValue(); - if (Color1 == COL_AUTO || Color2 == COL_AUTO) - return Color1 == Color2; - return Color1.IsRGBEqual(Color2); + return lcl_ColorsAreBasicallyEqual(Color1, Color2); } case RES_PAGEDESC: ::std::optional const oNumOffset1 = rItem1.StaticWhichCast(RES_PAGEDESC).GetNumOffset(); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index e3ec6f13bd30..dffebc8950a7 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -1293,7 +1293,8 @@ namespace //local functions originally from docfmt.cxx } } } - } while( pRStt <= rRg.Start() && ++nRedlPos < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size()); + } while (*pRStt <= *rRg.End() + && ++nRedlPos < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size()); } if (!xExtra && bExistingFormatRedlineAtRange) { @@ -2186,7 +2187,7 @@ void DocumentContentOperationsManager::DeleteDummyChar( void DocumentContentOperationsManager::DeleteRange( SwPaM & rPam ) { - // Seek all redlines that are in that PaM to be deleted.. + // Seek all redlines that are in that PaM to be deleted. SwRedlineTable::size_type nRedlStart = m_rDoc.getIDocumentRedlineAccess().GetRedlinePos( rPam.Start()->GetNode(), RedlineType::Any); SwRedlineTable::size_type nRedlEnd = m_rDoc.getIDocumentRedlineAccess().GetRedlineEndPos( @@ -4608,6 +4609,14 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam, SwDelet return false; } + // A delete stays within one cell of a table, the same rule that a cursor selection follows + const SwStartNode* pStartBox = pStart->GetNode().FindTableBoxStartNode(); + const SwStartNode* pEndBox = pEnd->GetNode().FindTableBoxStartNode(); + if (pStartBox != pEndBox) + { + return false; + } + if( m_rDoc.GetAutoCorrExceptWord() ) { // if necessary the saved Word for the exception diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index cb14706a4908..60c9eaa996a9 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index 4f783667b679..2a0bd658b779 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index db01cdbffbfc..a36a6c0107bc 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -82,6 +83,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx index 2677b9f4a667..3f92f366907f 100644 --- a/sw/source/core/doc/docchart.cxx +++ b/sw/source/core/doc/docchart.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 47e2126eb565..672d50666be3 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -853,6 +854,11 @@ SwFormat *SwDoc::MakeFrameFormat_(const UIName &rFormatName, return pFrameFormat; } +SwCharFormat* SwDoc::FindCharFormatByName( const UIName& rName ) const +{ + return mpCharFormatTable->FindFormatByName(rName); +} + SwCharFormat *SwDoc::MakeCharFormat( const UIName &rFormatName, SwCharFormat *pDerivedFrom ) { diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index 78fb9027c656..1c7d5a8f1778 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index e3ceaa8e4cc8..90313a7abba7 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index fe37d2fc64e0..a4df2c4580bf 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index d51726c01c11..86b2d4a46f42 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 75fe2aedb402..feb71fa4c6e6 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index 5db0be65abe8..9c57537842bd 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -224,7 +224,7 @@ bool SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const const_cast(this)->m_eType = NONE_SERVER; for( size_t n = rLnks.size(); n; ) { - const ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); + const ::sfx2::SvBaseLink* pLnk = rLnks[ --n ].get(); if (sfx2::SvBaseLinkObjectType::ClientGraphic != pLnk->GetObjType() && dynamic_cast( pLnk) != nullptr && !static_cast(pLnk)->IsNoDataFlag() && diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index da66abe207da..29cec9c2eb38 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -692,12 +692,12 @@ SwTableAutoFormat& SwTableAutoFormatTable::operator[](size_t const i) const SwTableAutoFormat* SwTableAutoFormatTable::GetData(size_t nIndex) const { - return &*m_pImpl->m_AutoFormats[nIndex]; + return m_pImpl->m_AutoFormats[nIndex].get(); } SwTableAutoFormat* SwTableAutoFormatTable::GetData(size_t nIndex) { - return &*m_pImpl->m_AutoFormats[nIndex]; + return m_pImpl->m_AutoFormats[nIndex].get(); } void SwTableAutoFormatTable::AddAutoFormat(const SwTableAutoFormat& rTableStyle) diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index 986da9801782..fd8fa474abb3 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -505,10 +505,19 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, pDstBox->GetSttNd()->EndOfSectionIndex() - pDstBox->GetSttIdx() ); - if( pUndo ) - pUndo->AddBoxBefore( *pDstBox, bDelContent ); + // Do not record (track) changes if the cell holds a formula. + // The text that arrives with the copy will be recalculated based on the formula, + // and that would eliminate the tracked change from the cell anyway. + // TODO: if we want tracked changes to work on it, we should create a new type of + // tracked change that tracks the formula changes, not the cell value changes. + const bool bTrackChanges = !pCpyBox + || SfxItemState::SET + != pCpyBox->GetFrameFormat()->GetItemState( RES_BOXATR_FORMULA, false ); - bool bUndoRedline = pUndo && rDoc.getIDocumentRedlineAccess().IsRedlineOn(); + if( pUndo ) + pUndo->AddBoxBefore( *pDstBox, bDelContent, bTrackChanges ); + + bool bUndoRedline = pUndo && bTrackChanges && rDoc.getIDocumentRedlineAccess().IsRedlineOn(); ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); SwNodeIndex aSavePos( aInsIdx, -1 ); @@ -574,7 +583,7 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, //b6341295: Table copy redlining will be managed by AddBoxAfter() if( pUndo ) - pUndo->AddBoxAfter( *pDstBox, aInsIdx, bDelContent ); + pUndo->AddBoxAfter( *pDstBox, aInsIdx, bDelContent, bTrackChanges ); // heading SwTextNode *const pTextNd = aSavePos.GetNode().GetTextNode(); diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index a394b8a3121c..d4df38af7e2b 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1037,7 +1037,7 @@ static void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd ) const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc().getIDocumentLinksAdministration().GetLinkManager().GetLinks(); for ( auto n = rLnks.size(); n > 0; ) { - SwIntrnlSectRefLink* pSectLnk = dynamic_cast(&(*rLnks[ --n ])); + SwIntrnlSectRefLink* pSectLnk = dynamic_cast(rLnks[ --n ].get()); if ( pSectLnk && pSectLnk != pOwnLink && pSectLnk->IsInRange( rSectNd.GetIndex(), rSectNd.EndOfSectionIndex() ) ) { @@ -1071,7 +1071,7 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& rUpdLnk, SwSectionNode& rSe const ::sfx2::SvBaseLinks& rLnks = rDoc.getIDocumentLinksAdministration().GetLinkManager().GetLinks(); for( auto n = rLnks.size(); n; ) { - ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]); + ::sfx2::SvBaseLink* pLnk = rLnks[ --n ].get(); if( pLnk == &rUpdLnk ) continue; if( sfx2::SvBaseLinkObjectType::ClientFile != pLnk->GetObjType() ) @@ -1091,11 +1091,11 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& rUpdLnk, SwSectionNode& rSe if( n >= rLnks.size() && 0 != ( n = rLnks.size() )) --n; - if( n && pLnk != &(*rLnks[ n ]) ) + if( n && pLnk != rLnks[ n ].get() ) { // Find - it can only precede it! while( n ) - if( pLnk == &(*rLnks[ --n ] ) ) + if( pLnk == rLnks[ --n ].get() ) break; } } diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index eb2d208a5069..bffb0c4df509 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -2343,7 +2343,7 @@ SwDrawVirtObj::~SwDrawVirtObj() { } -rtl::Reference SwDrawVirtObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SwDrawVirtObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SwDrawVirtObj(rTargetModel, *this); } diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 446fc2b1ea46..4beee5d9f35a 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -145,7 +145,7 @@ SdrObjKind SwFlyDrawObj::GetObjIdentifier() const return SdrObjKind::SwFlyDrawObjIdentifier; } -rtl::Reference SwFlyDrawObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference SwFlyDrawObj::implCloneSdrObject(SdrModel& rTargetModel) const { return new SwFlyDrawObj(rTargetModel); } @@ -913,7 +913,8 @@ void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, dou // Apply values pSh->StartAllAction(); - // pSh->StartUndo(SwUndoId::START); + // Group: crop changes the crop item, the frame size and possibly the position. + pSh->StartUndo(SwUndoId::START); // Set new crop values in twips aCrop.SetLeft (o3tl::toTwips(nLeftCrop, o3tl::Length::mm100)); @@ -978,7 +979,7 @@ void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, dou NbcMove(aDeltaMove); } - // pSh->EndUndo(SwUndoId::END); + pSh->EndUndo(SwUndoId::END); pSh->EndAllAction(); } diff --git a/sw/source/core/edit/edfmt.cxx b/sw/source/core/edit/edfmt.cxx index 8139ce07a591..b7e40f7cded2 100644 --- a/sw/source/core/edit/edfmt.cxx +++ b/sw/source/core/edit/edfmt.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include sal_uInt16 SwEditShell::GetCharFormatCount() const diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 91d6150901ae..a3f5310408f3 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index 344ab81673f7..d79600775abc 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx index 3bfc0d436771..89fc2bd8a541 100644 --- a/sw/source/core/fields/tblcalc.cxx +++ b/sw/source/core/fields/tblcalc.cxx @@ -19,6 +19,7 @@ #include +#include #include #include diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 28fdfb6dc8fd..7e090e127c3e 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1365,6 +1365,67 @@ SdrObject* SwFEShell::GetObjAt( const Point& rPt ) return pRet; } +bool SwFEShell::IsTextOverBgObjectAt(const Point& rPt, const SdrObject* pObj) +{ + // Can return false in a number of cases, eg. when not background object + if (!pObj) + return false; + + // #i89920# + // Do not select object in background which is overlapping this text + // at the given position. + const SwContact* pContact = ::GetUserCall(pObj); + if (!pContact) + return false; + + const SwAnchoredObject* pAnchoredObj = pContact->GetAnchoredObj(pObj); + const SwFrameFormat* pFormat = pAnchoredObj->GetFrameFormat(); + const SwFormatSurround& rSurround = pFormat->GetSurround(); + // Function only relevant for objects with Through wrap + if (rSurround.GetSurround() != css::text::WrapTextMode_THROUGH) + return false; + + // Not background object + const SdrLayerID nLayerId = pObj->GetLayer(); + const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess(); + if (nLayerId != rIDDMA.GetHeaderFooterHellId() && nLayerId != rIDDMA.GetHellId()) + return false; + + const SwPageFrame* pPageFrame = GetLayout()->GetPageAtPos(rPt); + const SwContentFrame* pContentFrame(pPageFrame?pPageFrame->ContainsContent():nullptr); + while (pContentFrame) + { + if (pContentFrame->UnionFrame().Contains(rPt)) + { + const SwTextFrame* pTextFrame = pContentFrame->DynCastTextFrame(); + if (pTextFrame) + { + SwPosition aPos(GetDoc()->GetNodes()); + Point aTmpPt(rPt); + if (pTextFrame->GetKeyCursorOfst(&aPos, aTmpPt)) + { + SwRect aCursorCharRect; + if (pTextFrame->GetCharRect(aCursorCharRect, aPos)) + { + if (aCursorCharRect.Overlaps(SwRect(pObj->GetLastBoundRect()))) + { + return true; + } + } + } + } + else + { + return true; + } + break; + } + + pContentFrame = pContentFrame->GetNextContentFrame(); + } + return false; +} + // Test if there is an object at that position and if it should be selected. bool SwFEShell::ShouldObjectBeSelected(const Point& rPt, bool *pSelectFrameInsteadOfCroppedImage) { @@ -1384,64 +1445,8 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt, bool *pSelectFrameInste if (pObj) { - bRet = true; - const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess(); - // #i89920# - // Do not select object in background which is overlapping this text - // at the given position. - bool bObjInBackground( false ); - if ( pObj->GetLayer() == rIDDMA.GetHellId() ) - { - if (const SwContact* pContact = ::GetUserCall( pObj )) - { - const SwAnchoredObject* pAnchoredObj = pContact->GetAnchoredObj( pObj ); - const SwFrameFormat* pFormat = pAnchoredObj->GetFrameFormat(); - const SwFormatSurround& rSurround = pFormat->GetSurround(); - if ( rSurround.GetSurround() == css::text::WrapTextMode_THROUGH ) - { - bObjInBackground = true; - } - } - } - if ( bObjInBackground ) - { - const SwPageFrame* pPageFrame = GetLayout()->GetPageAtPos( rPt ); - if( pPageFrame ) - { - const SwContentFrame* pContentFrame( pPageFrame->ContainsContent() ); - while ( pContentFrame ) - { - if ( pContentFrame->UnionFrame().Contains( rPt ) ) - { - const SwTextFrame* pTextFrame = pContentFrame->DynCastTextFrame(); - if ( pTextFrame ) - { - SwPosition aPos(GetDoc()->GetNodes()); - Point aTmpPt( rPt ); - if (pTextFrame->GetKeyCursorOfst(&aPos, aTmpPt)) - { - SwRect aCursorCharRect; - if (pTextFrame->GetCharRect(aCursorCharRect, - aPos)) - { - if ( aCursorCharRect.Overlaps( SwRect( pObj->GetLastBoundRect() ) ) ) - { - bRet = false; - } - } - } - } - else - { - bRet = false; - } - break; - } - - pContentFrame = pContentFrame->GetNextContentFrame(); - } - } - } + // Text in front takes precedence over background object + bRet = !IsTextOverBgObjectAt(rPt, pObj); // Don't select header / footer objects in body edition and vice-versa SwContact* pContact = static_cast(pObj->GetUserCall()); @@ -1457,6 +1462,7 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt, bool *pSelectFrameInste if ( bRet ) { + const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess(); const SdrPage* pPage = rIDDMA.GetDrawModel()->GetPage(0); for(auto it = pPage->begin() + pObj->GetOrdNum() + 1; it != pPage->end(); ++it) { diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx index 39e2adbcd01c..a62569036354 100644 --- a/sw/source/core/inc/UndoTable.hxx +++ b/sw/source/core/inc/UndoTable.hxx @@ -292,9 +292,11 @@ public: virtual void UndoImpl( ::sw::UndoRedoContext & ) override; virtual void RedoImpl( ::sw::UndoRedoContext & ) override; - void AddBoxBefore( const SwTableBox& rBox, bool bDelContent ); + /// bTrackChanges is false for a box that is copied without recording it as a change, even + /// though changes are being recorded: see lcl_CpyBox(). + void AddBoxBefore( const SwTableBox& rBox, bool bDelContent, bool bTrackChanges ); void AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex& rIdx, - bool bDelContent ); + bool bDelContent, bool bTrackChanges ); bool IsEmpty() const; bool InsertRow( SwTable& rTable, const SwSelBoxes& rBoxes, sal_uInt16 nCnt ); diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx index 1ebcf2cecd43..e58d87452880 100644 --- a/sw/source/core/inc/dflyobj.hxx +++ b/sw/source/core/inc/dflyobj.hxx @@ -33,7 +33,6 @@ class SwFrameFormat; // DrawObjects for Flys class SwFlyDrawObj final : public SdrObject { -private: virtual std::unique_ptr CreateObjectSpecificProperties() override; bool mbIsTextBox; @@ -44,12 +43,12 @@ private: // protected destructor virtual ~SwFlyDrawObj() override; + // for instantiation of this class while loading (via factory + virtual rtl::Reference implCloneSdrObject(SdrModel& rTargetModel) const override; + public: SwFlyDrawObj(SdrModel& rSdrModel); - // for instantiation of this class while loading (via factory - virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; - virtual SdrInventor GetObjInventor() const override; virtual SdrObjKind GetObjIdentifier() const override; virtual bool IsTextBox() const override { return mbIsTextBox; } diff --git a/sw/source/core/inc/fillattrcache.hxx b/sw/source/core/inc/fillattrcache.hxx index 7211bc8dc122..bda5f5a18011 100644 --- a/sw/source/core/inc/fillattrcache.hxx +++ b/sw/source/core/inc/fillattrcache.hxx @@ -1,13 +1,12 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* - * Copyright the LibreOffice contributors. - * - * SPDX-License-Identifier: MPL-2.0 + * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + #ifndef INCLUDED_SW_SOURCE_CORE_INC_FILLATTRCACHE_HXX #define INCLUDED_SW_SOURCE_CORE_INC_FILLATTRCACHE_HXX diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx index 7813a79686a1..4b5c2029e6e6 100644 --- a/sw/source/core/inc/rootfrm.hxx +++ b/sw/source/core/inc/rootfrm.hxx @@ -342,7 +342,12 @@ public: bool IsBetweenPages(const Point& rPt) const; enum class RectsMode { Default, NoAnchoredFlys }; - void CalcFrameRects(SwShellCursor const&, SwRects &, RectsMode eMode = RectsMode::Default); + /// pPieces, when given, also receives the rectangles the selection was built from, + /// which follow the lines while the region left in the second argument need not, and + /// pHoles the ones cut out of it afterwards - a fly, a drop cap. The two account for + /// the region only in NoAnchoredFlys mode, where nothing is added back to it. + void CalcFrameRects(SwShellCursor const&, SwRects&, RectsMode eMode = RectsMode::Default, + SwRects* pPieces = nullptr, SwRects* pHoles = nullptr); /** * Calculates the cells included from the current selection diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 92debcf4216f..24b464df097b 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -424,7 +424,7 @@ const SwLayoutFrame *SwFrame::ImplGetNextLayoutLeaf( bool bFwd ) const if ( !bGoingDown ) { // I cannot go down, because either I'm currently going up or - // because the is no lower. + // because there is no lower. // I'll try to go forward: p = lcl_FindLayoutFrame( pFrame, bFwd ); bGoingFwdOrBwd = nullptr != p; diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 4dd164751f97..a37ab5887ea7 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1751,6 +1751,13 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, { nUpper = 0; } + else if (m_rThis.IsInTab() && pAttrs->GetULSpace().GetContext() + && lcl_IdenticalStyles(m_rThis.FindPrevCnt(), &m_rThis)) + { + // Contextual spacing reaches across a cell boundary, so the paragraph that starts + // a cell drops its space above when the previous paragraph uses the same style. + nUpper = 0; + } else lcl_PartiallyCollapseUpper(*pOwn, nUpper); // possibly modifies nUpper } @@ -1978,7 +1985,15 @@ SwTwips SwFlowFrame::CalcAddLowerSpaceAsLastInTableCell( if (_pAttrs) { - nAdditionalLowerSpace += _pAttrs->GetULSpace().GetLower(); + // Contextual spacing reaches across a cell boundary, so the paragraph that ends a + // cell drops its space below when the next paragraph uses the same style. + const bool bContextualSpacing + = _pAttrs->GetULSpace().GetContext() + && lcl_IdenticalStyles(pFrame, pFrame ? pFrame->FindNextCnt() : nullptr); + if (!bContextualSpacing) + { + nAdditionalLowerSpace += _pAttrs->GetULSpace().GetLower(); + } if (rIDSA.get(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS)) { diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 85ce7e34b0e4..6cbb00a305f1 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -2113,7 +2113,8 @@ static void Add( SwRegionRects& rRegion, const SwRect& rRect ) * rectangles are available for highlighting. * In the end the Flys are cut out of the region. */ -void SwRootFrame::CalcFrameRects(SwShellCursor const& rCursor, SwRects & rRects, RectsMode const eMode) +void SwRootFrame::CalcFrameRects(SwShellCursor const& rCursor, SwRects& rRects, + RectsMode const eMode, SwRects* pPieces, SwRects* pHoles) { auto [pStartPos, pEndPos] = rCursor.StartEnd(); // SwPosition* @@ -2126,6 +2127,11 @@ void SwRootFrame::CalcFrameRects(SwShellCursor const& rCursor, SwRects & rRects, SwRegionRects aRegion( !bIgnoreVisArea ? pSh->VisArea() : getFrameArea() ); + if (pPieces) + pPieces->clear(); + if (pHoles) + pHoles->clear(); + aRegion.RecordSubtracted(pPieces); if( !pStartPos->GetNode().IsContentNode() || !pStartPos->GetNode().GetContentNode()->getLayoutFrame(this) || ( pStartPos->GetNode() != pEndPos->GetNode() && @@ -2656,6 +2662,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor const& rCursor, SwRects & rRects, } aRegion.Invert(); + aRegion.RecordSubtracted(pHoles); // what follows cuts holes, not pieces pSt2Pos.reset(); pEnd2Pos.reset(); diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 4afbbe3e3f31..b1751e6a3fd6 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -815,7 +815,7 @@ void SwOLENode::SetChanged() { CurrShell aCurr(&rShell); - if(rShell.VisArea().Overlaps(aFrameArea) && OUTDEV_WINDOW == rShell.GetOut()->GetOutDevType()) + if(rShell.VisArea().Overlaps(aFrameArea) && rShell.GetWin()) { // invalidate instead of painting rShell.GetWin()->Invalidate(aFrameArea.SVRect()); diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 8b7260795fe0..c5ad983470e6 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -2430,7 +2431,16 @@ void ChgTextToNum( SwTableBox& rBox, const OUString& rText, const Color* pCol, } rBox.SetSaveNumFormatColor( pCol ? *pCol : std::optional() ); - if( pTNd->GetText() != rText ) + // What the cell shows is its text without what a tracked deletion took out of it, which is + // also the text HasNumContent() and IsNumberChanged() work the value out from. Ask whether + // that already says what the format wants: if it does there is nothing to do, and the + // changes recorded in the cell are left alone. + // + // If it does not, the text is rewritten as a whole below, which loses the changes recorded + // over it. That is coarse, but a number format is free to rewrite the text into anything - + // a number can come out as words, or grow a thousands separator that shifts every position + // after it - so there is no general way to carry a set of changes across a reformat. + if( pTNd->GetRedlineText() != rText ) { // Exchange text. Bugfix to keep Tabs (front and back!) and annotations (inword comment anchors) const OUString& rOrig = pTNd->GetText(); @@ -2474,12 +2484,18 @@ void ChgTextToNum( SwTableBox& rBox, const OUString& rText, const Color* pCol, while( nCommentPos > aIdx.GetIndex() && nCommentPos == nEndPos ); } + const sal_Int32 nInsStt = aIdx.GetIndex(); pTNd->EraseText( aIdx, n, SwInsertFlags::EMPTYEXPAND ); pTNd->InsertText( rText, aIdx, SwInsertFlags::EMPTYEXPAND ); - if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) + // The text of a box with a formula is worked out from the formula and is rewritten + // whenever the table is recalculated, by a change to some other box as much as by one + // here. Nobody wrote it, so do not record it as an insertion. + const bool bFormulaBox = SfxItemState::SET + == rBox.GetFrameFormat()->GetItemState( RES_BOXATR_FORMULA, false ); + if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() && !bFormulaBox ) { - SwPaM aTemp(*pTNd, 0, *pTNd, rText.getLength()); + SwPaM aTemp(*pTNd, nInsStt, *pTNd, nInsStt + rText.getLength()); rDoc.getIDocumentRedlineAccess().AppendRedline(new SwRangeRedline(RedlineType::Insert, aTemp), true); } } diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index bd2c58adbf5d..84875715f893 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -460,17 +460,26 @@ const SwTextNode* lcl_JumpedToNode(const SwEditShell& rSh, const SwPosition& rBe return rPoint == rBeforeJump ? nullptr : rPoint.GetNode().GetTextNode(); } -// the language a paragraph declares for itself, as against the one a run of text sets +// the language of a paragraph, as against the one a run of text sets LanguageType lcl_GetParagraphLanguage(const SwTextFrame& rFrame, const TypedWhichId nWhich) { - // what is anchored here is tagged inside the paragraph's element and would inherit a - // language put there; the node, not the frame, because a split paragraph is one element - if (!rFrame.GetTextNodeFirst()->GetAnchoredFlys().empty()) - return LANGUAGE_DONTKNOW; return rFrame.GetTextNodeForParaProps()->GetSwAttrSet().Get(nWhich).GetLanguage(); } +// the language an element inherits from the element around it +LanguageType lcl_GetInheritedLanguage(const SwFrame& rFrame, const SwEnhancedPDFState& rState) +{ + // a frame's element sits in its anchor's, and what the frame holds sits in the frame's + if (rFrame.IsFlyFrame()) + { + const SwFrame* pAnchor = static_cast(rFrame).GetAnchorFrame(); + if (auto pAnchorText = pAnchor ? pAnchor->DynCastTextFrame() : nullptr) + return lcl_GetParagraphLanguage(*pAnchorText, rState.m_nLanguageWhich); + } + return rState.m_eLanguageDefault; +} + // the language a run of text is measured against LanguageType lcl_GetEnclosingLanguage(const SwTextPaintInfo& rInf, const SwEnhancedPDFState& rState) { @@ -571,40 +580,98 @@ bool lcl_TryMoveToNonHiddenField(SwEditShell& rShell, const SwTextNode& rNd, con return true; }; +// absorb into rRects[rInto] one rectangle that touches it, nSlack twips apart counting as +// touching, unless their union would reach over one of rHoles +bool lcl_AbsorbOne(SwRects& rRects, size_t& rInto, tools::Long nSlack, const SwRects& rHoles) +{ + const SwRect aGrown(rRects[rInto].Pos() - Point(nSlack, nSlack), + rRects[rInto].SSize() + Size(2 * nSlack, 2 * nSlack)); + for (size_t i = 0; i < rRects.size(); ++i) + { + if (i == rInto || !aGrown.Overlaps(rRects[i])) + continue; + const SwRect aJoined(rRects[rInto].GetUnion(rRects[i])); + if (std::ranges::any_of( + rHoles, [&aJoined](const SwRect& rHole) { return aJoined.Overlaps(rHole); })) + { + continue; + } + rRects[rInto] = aJoined; + rRects.erase(rRects.begin() + i); + if (i < rInto) + --rInto; + return true; + } + return false; +} + +void lcl_JoinTouching(SwRects& rRects, tools::Long nSlack, const SwRects& rHoles) +{ + // the union of two rectangles reaches further than either, so one that has just grown is + // offered the whole vector again, those already passed included + for (size_t i = 0; i < rRects.size(); ++i) + { + while (lcl_AbsorbOne(rRects, i, nSlack, rHoles)) + { + } + } +} + // tdf#157816: try to check if the rectangle contains actual text ::std::vector GetCursorRectsContainingText(SwCursorShell const& rShell) { - ::std::vector ret; - SwRects rects; - rShell.GetLayout()->CalcFrameRects(*rShell.GetCursor_(), rects, SwRootFrame::RectsMode::NoAnchoredFlys); + SwRects region; + SwRects pieces; + SwRects holes; + // the pieces specify which lines each part of the region belongs to + rShell.GetLayout()->CalcFrameRects(*rShell.GetCursor_(), region, + SwRootFrame::RectsMode::NoAnchoredFlys, &pieces, &holes); auto const [pStart, pEnd] = rShell.GetCursor_()->StartEnd(); - for (SwRect const& rRect : rects) + // a ruby's band overlaps its line's text band while lines only abut, so this leaves + // the pieces not overlapping each other; a piece spans its lines whole, so vetoing on + // a hole here would refuse every join + lcl_JoinTouching(pieces, 0, {}); + + ::std::vector ret; + for (const SwRect& rPiece : pieces) { - Point center(rRect.Center()); - SwSpecialPos special; - SwCursorMoveState cms(CursorMoveState::NONE); - cms.m_pSpecialPos = &special; - cms.m_bFieldInfo = true; - // the centre of a one-glyph rectangle falls in that glyph's second half, so the hit - // test below returns the character that contains the point - cms.m_bPosMatchesBounds = true; - SwPosition pos(rShell.GetDoc()->GetNodes()); - if (rShell.GetLayout()->GetModelPositionForViewPoint(&pos, center, &cms) - && *pStart <= pos && pos <= *pEnd) + SwRects parts; + for (const SwRect& rRect : region) { - SwRect charRect; - std::pair const tmp(center, false); - SwContentFrame const*const pFrame( - pos.nNode.GetNode().GetTextNode()->getLayoutFrame(rShell.GetLayout(), &pos, &tmp)); - if (pFrame->GetCharRect(charRect, pos, &cms, false) - && rRect.Overlaps(charRect)) + SwRect aPart(rRect); + aPart.Intersection(rPiece); + if (!aPart.HasArea()) + continue; + + Point center(aPart.Center()); + SwSpecialPos special; + SwCursorMoveState cms(CursorMoveState::NONE); + cms.m_pSpecialPos = &special; + cms.m_bFieldInfo = true; + // the centre of a one-glyph rectangle falls in that glyph's second half, so the + // hit test below returns the character that contains the point + cms.m_bPosMatchesBounds = true; + SwPosition pos(rShell.GetDoc()->GetNodes()); + if (rShell.GetLayout()->GetModelPositionForViewPoint(&pos, center, &cms) + && *pStart <= pos && pos <= *pEnd) { - ret.push_back(rRect); + SwRect charRect; + std::pair const tmp(center, false); + SwContentFrame const* const pFrame( + pos.GetNode().GetTextNode()->getLayoutFrame(rShell.GetLayout(), &pos, &tmp)); + if (pFrame->GetCharRect(charRect, pos, &cms, false) && aPart.Overlaps(charRect)) + { + parts.push_back(aPart); + } } + // reset stupid static var that may have gotten set now + SwTextCursor::SetRightMargin(false); // WTF is this crap } - // reset stupid static var that may have gotten set now - SwTextCursor::SetRightMargin(false); // WTF is this crap + // what holds no text is gone, so joining the rest keeps a line whole, and a hole + // stops a join that would cover what the selection excludes on purpose + lcl_JoinTouching(parts, 2, holes); + ret.insert(ret.end(), parts.begin(), parts.end()); } return ret; } @@ -762,12 +829,33 @@ void SwTaggedPDFHelper::OpenTagImpl(void const*const pKey) #endif } -sal_Int32 SwTaggedPDFHelper::BeginTagImpl(void const*const pKey, - vcl::pdf::StructElement const eType, const OUString& rString) +std::pair SwTaggedPDFHelper::CreateRubyKids(const OutputDevice& rOut, + const SwFrame& rFrame) +{ + auto* pPDFExtOutDevData = dynamic_cast(rOut.GetExtOutDevData()); + // the check BeginInlineStructureElements makes, so no kid is created that nothing enters + if (!pPDFExtOutDevData || !pPDFExtOutDevData->GetIsExportTaggedPDF() + || lcl_IsInNonStructEnv(rFrame)) + return { -1, -1 }; + + // ISO 32000-2 Table 369 requires RB before RT, and an element is ordered among its + // siblings where its type is set, which is here rather than where the sub-line paints + const sal_Int32 nRB(pPDFExtOutDevData->EnsureStructureElement(nullptr)); + pPDFExtOutDevData->InitStructureElement(nRB, vcl::pdf::StructElement::RB, u"RB"_ustr); + const sal_Int32 nRT(pPDFExtOutDevData->EnsureStructureElement(nullptr)); + pPDFExtOutDevData->InitStructureElement(nRT, vcl::pdf::StructElement::RT, u"RT"_ustr); + return { nRB, nRT }; +} + +sal_Int32 SwTaggedPDFHelper::BeginTagImpl(const void* const pKey, + const vcl::pdf::StructElement eType, + const OUString& rString, const sal_Int32 nExistingId) { // write new tag - const sal_Int32 nId = mpPDFExtOutDevData->EnsureStructureElement(pKey); - mpPDFExtOutDevData->InitStructureElement(nId, eType, rString); + const sal_Int32 nId + = nExistingId != -1 ? nExistingId : mpPDFExtOutDevData->EnsureStructureElement(pKey); + if (nExistingId == -1) + mpPDFExtOutDevData->InitStructureElement(nId, eType, rString); mpPDFExtOutDevData->BeginStructureElement(nId); m_aOpenedTags.push_back(nId); @@ -806,7 +894,8 @@ void SwTaggedPDFHelper::BeginTag(vcl::pdf::StructElement eType, const OUString& } } - sal_Int32 const nId = BeginTagImpl(pKey, eType, rString); + const sal_Int32 nId + = BeginTagImpl(pKey, eType, rString, mpPorInfo ? mpPorInfo->m_nExistingId : -1); // which tag a destination pointing at this node names if (mpFrameInfo && mpFrameInfo->mrFrame.IsTextFrame()) @@ -1050,17 +1139,14 @@ void SwTaggedPDFHelper::SetAttributes(vcl::pdf::StructElement eType) case vcl::pdf::StructElement::Formula: case vcl::pdf::StructElement::Figure: - bAltText = - bPlacement = - bWidth = - bHeight = - bBox = true; + bAltText = bLanguage = bPlacement = bWidth = bHeight = bBox = true; break; case vcl::pdf::StructElement::Division: if (pFrame->IsFlyFrame()) // this can be something else too { bAltText = true; + bLanguage = true; bBox = true; } break; @@ -1160,12 +1246,20 @@ void SwTaggedPDFHelper::SetAttributes(vcl::pdf::StructElement eType) mpPDFExtOutDevData->SetStructureAttributeNumerical( vcl::pdf::PDFWriter::TextIndent, nVal ); } - if (bLanguage && pFrame->IsTextFrame()) + if (bLanguage) { const SwEnhancedPDFState& rState(*mpPDFExtOutDevData->GetSwPDFState()); - const LanguageType nLanguage(lcl_GetParagraphLanguage( - static_cast(*pFrame), rState.m_nLanguageWhich)); - if (LANGUAGE_DONTKNOW != nLanguage && rState.m_eLanguageDefault != nLanguage) + LanguageType nLanguage(LANGUAGE_DONTKNOW); + if (auto pText = pFrame->DynCastTextFrame()) + nLanguage = lcl_GetParagraphLanguage(*pText, rState.m_nLanguageWhich); + else if (pFrame->IsFlyFrame()) + { + // a frame's contents measure against this + nLanguage = rState.m_eLanguageDefault; + } + + if (nLanguage != LANGUAGE_DONTKNOW + && nLanguage != lcl_GetInheritedLanguage(*pFrame, rState)) { mpPDFExtOutDevData->SetStructureAttributeNumerical( vcl::pdf::PDFWriter::Language, static_cast(nLanguage)); diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index ae97e2ca7af2..807d3e9b8b12 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -65,6 +65,7 @@ #include "portab.hxx" #include #include +#include #include #include #include diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index a11fef9483fb..ee9c41bfd5d5 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -1606,9 +1606,10 @@ sal_uInt16 SwTextFrame::GetScalingOfSelectedText( nProWidth += aIter.GetFnt()->GetTextSize_( aDrawInf ).Width(); nIdx++; } - else if ( pHint && ( cChar == CH_TXTATR_BREAKWORD || cChar == CH_TXTATR_INWORD ) ) + else if (cChar == CH_TXTATR_BREAKWORD || cChar == CH_TXTATR_INWORD) { - switch( pHint->Which() ) + const sal_uInt16 nWhich = pHint ? pHint->Which() : 0; + switch(nWhich) { case RES_TXTATR_FTN : { diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index e0958971f770..833c38d669d7 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -417,6 +417,13 @@ bool SwFieldPortion::Format( SwTextFormatInfo &rInf ) case CHAR_WJ: case CH_TXTATR_BREAKWORD: case CH_TXTATR_INWORD: + case CHAR_LRM: + case CHAR_RLM: + case CHAR_LRE: + case CHAR_RLE: + case CHAR_PDF: + case CHAR_LRO: + case CHAR_RLO: { return true; } diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 0048e6193c70..10bfaf25fe9e 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -19,6 +19,7 @@ #include #include +#include #include @@ -1657,6 +1658,15 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, OSL_ENSURE( nullptr == GetInfo().GetUnderFnt() || rMulti.IsBidi(), " Only BiDi portions are allowed to use the common underlining font" ); + // the two sub-lines paint in visual order, so both kids are created before either of them + sal_Int32 nRB(-1); + sal_Int32 nRT(-1); + if (rMulti.IsRuby()) + { + std::tie(nRB, nRT) + = SwTaggedPDFHelper::CreateRubyKids(*GetInfo().GetOut(), *GetInfo().GetTextFrame()); + } + ::std::optional oTag; if (rMulti.IsDouble()) { @@ -1665,7 +1675,8 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, } else if (rMulti.IsRuby()) { - Por_Info const por(rMulti, *this, bRubyTop ? 1 : 2); + // OnTop selects the sub-line with the annotation; bRubyTop applies to a squared grid only + const Por_Info por(rMulti, *this, rMulti.OnTop() ? 1 : 2, rMulti.OnTop() ? nRT : nRB); oTag.emplace(nullptr, nullptr, &por, *GetInfo().GetOut()); GetInfo().SetRuby( rMulti.OnTop() ); } @@ -1843,7 +1854,8 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, if (rMulti.IsRuby()) { oTag.reset(); - Por_Info const por(rMulti, *this, bRubyTop ? 2 : 1); + const Por_Info por(rMulti, *this, rMulti.OnTop() ? 2 : 1, + rMulti.OnTop() ? nRB : nRT); oTag.emplace(nullptr, nullptr, &por, *GetInfo().GetOut()); } } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 4c617528ee4e..8752081d32c7 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index 77f09a754a60..50549efcc1e9 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index e05b17c06689..bb7e2872633e 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1259,7 +1259,8 @@ void SwTextNode::DestroyAttr( SwTextAttr* pAttr ) case RES_TXTATR_FLYCNT: { SwFrameFormat* pFormat = pAttr->GetFlyCnt().GetFrameFormat(); - if( pFormat ) // set to 0 by Undo? + // tdf#125846 - avoid deleting fly formats one by one while the document is destroyed + if (pFormat && !rDoc.IsInDtor()) // set to 0 by Undo? rDoc.getIDocumentLayoutAccess().DelLayoutFormat( pFormat ); } break; diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 9bcdfddc2131..46953d1aaa5e 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include @@ -751,7 +752,10 @@ SwScanner::SwScanner(std::function aGe , m_bClip(bClp) { m_nStartPos = m_nBegin = nStart; - m_nEndPos = nEnd; + // The range comes from a selection, which can be stale - e.g. an undo that + // rebuilt the text leaves the cursor describing the old, longer text. Keep + // the scan inside the string; + m_nEndPos = std::min(nEnd, m_aPreDashReplacementText.getLength()); //MSWord f.e has special emdash and endash behaviour in that they break //words for the purposes of word counting, while a hyphen etc. doesn't. diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 11fe18e9a3cb..be14bd1d5eb7 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 5b95ca89fc22..c1d88d5e7a8f 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 3307b43b07bd..8e9f03e49b5c 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -19,6 +19,8 @@ #include +#include + #include #include #include @@ -91,6 +93,10 @@ struct UndoTableCpyTable_Entry // Was the last paragraph of the new and the first paragraph of the old content joined? bool bJoin; // For redlining only + // Was this box copied as a change? A box that holds a formula is not, see lcl_CpyBox(), + // and then undo and redo have to take the same route the copy took. + bool bTrackChanges; + explicit UndoTableCpyTable_Entry( const SwTableBox& rBox ); void dumpAsXml(xmlTextWriterPtr pWriter) const; @@ -2360,7 +2366,7 @@ void SwUndoTableNumFormat::SetBox( const SwTableBox& rBox ) UndoTableCpyTable_Entry::UndoTableCpyTable_Entry( const SwTableBox& rBox ) : nBoxIdx( rBox.GetSttIdx() ), nOffset( 0 ), - bJoin( false ) + bJoin( false ), bTrackChanges( true ) { } @@ -2397,6 +2403,11 @@ void UndoTableCpyTable_Entry::dumpAsXml(xmlTextWriterPtr pWriter) const BAD_CAST(OString::boolean(bJoin).getStr())); (void)xmlTextWriterEndElement(pWriter); + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("bTrackChanges")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), + BAD_CAST(OString::boolean(bTrackChanges).getStr())); + (void)xmlTextWriterEndElement(pWriter); + (void)xmlTextWriterEndElement(pWriter); } @@ -2411,6 +2422,39 @@ SwUndoTableCpyTable::~SwUndoTableCpyTable() m_pInsRowUndo.reset(); } +namespace +{ +// Move cursors off the temporary node at the start of the box, onto the content that stays. +// +// UndoImpl() and RedoImpl() park cursors on that node while they hand the content of the box to +// an undo object, the same way AddBoxBefore() does, and the node is deleted right after, so the +// cursors have to come off it first. This is what AddBoxAfter() does at the end of a copy. +void lcl_MoveCursorsOffTempNode(const SwTableBox & rBox) +{ + SwPaM aPam(SwNodeIndex(*rBox.GetSttNd(), 1)); + if (!aPam.GetPoint()->GetNode().IsTextNode()) + return; + aPam.SetMark(); + aPam.Move(fnMoveForward, GoInContent); + ::PaMCorrAbs(aPam, *aPam.GetPoint()); +} + +// Put the cursor at the start of the content of the box that starts at nBoxStart. +void lcl_SetCursorToBoxContent(::sw::UndoRedoContext & rContext, + const SwTableNode *const pTableNd, SwNodeOffset const nBoxStart) +{ + if (!pTableNd) + return; + const SwTableBox *const pBox = pTableNd->GetTable().GetTableBox(nBoxStart); + if (!pBox || !pBox->GetSttNd()) + return; + SwPaM & rPaM(rContext.GetCursorSupplier().CreateNewShellCursor()); + rPaM.DeleteMark(); + rPaM.GetPoint()->Assign(*pBox->GetSttNd()); + rPaM.Move(fnMoveForward, GoInContent); +} +} + void SwUndoTableCpyTable::UndoImpl(::sw::UndoRedoContext & rContext) { SwDoc & rDoc = rContext.GetDoc(); @@ -2436,14 +2480,22 @@ void SwUndoTableCpyTable::UndoImpl(::sw::UndoRedoContext & rContext) SwTableBox& rBox = *pBox; SwNodeIndex aInsIdx( *rBox.GetSttNd(), 1 ); - rDoc.GetNodes().MakeTextNode( aInsIdx.GetNode(), rDoc.GetDfltTextFormatColl() ); + SwTextNode *const pNewNode( + rDoc.GetNodes().MakeTextNode( aInsIdx.GetNode(), rDoc.GetDfltTextFormatColl() )); // b62341295: Redline for copying tables const SwNode *pEndNode = rBox.GetSttNd()->EndOfSectionNode(); SwPaM aPam( aInsIdx.GetNode(), *pEndNode ); std::unique_ptr pUndo; - if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ) ) + { // move cursors to the new node which precedes aPam, the way AddBoxBefore() does: + // the content below is about to be handed to an undo object, and a cursor left in it + // still points there once that object lets the nodes go. + SwPosition const pos(*pNewNode, 0); + ::PaMCorrAbs(aPam, pos); + } + + if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ) && pEntry->bTrackChanges ) { bool bDeleteCompleteParagraph = false; bool bShiftPam = false; @@ -2465,8 +2517,14 @@ void SwUndoTableCpyTable::UndoImpl(::sw::UndoRedoContext & rContext) SwTextNode *pText = aTmpIdx.GetNode().GetTextNode(); if( pText ) { + // The content start was recorded when the copy was done. The text of a + // box can be rebuilt after that, by the number format of the box + // regenerating it from the value, and that leaves the recorded offset + // describing text that is no longer there. Keep it inside the text, the + // same way the redline table clamps its own stale positions. aPam.GetPoint()->Assign(*pText, - pUndoRedlineDelete->ContentStart() ); + std::min(pUndoRedlineDelete->ContentStart(), + pText->GetText().getLength()) ); } else aPam.GetPoint()->Assign( aTmpIdx ); @@ -2510,6 +2568,7 @@ void SwUndoTableCpyTable::UndoImpl(::sw::UndoRedoContext & rContext) pEntry->pUndo = std::move(pUndo); aInsIdx = rBox.GetSttIdx() + 1; + lcl_MoveCursorsOffTempNode( rBox ); rDoc.GetNodes().Delete( aInsIdx ); SfxItemSet aTmpSet(SfxItemSet::makeFixedSfxItemSetUndoImpl(rContext); } + + if (!m_vArr.empty()) + lcl_SetCursorToBoxContent(rContext, pTableNd, m_vArr[0]->nBoxIdx + m_vArr[0]->nOffset); + DEBUG_REDLINE( rDoc ) } @@ -2570,15 +2633,24 @@ void SwUndoTableCpyTable::RedoImpl(::sw::UndoRedoContext & rContext) SwNodeIndex aInsIdx( *rBox.GetSttNd(), 1 ); // b62341295: Redline for copying tables - Start. - rDoc.GetNodes().MakeTextNode( aInsIdx.GetNode(), rDoc.GetDfltTextFormatColl() ); + SwTextNode *const pNewNode( + rDoc.GetNodes().MakeTextNode( aInsIdx.GetNode(), rDoc.GetDfltTextFormatColl() )); SwPaM aPam( aInsIdx.GetNode(), *rBox.GetSttNd()->EndOfSectionNode()); - std::unique_ptr pUndo(IDocumentRedlineAccess::IsRedlineOn(GetRedlineFlags()) + const bool bRedlineBox = IDocumentRedlineAccess::IsRedlineOn(GetRedlineFlags()) + && pEntry->bTrackChanges; + if( !bRedlineBox ) + { // as in UndoImpl() above: take cursors out of the content that the undo object below + // is about to take over + SwPosition const pos(*pNewNode, 0); + ::PaMCorrAbs(aPam, pos); + } + std::unique_ptr pUndo(bRedlineBox ? nullptr : std::make_unique(aPam, SwDeleteFlags::Default, true)); if( pEntry->pUndo ) { pEntry->pUndo->UndoImpl(rContext); - if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ) ) + if( bRedlineBox ) { // PrepareRedline has to be called with the beginning of the old content // When new and old content has been joined, the rIter.pAktPam has been set @@ -2603,6 +2675,7 @@ void SwUndoTableCpyTable::RedoImpl(::sw::UndoRedoContext & rContext) // b62341295: Redline for copying tables - End. aInsIdx = rBox.GetSttIdx() + 1; + lcl_MoveCursorsOffTempNode( rBox ); rDoc.GetNodes().Delete( aInsIdx ); SfxItemSet aTmpSet(SfxItemSet::makeFixedSfxItemSetnOffset = rBox.GetSttIdx() - pEntry->nBoxIdx; } + + if (!m_vArr.empty()) + lcl_SetCursorToBoxContent(rContext, pTableNd, m_vArr[0]->nBoxIdx + m_vArr[0]->nOffset); + DEBUG_REDLINE( rDoc ) } -void SwUndoTableCpyTable::AddBoxBefore( const SwTableBox& rBox, bool bDelContent ) +void SwUndoTableCpyTable::AddBoxBefore( const SwTableBox& rBox, bool bDelContent, + bool bTrackChanges ) { if (!m_vArr.empty() && !bDelContent) return; UndoTableCpyTable_Entry* pEntry = new UndoTableCpyTable_Entry( rBox ); + pEntry->bTrackChanges = bTrackChanges; m_vArr.push_back(std::unique_ptr(pEntry)); SwDoc& rDoc = rBox.GetFrameFormat()->GetDoc(); @@ -2649,7 +2728,7 @@ void SwUndoTableCpyTable::AddBoxBefore( const SwTableBox& rBox, bool bDelContent SwTextNode *const pNewNode(rDoc.GetNodes().MakeTextNode(aInsIdx.GetNode(), rDoc.GetDfltTextFormatColl())); SwPaM aPam( aInsIdx.GetNode(), *rBox.GetSttNd()->EndOfSectionNode() ); - if( !rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) + if( !bTrackChanges || !rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) { { // move cursors to new node which precedes aPam SwPosition const pos(*pNewNode, 0); @@ -2670,7 +2749,8 @@ void SwUndoTableCpyTable::AddBoxBefore( const SwTableBox& rBox, bool bDelContent DEBUG_REDLINE( rDoc ) } -void SwUndoTableCpyTable::AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex& rIdx, bool bDelContent ) +void SwUndoTableCpyTable::AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex& rIdx, + bool bDelContent, bool bTrackChanges ) { UndoTableCpyTable_Entry *const pEntry = m_vArr.back().get(); @@ -2687,7 +2767,7 @@ void SwUndoTableCpyTable::AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex pam.Move(fnMoveForward, GoInContent); ::PaMCorrAbs(pam, *pam.GetPoint()); } - if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) + if( bTrackChanges && rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) { SwPosition aTmpPos( rIdx ); pEntry->pUndo = PrepareRedline( rDoc, rBox, aTmpPos, pEntry->bJoin, false ); diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 10ded54ce8ba..3e24abd1471b 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -1832,7 +1832,7 @@ SwChartDataSequence::SwChartDataSequence( #if OSL_DEBUG_LEVEL > 0 // check if it can properly convert into a SwUnoTableCursor // which is required for some functions - SwUnoTableCursor* pUnoTableCursor = dynamic_cast(&(*m_pTableCursor)); + SwUnoTableCursor* pUnoTableCursor = dynamic_cast(m_pTableCursor.get()); OSL_ENSURE(pUnoTableCursor, "SwChartDataSequence: cursor not SwUnoTableCursor"); #endif } @@ -1878,7 +1878,7 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) : #if OSL_DEBUG_LEVEL > 0 // check if it can properly convert into a SwUnoTableCursor // which is required for some functions - SwUnoTableCursor* pUnoTableCursor = dynamic_cast(&(*m_pTableCursor)); + SwUnoTableCursor* pUnoTableCursor = dynamic_cast(m_pTableCursor.get()); OSL_ENSURE(pUnoTableCursor, "SwChartDataSequence: cursor not SwUnoTableCursor"); #endif } @@ -2438,7 +2438,7 @@ void SwChartDataSequence::FillRangeDesc( SwRangeDescriptor &rRangeDesc ) const void SwChartDataSequence::ExtendTo( bool bExtendCol, sal_Int32 nFirstNew, sal_Int32 nCount ) { - SwUnoTableCursor* pUnoTableCursor = dynamic_cast(&(*m_pTableCursor)); + SwUnoTableCursor* pUnoTableCursor = dynamic_cast(m_pTableCursor.get()); if (!pUnoTableCursor) return; diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 82d5eabf48fd..28faedfc0a6b 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 55a30b145ea1..527340d777dc 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -326,7 +326,7 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration( // find all frames, graphics and OLEs that are bound AT character in para FrameClientSortList_t frames; ::CollectFrameAtNode(m_pUnoCursor->GetPoint()->GetNode(), frames, true); - lcl_CreatePortions(m_Portions, xParentText, &*m_pUnoCursor, frames, nStart, nEnd, bOnlyTextFields); + lcl_CreatePortions(m_Portions, xParentText, m_pUnoCursor.get(), frames, nStart, nEnd, bOnlyTextFields); } SwXTextPortionEnumeration::SwXTextPortionEnumeration( diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 67e510866e90..520ee4cb821f 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 7fba6f1cfdf8..1b0408d2ab61 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index f7866b8272e3..2164c929315d 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -3777,7 +3777,7 @@ sal_Int32 SwXCellRange::Impl::GetRowCount() const const SwUnoCursor* SwXCellRange::GetTableCursor() const { SwFrameFormat *const pFormat = m_pImpl->GetFrameFormat(); - return pFormat ? &(*m_pImpl->m_pTableCursor) : nullptr; + return pFormat ? m_pImpl->m_pTableCursor.get() : nullptr; } void SwXCellRange::Impl::Notify( const SfxHint& rHint ) diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 7613252ed05b..5c2cf1565340 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 0a7960b95f55..5ac123dc51e7 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -238,6 +238,8 @@ void SwHTMLParser::InsertBasicDocEvent( const OUString& aEvent, const OUString& if( !pDocSh ) return; + NotifyMacroEventRead(); + OUString sEvent(convertLineEnd(rName, GetSystemLineEnd())); OUString sScriptType; if( EXTENDED_STYPE == eScrType ) diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index c00d047de0e4..7303799a1197 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -1612,6 +1613,9 @@ HTMLAttr **SwHTMLParser::GetAttrTabEntry( sal_uInt16 nWhich ) case RES_CHRATR_CTL_FONT_VARIATIONS: ppAttr = &m_xAttrTab->pFontVariationsCTL; break; + case RES_CHRATR_HIDDEN: + ppAttr = &m_xAttrTab->pCharHidden; + break; case RES_CHRATR_BOX: ppAttr = &m_xAttrTab->pCharBox; break; diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index b5bba1c50762..c4b2b29768db 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -32,13 +32,11 @@ #include #include #include +#include #include #include #include -#include #include -#include -#include #include #include #include @@ -52,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -73,7 +72,6 @@ #include #include #include -#include #include #include #include @@ -626,28 +624,6 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha uno::Reference< beans::XPropertySet > xPropSet( rShape, UNO_QUERY ); SwViewShell *pVSh = m_xDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); - if( !pVSh && !m_nEventId ) - { - // If there is no view shell by now and the doc shell is an internal - // one, no view shell will be created. That for, we have to do that of - // our own. This happens if a linked section is inserted or refreshed. - SwDocShell *pDocSh = m_xDoc->GetDocShell(); - if( pDocSh ) - { - if ( pDocSh->GetMedium() ) - { - // if there is no hidden property in the MediaDescriptor it should be removed after loading - const SfxBoolItem* pHiddenItem = pDocSh->GetMedium()->GetItemSet().GetItem(SID_HIDDEN, false); - m_bRemoveHidden = ( pHiddenItem == nullptr || !pHiddenItem->GetValue() ); - } - - m_pTempViewFrame = SfxViewFrame::LoadHiddenDocument( *pDocSh, SFX_INTERFACE_NONE ); - CallStartAction(); - pVSh = m_xDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); - // this ridiculous hack also enables Undo, so turn it off again - m_xDoc->GetIDocumentUndoRedo().DoUndo(false); - } - } SwXShape *pSwShape = comphelper::getFromUnoTunnel(xPropSet); @@ -665,9 +641,21 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha const SdrView* pDrawView = pVSh ? pVSh->GetDrawView() : nullptr; const SdrUnoObj *pFormObj = dynamic_cast( pObj ); - uno::Reference< awt::XControl > xControl; + utl::SharedUNOComponent xControl; if ( pDrawView && pVSh->GetWin() && pFormObj ) - xControl = pFormObj->GetUnoControl( *pDrawView, *pVSh->GetWin()->GetOutDev() ); + { + xControl.reset(pFormObj->GetUnoControl(*pDrawView, *pVSh->GetWin()->GetOutDev()), + utl::SharedUNOComponent::NoTakeOwnership); + } + else if ( !pVSh && pFormObj ) + { + // With no view, the control is realized in a hidden window of its own to be measured. + if (!m_xControlSizeWindow) + m_xControlSizeWindow = VclPtr::Create(nullptr, WB_STDWORK); + xControl.reset( + pFormObj->GetTemporaryControlForWindow(*m_xControlSizeWindow, m_xControlSizeContainer), + utl::SharedUNOComponent::TakeOwnership); + } awt::Size aSz( rShape->getSize() ); awt::Size aNewSz( 0, 0 ); diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index a9d2713d171a..da228252b2ff 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include #include #include @@ -290,6 +292,7 @@ struct SvxCSS1ItemIds sal_uInt16 nFontVariations; sal_uInt16 nFontVariationsCJK; sal_uInt16 nFontVariationsCTL; + sal_uInt16 nCharHidden; sal_uInt16 nLineSpacing; sal_uInt16 nAdjust; @@ -749,6 +752,7 @@ SvxCSS1Parser::SvxCSS1Parser( SfxItemPool& rPool, OUString aBaseURL, aItemIds.nFontVariations = initTrueWhich( SID_ATTR_CHAR_FONT_VARIATIONS ); aItemIds.nFontVariationsCJK = initTrueWhich( SID_ATTR_CHAR_CJK_FONT_VARIATIONS ); aItemIds.nFontVariationsCTL = initTrueWhich( SID_ATTR_CHAR_CTL_FONT_VARIATIONS ); + aItemIds.nCharHidden = initTrueWhich( SID_ATTR_CHAR_HIDDEN ); aItemIds.nLineSpacing = initTrueWhich( SID_ATTR_PARA_LINESPACE ); aItemIds.nAdjust = initTrueWhich( SID_ATTR_PARA_ADJUST ); @@ -3116,6 +3120,18 @@ static void ParseCSS1_visibility(const CSS1Expression* pExpr, SfxItemSet& /*rIte rPropInfo.m_bVisible = pExpr->GetString() != "hidden"; } +static void ParseCSS1_display(const CSS1Expression* pExpr, SfxItemSet& rItemSet, + SvxCSS1PropertyInfo& /*rPropInfo*/, const SvxCSS1Parser& /*rParser*/) +{ + if (pExpr->GetType() != CSS1_IDENT) + { + return; + } + + if (o3tl::equalsIgnoreAsciiCase(pExpr->GetString(), sCSS1_PV_none)) + rItemSet.Put(SvxCharHiddenItem(true, aItemIds.nCharHidden)); +} + static void ParseCSS1_white_space(const CSS1Expression* pExpr, SfxItemSet& /*rItemSet*/, SvxCSS1PropertyInfo& rPropInfo, const SvxCSS1Parser& /*rParser*/) { @@ -3160,6 +3176,7 @@ CSS1PropEntry constexpr aCSS1PropFnTab[] = { sCSS1_P_color, ParseCSS1_color }, { sCSS1_P_column_count, ParseCSS1_column_count }, { sCSS1_P_direction, ParseCSS1_direction }, + { sCSS1_P_display, ParseCSS1_display }, { sCSS1_P_float, ParseCSS1_float }, { sCSS1_P_font, ParseCSS1_font }, { sCSS1_P_font_family, ParseCSS1_font_family }, diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 58e1da7ed454..14a21b54dd38 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -310,15 +311,13 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn, m_bInFootEndNoteAnchor( false ), m_bInFootEndNoteSymbol( false ), m_bIgnoreHTMLComments( bNoHTMLComments ), - m_bRemoveHidden( false ), m_bBodySeen( false ), m_bReadingHeaderOrFooter( false ), m_bNotifyMacroEventRead( false ), m_isInTableStructure(false), m_nTableDepth( 0 ), m_nFloatingFrames( 0 ), - m_nListItems( 0 ), - m_pTempViewFrame(nullptr) + m_nListItems( 0 ) { // If requested explicitly, then force ignoring of comments (don't create postits for them). if (!bFuzzing) @@ -533,15 +532,12 @@ SwHTMLParser::~SwHTMLParser() m_xDoc.clear(); - if ( m_pTempViewFrame ) + if (m_xControlSizeContainer.is()) { - m_pTempViewFrame->DoClose(); - - // the temporary view frame is hidden, so the hidden flag might need to be removed - SwDocShell* pShell = m_xDoc.is() ? m_xDoc->GetDocShell() : nullptr; - if ( m_bRemoveHidden && pShell && pShell->GetMedium() ) - pShell->GetMedium()->GetItemSet().ClearItem( SID_HIDDEN ); + uno::Reference(m_xControlSizeContainer, uno::UNO_QUERY_THROW)->dispose(); + m_xControlSizeContainer.clear(); } + m_xControlSizeWindow.disposeAndClear(); } IMPL_LINK_NOARG( SwHTMLParser, AsyncCallback, void*, void ) diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 1374cab5e597..9977f994a978 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include #include @@ -46,7 +48,7 @@ #include class SfxMedium; -class SfxViewFrame; +class WorkWindow; class SdrObject; class SvxMacroTableDtor; class SwDoc; @@ -133,6 +135,7 @@ struct HTMLAttrTable HTMLAttr* pFontVariations; HTMLAttr* pFontVariationsCJK; HTMLAttr* pFontVariationsCTL; + HTMLAttr* pCharHidden; }; class HTMLAttr @@ -483,7 +486,6 @@ class SwHTMLParser : public SfxHTMLParser, public SvtListener bool m_bInFootEndNoteAnchor : 1; bool m_bInFootEndNoteSymbol : 1; bool m_bIgnoreHTMLComments : 1; - bool m_bRemoveHidden : 1; // the filter implementation might set the hidden flag bool m_bBodySeen : 1; bool m_bReadingHeaderOrFooter : 1; @@ -497,7 +499,10 @@ class SwHTMLParser : public SfxHTMLParser, public SvtListener /// the names corresponding to the DOCINFO field subtypes INFO[1-4] OUString m_InfoNames[4]; - SfxViewFrame* m_pTempViewFrame; + // A hidden window, and the control container on it, in which a form control is realized to + // measure its size when the document has no view. + VclPtr m_xControlSizeWindow; + uno::Reference m_xControlSizeContainer; bool m_bXHTML = false; bool m_bReqIF = false; diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 72b58673d9cf..bd4e51c870cf 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/filter/md/mdcallbcks.cxx b/sw/source/filter/md/mdcallbcks.cxx index db74a16d5706..a8bddb7d36d2 100644 --- a/sw/source/filter/md/mdcallbcks.cxx +++ b/sw/source/filter/md/mdcallbcks.cxx @@ -33,6 +33,8 @@ #include #include +#include + #include "swmd.hxx" int SwMarkdownParser::enter_block_callback(MD_BLOCKTYPE type, void* detail, void* userdata) @@ -83,11 +85,13 @@ int SwMarkdownParser::enter_block_callback(MD_BLOCKTYPE type, void* detail, void parser->StartTable(nRow, nCol); break; } +#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6) case MD_BLOCK_ADMONITION: case MD_BLOCK_BLANK: case MD_BLOCK_FOOTNOTE_DEF: case MD_BLOCK_FOOTNOTE_DEF_SECTION: break; +#endif case MD_BLOCK_THEAD: case MD_BLOCK_TBODY: break; @@ -142,11 +146,13 @@ int SwMarkdownParser::leave_block_callback(MD_BLOCKTYPE type, void* /*detail*/, case MD_BLOCK_TABLE: parser->EndTable(); break; +#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6) case MD_BLOCK_ADMONITION: case MD_BLOCK_BLANK: case MD_BLOCK_FOOTNOTE_DEF: case MD_BLOCK_FOOTNOTE_DEF_SECTION: break; +#endif case MD_BLOCK_THEAD: case MD_BLOCK_TBODY: break; @@ -226,6 +232,7 @@ int SwMarkdownParser::enter_span_callback(MD_SPANTYPE type, void* detail, void* case MD_SPAN_LATEXMATH: case MD_SPAN_LATEXMATH_DISPLAY: break; +#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6) case MD_SPAN_FOOTNOTE_REF: case MD_SPAN_INS: case MD_SPAN_MARK: @@ -233,6 +240,7 @@ int SwMarkdownParser::enter_span_callback(MD_SPANTYPE type, void* detail, void* case MD_SPAN_SUPERSCRIPT: case MD_SPAN_SUBSCRIPT: break; +#endif case MD_SPAN_WIKILINK: { const MD_SPAN_WIKILINK_DETAIL* pWikilink @@ -274,6 +282,7 @@ int SwMarkdownParser::leave_span_callback(MD_SPANTYPE type, void* /*detail*/, vo case MD_SPAN_WIKILINK: case MD_SPAN_U: break; +#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6) case MD_SPAN_FOOTNOTE_REF: case MD_SPAN_INS: case MD_SPAN_MARK: @@ -281,6 +290,7 @@ int SwMarkdownParser::leave_span_callback(MD_SPANTYPE type, void* /*detail*/, vo case MD_SPAN_SUBSCRIPT: case MD_SPAN_SUPERSCRIPT: break; +#endif } return 0; } diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 46aad4a9cca1..cc72468358a9 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -79,6 +79,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index cc99495fa23d..db7fe47f94f6 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 57f7871a0779..7f7fdd6d71b9 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 2d6f9783e314..29a0fd68fb25 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -3763,7 +3763,7 @@ static bool lcl_IsAtTextEnd(const SwFormatFootnote& rFootnote) pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode(); if (!pSectNd) - bRet = false; // the is ftn/end collected at Page- or Doc-End + bRet = false; // this is ftn/end collected at Page- or Doc-End } return bRet; } diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 34b24e4b4fe0..800d438efcc0 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index ea56cf55135f..8a41939a130c 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index fe398c77fb41..d6fac33a0cc6 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 1b77a000fabc..6a669f5d8d90 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index d13775385fcd..f79229619705 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "envfmt.hxx" #include diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 1e417539b455..174101bc7700 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -203,6 +204,11 @@ SwMailMergeDlg::SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rShell, }; xD->dispatch(aURL, aProperties); m_xBeamerWin->show(); + + // tdf#47890 - remember last used position and size of the mail merge dialog + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); + if (aDlgOpt.Exists()) + m_xDialog->set_window_state(aDlgOpt.GetWindowState()); } uno::Reference xController = m_xFrame->getController(); m_pImpl->xFController.set(xController, UNO_QUERY); @@ -352,6 +358,10 @@ SwMailMergeDlg::SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rShell, SwMailMergeDlg::~SwMailMergeDlg() { if(m_xFrame.is()) { + // tdf#47890 - remember last used position and size of the mail merge dialog + SvtViewOptions aDlgOpt(EViewType::Dialog, m_xDialog->get_help_id()); + aDlgOpt.SetWindowState(m_xDialog->get_window_state(vcl::WindowDataMask::PosSize)); + m_xFrame->setComponent(nullptr, nullptr); m_xFrame->dispose(); } diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 269a9f173b3e..910a84a5848d 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #include diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx index e8b9dec459ee..3b7e5697db0b 100644 --- a/sw/source/ui/frmdlg/frmdlg.cxx +++ b/sw/source/ui/frmdlg/frmdlg.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 32262ac648bf..8530002f0f38 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -1116,6 +1116,8 @@ void SwFramePage::Reset( const SfxItemSet *rSet ) m_xWidthED->save_value(); m_xHeightED->save_value(); + m_xRelWidthRelationLB->save_value(); + m_xRelHeightRelationLB->save_value(); m_bNoModifyHdl = false; //lock PercentFields diff --git a/sw/source/ui/misc/contentcontroldlg.cxx b/sw/source/ui/misc/contentcontroldlg.cxx index 746e40e562a4..4b6781a64ef2 100644 --- a/sw/source/ui/misc/contentcontroldlg.cxx +++ b/sw/source/ui/misc/contentcontroldlg.cxx @@ -26,6 +26,7 @@ #include #include +#include #include #include #include diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx index 3ad49d9c52f8..eacca6c13fb7 100644 --- a/sw/source/ui/table/convert.cxx +++ b/sw/source/ui/table/convert.cxx @@ -204,7 +204,7 @@ void SwConvertTableDlg::Init() m_xLbFormat->connect_selection_changed(LINK(this, SwConvertTableDlg, SelFormatHdl)); size_t nCount = m_xTableTable->size(); - m_nIndex = nCount ? 0 : -1; + m_nIndex = -1; // Do NOT select a table style by default. They just don't work well. for (size_t i = 0; i < nCount; ++i) { @@ -284,7 +284,11 @@ IMPL_LINK_NOARG(SwConvertTableDlg, SelFormatHdl, weld::ItemView&, void) m_nIndex = m_xLbFormat->get_selected_index(); if (m_nIndex == -1) { - SAL_WARN("sw.ui", "No entry selected"); + SwTableAutoFormat aNone(TableStyleName(SwViewShell::GetShellRes()->aStrNone)); + aNone.DisableAll(); + m_aWndPreview.NotifyChange(&aNone); + mxTAutoFormat.reset(); + return; } m_aWndPreview.NotifyChange(m_xTableTable->GetResolvedStyle(m_xTableTable->GetData(m_nIndex))); diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index 4615b22dc9df..2c94eef5070a 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -141,7 +141,7 @@ void SwInsTableDlg::InitAutoTableFormat() m_xLbFormat->append_text((*m_xTableTable)[i].GetName().toString()); } - m_xLbFormat->select(0); + m_xLbFormat->select(-1); // Do NOT select a table style by default. They just don't work well. SelFormatHdl( *m_xLbFormat ); } @@ -150,19 +150,27 @@ IMPL_LINK_NOARG(SwInsTableDlg, SelFormatHdl, weld::ItemView&, void) { // Get index of selected item from the listbox int styleIdx = m_xLbFormat->get_selected_index(); - assert(styleIdx != -1 && "nothing selected"); - m_aWndPreview.NotifyChange(m_xTableTable->GetResolvedStyle(m_xTableTable->GetData(styleIdx))); + if (styleIdx == -1) + { + SwTableAutoFormat aNone(TableStyleName(SwViewShell::GetShellRes()->aStrNone)); + aNone.DisableAll(); + m_aWndPreview.NotifyChange(&aNone); + } + else + m_aWndPreview.NotifyChange(m_xTableTable->GetResolvedStyle( + m_xTableTable->GetData(styleIdx))); } IMPL_LINK_NOARG(SwInsTableDlg, OKHdl, weld::Button&, void) { int styleIdx = m_xLbFormat->get_selected_index(); - assert(styleIdx != -1 && "nothing selected"); - - if( m_xTAutoFormat ) - *m_xTAutoFormat = (*m_xTableTable)[styleIdx]; - else - m_xTAutoFormat.reset(new SwTableAutoFormat((*m_xTableTable)[styleIdx])); + if (styleIdx != -1) + { + if (m_xTAutoFormat) + *m_xTAutoFormat = (*m_xTableTable)[styleIdx]; + else + m_xTAutoFormat.reset(new SwTableAutoFormat((*m_xTableTable)[styleIdx])); + } m_xDialog->response(RET_OK); } diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx index 3310f8688a05..67c44e717df6 100644 --- a/sw/source/ui/vba/vbaapplication.cxx +++ b/sw/source/ui/vba/vbaapplication.cxx @@ -490,10 +490,10 @@ SwVbaApplication::getServiceNames() return aServiceNames; } -uno::Reference< frame::XModel > +SfxBaseModel* SwVbaApplication::getCurrentDocument() { - return static_cast(getCurrentWordDoc( mxContext ).get()); + return getCurrentWordDoc( mxContext ).get(); } rtl::Reference< SwXTextDocument > diff --git a/sw/source/ui/vba/vbaapplication.hxx b/sw/source/ui/vba/vbaapplication.hxx index cf2e79ab414d..e97dfb838293 100644 --- a/sw/source/ui/vba/vbaapplication.hxx +++ b/sw/source/ui/vba/vbaapplication.hxx @@ -32,6 +32,7 @@ #include #include #include +#include #include "vbawindow.hxx" @@ -124,7 +125,8 @@ public: // XSinkCaller virtual void SAL_CALL CallSinks( const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments ) override; - virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() override; + // this should be SwXTextDocument, but the inheritance hierarchy makes that impossible + virtual SfxBaseModel* getCurrentDocument() override; rtl::Reference getCurrentSwDocument(); }; diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx index b742f6f843e1..049cd2a81aa1 100644 --- a/sw/source/ui/vba/vbadocument.cxx +++ b/sw/source/ui/vba/vbadocument.cxx @@ -221,8 +221,7 @@ SwVbaDocument::CustomDocumentProperties( const uno::Any& index ) uno::Any SAL_CALL SwVbaDocument::Bookmarks( const uno::Any& rIndex ) { - uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( getModel(),uno::UNO_QUERY_THROW ); - uno::Reference xBookmarks( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW ); + uno::Reference xBookmarks( mxTextDocument->getBookmarks(), uno::UNO_QUERY_THROW ); uno::Reference< XCollection > xBookmarksVba( new SwVbaBookmarks( this, mxContext, xBookmarks, mxTextDocument ) ); if ( rIndex.getValueTypeClass() == uno::TypeClass_VOID ) return uno::Any( xBookmarksVba ); @@ -230,7 +229,7 @@ SwVbaDocument::Bookmarks( const uno::Any& rIndex ) return xBookmarksVba->Item( rIndex, uno::Any() ); } -uno::Reference< frame::XModel > SwVbaDocument::getModel() const +SfxBaseModel* SwVbaDocument::getModel() const { return static_cast(mxTextDocument.get()); } uno::Any SwVbaDocument::ContentControls(const uno::Any& index) @@ -286,8 +285,7 @@ uno::Reference SwVbaDocument::getActiveWindow() uno::Any SAL_CALL SwVbaDocument::Variables( const uno::Any& rIndex ) { - uno::Reference< css::document::XDocumentPropertiesSupplier > xDocumentPropertiesSupplier( getModel(),uno::UNO_QUERY_THROW ); - uno::Reference< css::document::XDocumentProperties > xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties(); + uno::Reference< css::document::XDocumentProperties > xDocumentProperties = mxTextDocument->getDocumentProperties(); uno::Reference< beans::XPropertyAccess > xUserDefined( xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY_THROW ); uno::Reference< XCollection > xVariables( new SwVbaVariables( this, mxContext, xUserDefined ) ); @@ -386,9 +384,7 @@ uno::Any SAL_CALL SwVbaDocument::getAttachedTemplate() { uno::Reference< word::XTemplate > xTemplate; - uno::Reference const xDocPropSupp( - getModel(), uno::UNO_QUERY_THROW); - uno::Reference< css::document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_SET_THROW ); + uno::Reference< css::document::XDocumentProperties > xDocProps( mxTextDocument->getDocumentProperties(), uno::UNO_SET_THROW ); xTemplate = new SwVbaTemplate( this, mxContext, xDocProps->getTemplateURL() ); return uno::Any( xTemplate ); @@ -411,9 +407,7 @@ SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate ) else osl::FileBase::getFileURLFromSystemPath( sTemplate, aURL ); - uno::Reference const xDocPropSupp( - getModel(), uno::UNO_QUERY_THROW ); - uno::Reference< css::document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_SET_THROW ); + uno::Reference< css::document::XDocumentProperties > xDocProps( mxTextDocument->getDocumentProperties(), uno::UNO_SET_THROW ); xDocProps->setTemplateURL( aURL ); } @@ -595,8 +589,7 @@ SwVbaDocument::SaveAs2000( const uno::Any& FileName, const uno::Any& FileFormat, setFilterPropsFromFormat( nFileFormat, storeProps ); - uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW ); - xStor->storeAsURL( sURL, storeProps ); + mxTextDocument->storeAsURL( sURL, storeProps ); } void SAL_CALL @@ -622,8 +615,7 @@ SwVbaDocument::SavePreviewPngAs( const uno::Any& FileName ) uno::Sequence storeProps{ comphelper::makePropertyValue(u"FilterName"_ustr, u"writer_png_Export"_ustr) }; - uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW ); - xStor->storeToURL( sURL, storeProps ); + mxTextDocument->storeToURL( sURL, storeProps ); } uno::Any diff --git a/sw/source/ui/vba/vbadocument.hxx b/sw/source/ui/vba/vbadocument.hxx index aeaedecedd1d..74cfde4d08b8 100644 --- a/sw/source/ui/vba/vbadocument.hxx +++ b/sw/source/ui/vba/vbadocument.hxx @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -45,7 +46,8 @@ private: css::uno::Reference< css::container::XNameAccess > getFormControls() const; protected: - virtual css::uno::Reference< css::frame::XModel > getModel() const override; + // this should be SwXTextDocument, but the inheritance hierarchy makes that impossible + virtual SfxBaseModel* getModel() const override; public: SwVbaDocument( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& m_xContext, rtl::Reference< SwXTextDocument > const & xModel ); diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 611cef415c28..baa018c80675 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -637,25 +638,9 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) #if HAVE_FEATURE_SCRIPTING if( !officecfg::Office::Common::Filter::HTML::Export::Basic::get() && officecfg::Office::Common::Filter::HTML::Export::Warning::get() - && HasBasic() ) + && sfx2::DocumentMacroMode::containerHasBasicMacros( GetBasicContainer() ) ) { - uno::Reference< XLibraryContainer > xLibCont = GetBasicContainer(); - uno::Reference< XNameAccess > xLib; - const Sequence aNames = xLibCont->getElementNames(); - for(const OUString& rName : aNames) - { - Any aLib = xLibCont->getByName(rName); - aLib >>= xLib; - if(xLib.is()) - { - Sequence aModNames = xLib->getElementNames(); - if(aModNames.hasElements()) - { - SetError(WARN_SWG_HTML_NO_MACROS); - break; - } - } - } + SetError(WARN_SWG_HTML_NO_MACROS); } #endif } diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 53fe33094293..aa406fda7786 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index 7645b2596e39..206f9bb68b16 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include diff --git a/sw/source/uibase/dialog/regionsw.cxx b/sw/source/uibase/dialog/regionsw.cxx index f1b06b32b9e0..efc00cbe5e76 100644 --- a/sw/source/uibase/dialog/regionsw.cxx +++ b/sw/source/uibase/dialog/regionsw.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx b/sw/source/uibase/docvw/FrameControlsManager.cxx index a2a6cd273602..78064212fcfd 100644 --- a/sw/source/uibase/docvw/FrameControlsManager.cxx +++ b/sw/source/uibase/docvw/FrameControlsManager.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/uibase/docvw/contentcontrolaliasbutton.cxx b/sw/source/uibase/docvw/contentcontrolaliasbutton.cxx index cd0be65eddaa..37442bbea63b 100644 --- a/sw/source/uibase/docvw/contentcontrolaliasbutton.cxx +++ b/sw/source/uibase/docvw/contentcontrolaliasbutton.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 563810ddc5ea..e795b67f3e08 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -3346,8 +3346,9 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) bool bHitHandle = pHdl && pHdl->GetKind() != SdrHdlKind::Anchor && pHdl->GetKind() != SdrHdlKind::Anchor_TR; - if ((rSh.IsInsideSelectedObj(aDocPos) || bHitHandle) - && (aMEvt.GetModifier() != KEY_SHIFT || bHitHandle)) + if ((rSh.IsInsideSelectedObj(aDocPos) + && !rSh.IsTextOverBgObjectAt(aDocPos, rSh.GetObjAt(aDocPos)) + && aMEvt.GetModifier() != KEY_SHIFT) || bHitHandle) { rSh.EnterSelFrameMode( &aDocPos ); if ( !m_pApplyTempl ) @@ -3471,8 +3472,8 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) bOnlyText = KEY_MOD1 != aMEvt.GetModifier(); } else if ( rSh.IsSelFrameMode() && - (m_aActHitType == SdrHitKind::NONE || - !rSh.IsInsideSelectedObj( aDocPos ))) + (m_aActHitType == SdrHitKind::NONE || !rSh.IsInsideSelectedObj(aDocPos) + || rSh.IsTextOverBgObjectAt(aDocPos, rSh.GetObjAt(aDocPos))) ) { m_rView.NoRotate(); SdrHdl *pHdl; @@ -3493,6 +3494,11 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) if (aMEvt.IsMod1()) nFlag = nFlag | SW_ENTER_GROUP; + // UnSelectFrame() might affect result, calculate here to agree + // with previous IsInsideSelectedObj() + const bool bTextOverBgObject + = rSh.IsTextOverBgObjectAt(aDocPos, rSh.GetObjAt(aDocPos)); + if ( rSh.IsSelFrameMode() ) { rSh.UnSelectFrame(); @@ -3500,7 +3506,17 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) m_rView.AttrChangedNotify(nullptr); } - bool bSelObj = rSh.SelectObj( aDocPos, nFlag ); + bool bSelObj = false; + if ( !bTextOverBgObject ) + { + bSelObj = rSh.SelectObj(aDocPos, nFlag); + } + else + { + // to show caret + bOnlyText = true; + } + if( bUnLockView ) rSh.LockView( false ); diff --git a/sw/source/uibase/inc/QuickFindPanel.hxx b/sw/source/uibase/inc/QuickFindPanel.hxx index 2e46cb395a82..ac81afb8e5f0 100644 --- a/sw/source/uibase/inc/QuickFindPanel.hxx +++ b/sw/source/uibase/inc/QuickFindPanel.hxx @@ -32,11 +32,11 @@ namespace sw::sidebar class QuickFindPanel : public PanelLayout { public: - static std::unique_ptr Create(weld::Widget* pParent, - const uno::Reference& rxFrame, - SfxBindings* pBindings); + static std::unique_ptr + Create(weld::Widget* pParent, const css::uno::Reference& rxFrame, + SfxBindings* pBindings); - QuickFindPanel(weld::Widget* pParent, const uno::Reference& rxFrame, + QuickFindPanel(weld::Widget* pParent, const css::uno::Reference& rxFrame, SfxBindings* pBindings); virtual ~QuickFindPanel() override; diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index b777e74d191c..a4b1b4ce4279 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -30,7 +30,6 @@ #include #include -#include #include #include #include @@ -210,7 +209,7 @@ public: // select word / sentence bool SelNearestWrd(); - SW_DLLPUBLIC bool SelWrd(const Point * = nullptr, sal_Int16 nWordType = i18n::WordType::ANYWORD_IGNOREWHITESPACES ); + SW_DLLPUBLIC bool SelWrd(const Point * = nullptr, sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ); // #i32329# Enhanced selection void SelSentence (const Point *); SW_DLLPUBLIC void SelPara (const Point *); @@ -720,37 +719,8 @@ private: bool m_bScrollToCursor = false; public: static sal_uInt32 nLock; - MakeAllOutlineContentTemporarilyVisible(SwDoc* pDoc, bool bScrollToCursor = false) - { - ++nLock; - if (nLock > 1) - return; - if (SwDocShell* pDocSh = pDoc->GetDocShell()) - if ((m_pWrtSh = pDocSh->GetWrtShell()) && m_pWrtSh->GetViewOptions() && - m_pWrtSh->GetViewOptions()->IsShowOutlineContentVisibilityButton()) - { - m_pWrtSh->LockView(true); - m_pWrtSh->LockPaint(LockPaintReason::OutlineFolding); - m_pWrtSh->MakeAllFoldedOutlineContentVisible(); - m_bScrollToCursor = bScrollToCursor; - m_bDone = true; - } - } - - ~MakeAllOutlineContentTemporarilyVisible() COVERITY_NOEXCEPT_FALSE - { - --nLock; - if (nLock > 0) - return; - if (m_bDone && m_pWrtSh) - { - m_pWrtSh->MakeAllFoldedOutlineContentVisible(false); - m_pWrtSh->UnlockPaint(); - m_pWrtSh->LockView(false); - if (m_bScrollToCursor) - m_pWrtSh->UpdateCursor(SwCursorShell::SCROLLWIN); - } - } + MakeAllOutlineContentTemporarilyVisible(SwDoc* pDoc, bool bScrollToCursor = false); + ~MakeAllOutlineContentTemporarilyVisible() COVERITY_NOEXCEPT_FALSE; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index cd4674127279..344a8a2628d6 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -1147,7 +1147,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept ) // on the same text range, stored only in OOXML) if ( bMoreRedlines && aRedlines.size() == 1 ) { - std::unique_ptr xChild(rTreeView.make_iterator( &*aRedlines[0] )); + std::unique_ptr xChild(rTreeView.make_iterator( aRedlines[0].get() )); RedlineData* pData = weld::fromId(rTreeView.get_id(*xChild)); if ( pData->bDisabled ) bMoreRedlines = false; @@ -1188,7 +1188,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept ) // handle redlines of table rows, stored as children of the item associated // to the deleted/inserted table row(s) - std::unique_ptr xChild(rTreeView.make_iterator( &*rRedLine )); + std::unique_ptr xChild(rTreeView.make_iterator( rRedLine.get() )); if ( rTreeView.iter_children(*xChild) ) { RedlineData* pData = weld::fromId(rTreeView.get_id(*xChild)); @@ -1353,7 +1353,7 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl, Timer *, void) } // select all redlines of tracked table rows - std::unique_ptr xChild(rTreeView.make_iterator( &*xActEntry )); + std::unique_ptr xChild(rTreeView.make_iterator( xActEntry.get() )); if ( rTreeView.iter_children(*xChild) ) { RedlineData *pData = reinterpret_cast(rTreeView.get_id(*xChild).toInt64()); diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 80493ebef0f2..679f7efb5ae2 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -887,7 +887,16 @@ void SwTableShell::Execute(SfxRequest &rReq) SwTableAutoFormatTable& rFormats = rSh.GetDoc()->GetTableStyles(); SvxTableAutoFmtDlg aDlg(rFormats, sFormatName, GetView().GetFrameWeld(), true, bRTL); if (aDlg.run() == RET_OK) - rSh.SetTableStyle(*rFormats.GetData(aDlg.GetIndex())); + { + size_t nIndex = aDlg.GetIndex(); + if (nIndex < rFormats.size()) + rSh.SetTableStyle(*rFormats.GetData(nIndex)); + else + { + TableStyleName aNone; + rSh.UpdateTableStyleFormatting(nullptr, false, &aNone); + } + } break; } diff --git a/sw/source/uibase/shells/textidx.cxx b/sw/source/uibase/shells/textidx.cxx index db3d7f76711b..37730582a9cb 100644 --- a/sw/source/uibase/shells/textidx.cxx +++ b/sw/source/uibase/shells/textidx.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/uibase/sidebar/CommentsPanel.cxx b/sw/source/uibase/sidebar/CommentsPanel.cxx index 037af88df97f..11c1d38e1884 100644 --- a/sw/source/uibase/sidebar/CommentsPanel.cxx +++ b/sw/source/uibase/sidebar/CommentsPanel.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/uibase/sidebar/QuickFindPanel.cxx b/sw/source/uibase/sidebar/QuickFindPanel.cxx index dd383f0e3807..d6eadae056bd 100644 --- a/sw/source/uibase/sidebar/QuickFindPanel.cxx +++ b/sw/source/uibase/sidebar/QuickFindPanel.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.cxx b/sw/source/uibase/sidebar/StylePresetsPanel.cxx index 73b762668eb0..b35302196f81 100644 --- a/sw/source/uibase/sidebar/StylePresetsPanel.cxx +++ b/sw/source/uibase/sidebar/StylePresetsPanel.cxx @@ -16,7 +16,8 @@ #include #include #include -#include +#include +#include #include #include @@ -142,13 +143,9 @@ std::unique_ptr StylePresetsPanel::Create(weld::Widget* pParent) StylePresetsPanel::StylePresetsPanel(weld::Widget* pParent) : PanelLayout(pParent, u"StylePresetsPanel"_ustr, u"modules/swriter/ui/sidebarstylepresets.ui"_ustr) - , mxValueSet(new ValueSet(nullptr)) - , mxValueSetWin(new weld::CustomWeld(*m_xBuilder, u"valueset"_ustr, *mxValueSet)) + , m_pIconView(m_xBuilder->weld_icon_view("iconview")) { - mxValueSet->SetColCount(2); - - mxValueSet->SetColor(Application::GetSettings().GetStyleSettings().GetFaceColor()); - mxValueSet->SetDoubleClickHdl(LINK(this, StylePresetsPanel, DoubleClickHdl)); + m_pIconView->connect_item_activated(LINK(this, StylePresetsPanel, ItemActivatedHdl)); RefreshList(); } @@ -167,12 +164,12 @@ void StylePresetsPanel::RefreshList() OUString aName = aTemplates.GetName(i,j); OUString aURL = aTemplates.GetPath(i,j); Bitmap aPreview = CreatePreview(aURL, aName); - sal_uInt16 nId = j + 1; - mxValueSet->InsertItem(nId, Image(aPreview), aName); + m_pIconView->insert(j, nullptr, nullptr, &aPreview, nullptr); + m_pIconView->set_item_accessible_name(j, aName); + m_pIconView->set_item_tooltip_text(j, aName); maTemplateEntries.push_back(std::make_unique(aURL)); - mxValueSet->SetItemData(nId, maTemplateEntries.back().get()); + m_pIconView->set_id(j, weld::toId(maTemplateEntries.back().get())); } - mxValueSet->SetOptimalSize(); } } } @@ -181,10 +178,9 @@ StylePresetsPanel::~StylePresetsPanel() { } -IMPL_LINK_NOARG(StylePresetsPanel, DoubleClickHdl, ValueSet*, void) +IMPL_LINK(StylePresetsPanel, ItemActivatedHdl, const weld::TreeIter&, rIter, bool) { - sal_Int32 nItemId = mxValueSet->GetSelectedItemId(); - TemplateEntry* pEntry = static_cast(mxValueSet->GetItemData(nItemId)); + TemplateEntry* pEntry = weld::fromId(m_pIconView->get_id(rIter)); if (SwDocShell* pDocSh = static_cast(SfxObjectShell::Current())) { @@ -193,6 +189,8 @@ IMPL_LINK_NOARG(StylePresetsPanel, DoubleClickHdl, ValueSet*, void) aOption.SetNumRules(true); pDocSh->LoadStylesFromFile(pEntry->maURL, aOption, false); } + + return true; } void StylePresetsPanel::NotifyItemUpdate(const sal_uInt16 /*nSId*/, diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.hxx b/sw/source/uibase/sidebar/StylePresetsPanel.hxx index f91268886332..fe467aea6a6a 100644 --- a/sw/source/uibase/sidebar/StylePresetsPanel.hxx +++ b/sw/source/uibase/sidebar/StylePresetsPanel.hxx @@ -10,11 +10,11 @@ #pragma once -#include - #include #include -#include +#include + +#include #include namespace sw::sidebar { @@ -49,12 +49,11 @@ private: void RefreshList(); - std::unique_ptr mxValueSet; - std::unique_ptr mxValueSetWin; + std::unique_ptr m_pIconView; std::vector> maTemplateEntries; - DECL_LINK(DoubleClickHdl, ValueSet*, void); + DECL_LINK(ItemActivatedHdl, const weld::TreeIter&, bool); }; } // end of namespace sw::sidebar diff --git a/sw/source/uibase/table/chartins.cxx b/sw/source/uibase/table/chartins.cxx index 99b8680a06af..616553c30b2a 100644 --- a/sw/source/uibase/table/chartins.cxx +++ b/sw/source/uibase/table/chartins.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index e47240961083..0960afb67a8f 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index ece2d5b7a6e6..90ad11c83464 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -140,6 +140,7 @@ #include #include +#include #include #include @@ -4277,7 +4278,7 @@ uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages( SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner(); if(pOutliner) { - EditEngine& rEditEng = const_cast(pOutliner->GetEditEngine()); + EditEngine& rEditEng = pOutliner->GetEditEngine(); sal_Int32 nParCount = pOutliner->GetParagraphCount(); for (sal_Int32 nPar=0; nPar #include #include +#include #include #include #include diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 4d33e4f5b76e..0d826cd59411 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -65,6 +65,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 1945f356f471..28d7aa6b1776 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -155,6 +155,38 @@ void collectUIInformation(const OUString& rAction, const OUString& aParameters) sal_uInt32 MakeAllOutlineContentTemporarilyVisible::nLock = 0; +MakeAllOutlineContentTemporarilyVisible::MakeAllOutlineContentTemporarilyVisible(SwDoc* pDoc, bool bScrollToCursor) +{ + ++nLock; + if (nLock > 1) + return; + if (SwDocShell* pDocSh = pDoc->GetDocShell()) + if ((m_pWrtSh = pDocSh->GetWrtShell()) && m_pWrtSh->GetViewOptions() && + m_pWrtSh->GetViewOptions()->IsShowOutlineContentVisibilityButton()) + { + m_pWrtSh->LockView(true); + m_pWrtSh->LockPaint(LockPaintReason::OutlineFolding); + m_pWrtSh->MakeAllFoldedOutlineContentVisible(); + m_bScrollToCursor = bScrollToCursor; + m_bDone = true; + } +} + +MakeAllOutlineContentTemporarilyVisible::~MakeAllOutlineContentTemporarilyVisible() COVERITY_NOEXCEPT_FALSE +{ + --nLock; + if (nLock > 0) + return; + if (m_bDone && m_pWrtSh) + { + m_pWrtSh->MakeAllFoldedOutlineContentVisible(false); + m_pWrtSh->UnlockPaint(); + m_pWrtSh->LockView(false); + if (m_bScrollToCursor) + m_pWrtSh->UpdateCursor(SwCursorShell::SCROLLWIN); + } +} + static bool lcl_IsAllowed(const SwWrtShell* rSh) { if (rSh->GetViewOptions()->IsShowOutlineContentVisibilityButton() && rSh->IsEndPara()) diff --git a/sw/source/writerfilter/dmapper/BorderHandler.cxx b/sw/source/writerfilter/dmapper/BorderHandler.cxx index 371f4ae4ed8a..f9d8eae9c0b2 100644 --- a/sw/source/writerfilter/dmapper/BorderHandler.cxx +++ b/sw/source/writerfilter/dmapper/BorderHandler.cxx @@ -21,6 +21,7 @@ #include "PropertyMap.hxx" #include "ConversionHelper.hxx" #include +#include #include #include #include @@ -57,7 +58,8 @@ void BorderHandler::lcl_attribute(Id rName, const Value & rVal) { case NS_ooxml::LN_CT_Border_sz: // width of a single line in 1/8 pt, max of 32 pt -> twip * 5 / 2. - m_nLineWidth = nIntValue * 5 / 2; + m_nLineWidth = std::clamp(sal_Int64(nIntValue) * 5 / 2, SAL_MIN_INT32, + SAL_MAX_INT32); appendGrabBag(u"sz"_ustr, OUString::number(nIntValue)); break; case NS_ooxml::LN_CT_Border_val: diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx index 11a4646e1f7c..0a09997434a3 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -3844,9 +3844,21 @@ void DomainMapper_Impl::appendStarMath( const Value& val ) uno::Any(sal_Int32(0))); xComponentProperties->setPropertyValue(getPropertyName( PROP_BOTTOM_MARGIN ), uno::Any(sal_Int32(0))); + + auto* pFormula = dynamic_cast(xInterface.get()); + // A formula whose own markup carries no font size is drawn at the size of the text + // around it, which the styles and the document defaults hold. + double fCharHeight = 0; + if (pFormula && pFormula->getFormulaFontSizeInHalfPoints() == 0 + && (GetAnyProperty(PROP_CHAR_HEIGHT, GetTopContextOfType(CONTEXT_CHARACTER)) + >>= fCharHeight)) + { + pFormula->setFormulaFontSizeInHalfPoints(std::lround(fCharHeight * 2)); + } + Size size( 1000, 1000 ); - if( oox::FormulaImExportBase* formulaimport = dynamic_cast< oox::FormulaImExportBase* >( xInterface.get())) - size = formulaimport->getFormulaSize(); + if( pFormula ) + size = pFormula->getFormulaSize(); xStarMath->setPropertyValue(getPropertyName( PROP_WIDTH ), uno::Any( sal_Int32(size.Width()))); xStarMath->setPropertyValue(getPropertyName( PROP_HEIGHT ), @@ -7505,7 +7517,7 @@ void DomainMapper_Impl::handleToc OUString sFigureSequence; OUString aBookmarkName; -// \a Builds a table of figures but does not include the captions's label and number +// \a Builds a table of figures but does not include the captions' label and number if( lcl_FindInCommand( pContext->GetCommand(), 'a', sValue )) { //make it a table of figures bTableOfFigures = true; diff --git a/sw/source/writerfilter/dmapper/GraphicHelpers.cxx b/sw/source/writerfilter/dmapper/GraphicHelpers.cxx index 7ba57f9b778a..76b0bc5820ff 100644 --- a/sw/source/writerfilter/dmapper/GraphicHelpers.cxx +++ b/sw/source/writerfilter/dmapper/GraphicHelpers.cxx @@ -356,19 +356,10 @@ sal_Int32 GraphicZOrderHelper::findZOrder(sal_Int64 relativeHeight, bool bOldSty --it; itemZOrderOffset = 1; // after the topmost - // Check if this shape has a textbox. If so, the textbox will have its own ZOrder, so - // suggest a larger offset. - bool bTextBox = false; - uno::Reference xShape = it->second; - uno::Reference xInfo = xShape->getPropertySetInfo(); - if (xInfo->hasPropertyByName(u"TextBox"_ustr)) - { - xShape->getPropertyValue(u"TextBox"_ustr) >>= bTextBox; - } - if (bTextBox) - { - ++itemZOrderOffset; - } + // The z-order read below is the one SwXShape reports, which counts the shapes only: + // SwTextBoxHelper::getOrdNum() leaves the text frame of a shape with a text box out of it. + // So a shape and its text box take one place here, not two, and the offset above + // already puts this shape after both of them. } // SwXFrame::getPropertyValue throws uno::RuntimeException // when its GetFrameFormat() returns nullptr diff --git a/sw/source/writerfilter/dmapper/PropertyIds.hxx b/sw/source/writerfilter/dmapper/PropertyIds.hxx index 05c79e3cb391..448b81d3520c 100644 --- a/sw/source/writerfilter/dmapper/PropertyIds.hxx +++ b/sw/source/writerfilter/dmapper/PropertyIds.hxx @@ -22,6 +22,7 @@ namespace writerfilter::dmapper{ // Ensure that Character Properties are placed between PROP_CHARACTER_STYLES and PROP_CHARACTER_END +// Ensure that Paragraph Properties are placed between PROP_PARA_ADJUST and PROP_PARA_WIDOWS enum PropertyIds { INVALID = 0 @@ -250,6 +251,7 @@ enum PropertyIds ,PROP_PARAGRAPH_STYLES ,PROP_PARA_ADJUST ,PROP_PARA_BOTTOM_MARGIN + ,PROP_PARA_CONTEXT_MARGIN ,PROP_PARA_FIRST_LINE_INDENT ,PROP_PARA_FIRST_LINE_INDENT_UNIT ,PROP_PARA_IS_HANGING_PUNCTUATION @@ -356,7 +358,6 @@ enum PropertyIds ,PROP_WRITING_MODE ,PROP_FRM_DIRECTION ,PROP_EMBEDDED_OBJECT - ,PROP_PARA_CONTEXT_MARGIN ,PROP_PAGE_STYLE_LAYOUT ,PROP_Z_ORDER ,PROP_EMBED_FONTS diff --git a/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx b/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx index a61fcaa2caa5..6c18c4b867e3 100644 --- a/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx +++ b/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx @@ -2492,9 +2492,18 @@ void OOXMLFastContextHandlerLinear::lcl_endFastElement(Token_t Element) } uno::Reference< xml::sax::XFastContextHandler > -OOXMLFastContextHandlerLinear::lcl_createFastChildContext(Token_t, - const uno::Reference< xml::sax::XFastAttributeList >&) +OOXMLFastContextHandlerLinear::lcl_createFastChildContext(Token_t Element, + const uno::Reference< xml::sax::XFastAttributeList >& Attribs) { + // tdf#170236: buffering a w:commentReference would feed it to Starmath, which + // drops it; capture the id instead and resolve it after the formula (process()). + if (Element == W_TOKEN(commentReference)) + { + if (Attribs && Attribs->hasAttribute(W_TOKEN(id))) + m_aCommentIds.push_back(Attribs->getValue(W_TOKEN(id)).toInt32()); + return nullptr; + } + uno::Reference< xml::sax::XFastContextHandler > xContextHandler; xContextHandler.set( this ); return xContextHandler; @@ -2556,6 +2565,10 @@ void OOXMLFastContextHandlerMath::process() else pProps->add(NS_ooxml::LN_starmath, pVal, OOXMLProperty::ATTRIBUTE); mpStream->props( pProps.get() ); + + // tdf#170236: resolve now, so the anchor lands right after the emitted formula + for (sal_Int32 nCommentId : m_aCommentIds) + resolveComment(nCommentId); } OOXMLFastContextHandlerCommentEx::OOXMLFastContextHandlerCommentEx( diff --git a/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.hxx b/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.hxx index 34bd89693c91..7f1976c82ce8 100644 --- a/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.hxx +++ b/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.hxx @@ -20,6 +20,7 @@ #pragma once #include +#include #include #include #include @@ -596,6 +597,9 @@ protected: // should be private, but not much point in making deep copies of it oox::formulaimport::XmlStreamBuilder m_buffer; + // tdf#170236: comment ids referenced inside the formula, resolved in Math::process() + std::vector m_aCommentIds; + private: int m_depthCount; }; diff --git a/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx b/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx index 8a34962da790..e82ec722ee93 100644 --- a/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx +++ b/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx @@ -142,6 +142,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) pCurrentBuffer->begin(), pCurrentBuffer->end(), [](auto const& it) { return ::std::get<0>(it) == RTFBufferTypes::PAR + || ::std::get<0>(it) == RTFBufferTypes::CellEnd || (::std::get<0>(it) == RTFBufferTypes::Props && ::std::get<1>(it)->getSprms().find( NS_ooxml::LN_inTbl) diff --git a/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx b/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx index b677d68efb5d..c990b14097d7 100644 --- a/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx +++ b/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx @@ -263,6 +263,15 @@ bool RTFDocumentImpl::dispatchCharacterAttributeValue(RTFKeyword nKeyword, int n bool RTFDocumentImpl::dispatchParagraphSprmValue(RTFKeyword nKeyword, int nParam) { + // far deeper table nesting than any real document uses + constexpr int nMaxTableDepth = 1024; + if (nKeyword == RTFKeyword::ITAP && nParam > nMaxTableDepth) + { + SAL_WARN("writerfilter.rtf", + "table nesting depth " << nParam << " limited to " << nMaxTableDepth); + nParam = nMaxTableDepth; + } + int nSprm = 0; tools::SvRef pIntValue(new RTFValue(nParam)); @@ -1022,7 +1031,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) if (nParam == 2) nParam = 1; else if (nParam > 1) - nParam = nParam * 2 / 5; + nParam = sal_Int64(nParam) * 2 / 5; auto pValue = new RTFValue(nParam); putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_sz, pValue); } diff --git a/sw/uiconfig/swriter/ui/mailmerge.ui b/sw/uiconfig/swriter/ui/mailmerge.ui index 3f0869decb3c..10683a638d30 100644 --- a/sw/uiconfig/swriter/ui/mailmerge.ui +++ b/sw/uiconfig/swriter/ui/mailmerge.ui @@ -107,7 +107,7 @@ True False True - True + False 12 @@ -826,7 +826,7 @@ - True + False True 1 diff --git a/sw/uiconfig/swriter/ui/sidebarstylepresets.ui b/sw/uiconfig/swriter/ui/sidebarstylepresets.ui index f0b1c4ad3f6d..610d283af30e 100644 --- a/sw/uiconfig/swriter/ui/sidebarstylepresets.ui +++ b/sw/uiconfig/swriter/ui/sidebarstylepresets.ui @@ -2,6 +2,16 @@ + + + + + + + + + + True @@ -25,18 +35,16 @@ never in - + True - False - - - True - True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK - True - True - - + True + 6 + True + True + iconview_model + 2 + 0 + 2 diff --git a/test/source/sheet/databaserange.cxx b/test/source/sheet/databaserange.cxx index ac7d6a38a5a8..92f8a144d359 100644 --- a/test/source/sheet/databaserange.cxx +++ b/test/source/sheet/databaserange.cxx @@ -214,6 +214,17 @@ void DatabaseRange::testContainsHeader() CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bContainsHeader); CPPUNIT_ASSERT_MESSAGE("Value of ContainsHeader wasn't changed", !bContainsHeader); } + +void DatabaseRange::testTdf170842_TableStylePropertiesPlainRange() +{ + uno::Reference xDatabaseRange(init(u"DataArea"_ustr), UNO_QUERY_THROW); + + // Without the fix in place, this test would have crashed here + xDatabaseRange->getPropertyValue(u"UseRowStripes"_ustr); + xDatabaseRange->getPropertyValue(u"UseColStripes"_ustr); + xDatabaseRange->getPropertyValue(u"UseFirstColumnFormatting"_ustr); + xDatabaseRange->getPropertyValue(u"UseLastColumnFormatting"_ustr); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/toolkit/source/controls/tree/treecontrolpeer.cxx b/toolkit/source/controls/tree/treecontrolpeer.cxx index bd6e97129156..56505b1f53ab 100644 --- a/toolkit/source/controls/tree/treecontrolpeer.cxx +++ b/toolkit/source/controls/tree/treecontrolpeer.cxx @@ -122,8 +122,9 @@ public: void SetImage( const Image& rImage ); const OUString& GetGraphicURL() const { return maGraphicURL;} void SetGraphicURL( const OUString& rGraphicURL ); - virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override; + virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, + const SvTreeListEntry& rEntry) override; std::unique_ptr Clone( SvLBoxItem const * pSource ) const override; private: @@ -1467,8 +1468,9 @@ UnoTreeListItem::UnoTreeListItem() { } -void UnoTreeListItem::Paint( - const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) +void UnoTreeListItem::Paint(const Point& rPos, SvTreeListBox& rDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& /*rView*/, + const SvTreeListEntry& rEntry) { Point aPos(rPos); Size aSize(GetWidth(rDev, rEntry), GetHeight(rDev, rEntry)); diff --git a/tools/qa/cppunit/test_zcodec.cxx b/tools/qa/cppunit/test_zcodec.cxx index 935a234d4ff5..d0ad06ae6dc3 100644 --- a/tools/qa/cppunit/test_zcodec.cxx +++ b/tools/qa/cppunit/test_zcodec.cxx @@ -31,11 +31,13 @@ private: void testGzCompressDecompress(); void testMakeDummyFile(); void testZlibCompressDecompress(); + void testSmallOutputBuffer(); CPPUNIT_TEST_SUITE(ZCodecTest); CPPUNIT_TEST(testMakeDummyFile); CPPUNIT_TEST(testGzCompressDecompress); CPPUNIT_TEST(testZlibCompressDecompress); + CPPUNIT_TEST(testSmallOutputBuffer); CPPUNIT_TEST_SUITE_END(); }; @@ -116,6 +118,37 @@ void ZCodecTest::testZlibCompressDecompress() CPPUNIT_ASSERT_EQUAL(nInitialStreamCRC32, nCompressedDecompressedStreamCRC32); } +// Test that nothing is dropped when deflate runs out of output part way through a chunk of +// input. A small output buffer makes that happen on almost every call. +void ZCodecTest::testSmallOutputBuffer() +{ + SvMemoryStream aInitialStream; + sal_uInt32 nSeed = 1; + for (sal_uInt32 i = 0; i < 100000; ++i) + { + nSeed = nSeed * 1103515245 + 12345; + const sal_uInt8 nByte(nSeed >> 24); + aInitialStream.WriteBytes(&nByte, 1); + } + const sal_uInt64 nInitialSize = aInitialStream.GetSize(); + const auto nInitialCRC32 = rtl_crc32(0, aInitialStream.GetData(), nInitialSize); + + SvMemoryStream aCompressedStream; + SvMemoryStream aDecompressedStream; + ZCodec aCodec(0x4000, 64); + aCodec.BeginCompression(); + aCodec.Compress(aInitialStream, aCompressedStream); + // EndCompression answers with the bytes deflate took, which has to be all of them + CPPUNIT_ASSERT_EQUAL(static_cast(nInitialSize), aCodec.EndCompression()); + + aCompressedStream.Seek(0); + aCodec.BeginCompression(); + aCodec.Decompress(aCompressedStream, aDecompressedStream); + CPPUNIT_ASSERT_EQUAL(static_cast(nInitialSize), aCodec.EndCompression()); + CPPUNIT_ASSERT_EQUAL( + nInitialCRC32, rtl_crc32(0, aDecompressedStream.GetData(), aDecompressedStream.GetSize())); +} + } // namespace CPPUNIT_TEST_SUITE_REGISTRATION(ZCodecTest); diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index 2d6e1ed32e07..bbb16c13d1df 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -168,12 +168,17 @@ void ZCodec::Compress( SvStream& rIStm, SvStream& rOStm ) pStream->avail_in = rIStm.ReadBytes( mpInBuf.get(), mnInBufSize ); if (pStream->avail_in == 0) break; - if ( pStream->avail_out == 0 ) - ImplWriteBack(); - if ( deflate( pStream, Z_NO_FLUSH ) < 0 ) + // deflate stops as soon as the output buffer is full, so offer the rest of the chunk + // again once it has been written back, rather than reading over it + while (pStream->avail_in != 0) { - mbStatus = false; - break; + if (pStream->avail_out == 0) + ImplWriteBack(); + if (deflate(pStream, Z_NO_FLUSH) < 0) + { + mbStatus = false; + return; + } } }; } diff --git a/translations b/translations index 6f2222cc49bd..eb0ac524bb99 160000 --- a/translations +++ b/translations @@ -1 +1 @@ -Subproject commit 6f2222cc49bd201e38cbb2db14e04ec575b98ae4 +Subproject commit eb0ac524bb996151fdbc4e78ec1f28effbc0c5b9 diff --git a/uitest/uitest/uihelper/chart.py b/uitest/uitest/uihelper/chart.py index 27962f5001b7..6d8f0bed0151 100644 --- a/uitest/uitest/uihelper/chart.py +++ b/uitest/uitest/uihelper/chart.py @@ -1,8 +1,6 @@ # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- # -# Copyright the LibreOffice contributors. -# -# SPDX-License-Identifier: MPL-2.0 +# This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/unoxml/source/dom/domimplementation.cxx b/unoxml/source/dom/domimplementation.cxx index 0bd7e5940ac6..c9e5cade0338 100644 --- a/unoxml/source/dom/domimplementation.cxx +++ b/unoxml/source/dom/domimplementation.cxx @@ -33,7 +33,7 @@ namespace DOM // perhaps it would be helpful to know what the implementation should // do to answer this question... static rtl::Reference xDOMImplementation = new CDOMImplementation; - return &*xDOMImplementation; + return xDOMImplementation.get(); } // there is just 1 static instance, so these must not delete it! diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index c4f91f01044a..0ed0b2d7bc4e 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -419,7 +419,7 @@ uno::Any SAL_CALL VbaApplicationBase::getVBE() try // return empty object on error { // "VBE" object does not have a parent, but pass document model to be able to determine application type - uno::Sequence< uno::Any > aArgs{ uno::Any(getCurrentDocument()) }; + uno::Sequence< uno::Any > aArgs{ uno::Any(uno::Reference(getCurrentDocument())) }; uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW ); uno::Reference< uno::XInterface > xVBE = xServiceManager->createInstanceWithArgumentsAndContext( u"ooo.vba.vbide.VBE"_ustr , aArgs, mxContext ); diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index 7db25a6bbba5..6665378e5b40 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -290,7 +290,7 @@ VbaDocumentBase::getVBProject() if (xVBE) { uno::Sequence< uno::Any > aArgs{ uno::Any(xVBE), // the VBE - uno::Any(getModel()) }; // document model for script container access + uno::Any(uno::Reference(getModel())) }; // document model for script container access uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager() ); if (xServiceManager) mxVBProject = xServiceManager->createInstanceWithArgumentsAndContext( diff --git a/vcl/inc/SvLBoxButton.hxx b/vcl/inc/SvLBoxButton.hxx index a6bc44a38758..1cff4a12bbea 100644 --- a/vcl/inc/SvLBoxButton.hxx +++ b/vcl/inc/SvLBoxButton.hxx @@ -81,7 +81,7 @@ public: void ClickHdl(SvTreeListEntry*); virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, - vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, const SvTreeListEntry& rEntry) override; virtual std::unique_ptr Clone(SvLBoxItem const* pSource) const override; diff --git a/vcl/inc/colorpicker.hxx b/vcl/inc/colorpicker.hxx index 8f9cdb40cfdb..a7a7b0b53d69 100644 --- a/vcl/inc/colorpicker.hxx +++ b/vcl/inc/colorpicker.hxx @@ -152,15 +152,19 @@ public: double GetValue() const { return mdValue; } void SetModifyHdl(const Link& rLink) { maModifyHdl = rLink; } + void SetResizeHdl(const Link& rLink) { maResizeHdl = rLink; } - sal_Int16 GetLevel() const { return mnLevel; } + sal_Int16 GetLevel() const + { + return static_cast((1.0 - mdValue) * GetOutputSizePixel().Height()); + } private: Link maModifyHdl; + Link maResizeHdl; Color maColor; ColorMode meMode; VclPtr mxBitmap; - sal_Int16 mnLevel; double mdValue; }; @@ -221,6 +225,7 @@ private: DECL_LINK(ColorFieldControlModifydl, ColorFieldControl&, void); DECL_LINK(ColorSliderControlModifyHdl, ColorSliderControl&, void); + DECL_LINK(ColorSliderResizeHdl, ColorSliderControl&, void); DECL_LINK(ColorModifyMetricHdl, weld::MetricSpinButton&, void); DECL_LINK(ColorModifySpinHdl, weld::SpinButton&, void); DECL_LINK(ColorModifyEditHdl, weld::Entry&, void); diff --git a/vcl/inc/implimagetree.hxx b/vcl/inc/implimagetree.hxx index 261a62938121..72346180060e 100644 --- a/vcl/inc/implimagetree.hxx +++ b/vcl/inc/implimagetree.hxx @@ -129,6 +129,8 @@ private: /// Style used for the current operations; switches switch several times during fallback search. OUString maCurrentStyle; + bool mbPreferDark; + IconSet& getCurrentIconSet() { return maIconSets[maCurrentStyle]; @@ -162,7 +164,7 @@ private: Must not be cyclic :-) The last theme in the chain returns an empty string. */ - static OUString fallbackStyle(std::u16string_view rStyle); + OUString fallbackStyle(std::u16string_view rStyle); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index a4ce2a820c68..693ae7d0de5a 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -667,6 +667,29 @@ struct StreamRedirect ResourceDict m_aResourceDict; }; +/** Where the cross-reference has to point to reach an object. + + ISO 32000-2 7.5.8.3 Table 18 calls these the type 1 and type 2 entries: an object written + into the file has a byte offset, one written into an object stream names that stream and its + index in it. + */ +struct ObjectLocation +{ + sal_uInt64 m_nOffset = SAL_MAX_UINT64; + /// the object stream holding it, 0 when the object stands in the file + sal_Int32 m_nObjectStream = 0; + sal_Int32 m_nIndex = 0; + + bool isCompressed() const { return m_nObjectStream != 0; } +}; + +/// An object built but not yet written, held until its object stream is full. +struct PendingObject +{ + sal_Int32 m_nObject; + OString m_aBody; +}; + // graphics state struct GraphicsState { @@ -738,8 +761,10 @@ private: MapMode m_aMapMode; // PDFWriterImpl scaled units StyleSettings m_aWidgetStyleSettings; std::vector< PDFPage > m_aPages; - /* maps object numbers to file offsets (needed for xref) */ - std::vector< sal_uInt64 > m_aObjects; + /* maps object numbers to where they were written (needed for xref) */ + std::vector m_aObjects; + /* objects waiting to be flushed into an object stream, with their numbers */ + std::vector m_aCompressedObjects; /* contains Bitmaps until they are written to the * file stream as XObjects*/ std::list< BitmapEmit > m_aBitmaps; @@ -832,7 +857,7 @@ private: AlphaMask m_aAlphaMask; }; - /// Cache some most recent bitmaps we've exported, in case we encounter them again.. + /// Cache some most recent bitmaps we've exported, in case we encounter them again. o3tl::lru_map> m_aPDFBmpCache; sal_Int32 m_nCurrentPage; @@ -1067,6 +1092,23 @@ private: sal_Int32 emitEncrypt(); // writes xref and trailer bool emitTrailer(); + /// whether this file may carry object streams and a cross-reference stream + bool useObjectStreams() const; + /// what encrypts a string as an object is built, and nothing for an object bound for a stream + std::shared_ptr getStringEncryptor(sal_Int32 nObject); +#ifndef NDEBUG + /// objects whose strings went in plain, checked once the last object stream is flushed + std::unordered_set m_aPlainStringObjects; +#endif + /// writes a whole object, into an object stream where the file may have one; a body + /// holding strings takes its encryptor from getStringEncryptor + bool writeObject(sal_Int32 nObject, std::string_view aBody); + /// writes an object's body into the pending object stream rather than into the file + bool writeCompressedObject(sal_Int32 nObject, std::string_view aBody); + /// flushes the objects waiting in m_aCompressedObjects as one /Type/ObjStm + bool emitObjectStream(); + /// writes the cross-reference as a stream, the only form that can reach an object stream + bool emitXRefStream(std::string_view aTrailerEntries); // emits info dict (if applicable) sal_Int32 emitInfoDict( ); diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx index 3db74784fc2b..6d60f4321e38 100644 --- a/vcl/inc/printdlg.hxx +++ b/vcl/inc/printdlg.hxx @@ -224,6 +224,9 @@ namespace vcl Idle maUpdatePreviewIdle; DECL_LINK(updatePreviewIdle, Timer*, void); + Timer maPageRangeUpdateTimer; + DECL_LINK(PageRangeUpdateTimerHdl, Timer*, void); + DECL_LINK(ClickOKCancelHdl, weld::Button&, void); DECL_LINK(ClickForwardHdl, weld::Button&, void); DECL_LINK(ClickBackwardHdl, weld::Button&, void); diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx index c728701322b6..0690b214801d 100644 --- a/vcl/inc/qt5/QtGraphics.hxx +++ b/vcl/inc/qt5/QtGraphics.hxx @@ -47,7 +47,6 @@ class QtGraphicsBackend final : public SalGraphicsImpl, public QtGraphicsBase { friend class QtPainter; - QtFrame* m_pFrame; QImage* m_pQImage; QRegion m_aClipRegion; QPainterPath m_aClipPath; @@ -153,8 +152,6 @@ class QtGraphics final : public SalGraphicsAutoDelegateToImpl, public QtGraphics std::unique_ptr m_pBackend; - QtFrame* m_pFrame; - rtl::Reference m_pTextStyle[MAX_FALLBACK]; Color m_aTextColor; diff --git a/vcl/inc/qt5/QtGraphicsBase.hxx b/vcl/inc/qt5/QtGraphicsBase.hxx index 393644d45af0..e6b1904f618c 100644 --- a/vcl/inc/qt5/QtGraphicsBase.hxx +++ b/vcl/inc/qt5/QtGraphicsBase.hxx @@ -20,11 +20,13 @@ class QtGraphicsBase { + QtFrame* const m_pFrame; qreal m_fDPR; public: - QtGraphicsBase() - : m_fDPR(qApp ? GetQtInstance().EmscriptenLightweightRunInMainThread( + QtGraphicsBase(QtFrame* pFrame) + : m_pFrame(pFrame) + , m_fDPR(qApp ? GetQtInstance().EmscriptenLightweightRunInMainThread( [] { return qApp->devicePixelRatio(); }) : 1.0) { @@ -35,7 +37,8 @@ public: qreal devicePixelRatioF() const { return m_fDPR; } protected: - static void ImplGetResolution(const QtFrame* pFrame, sal_Int32& rDPIX, sal_Int32& rDPIY); + QtFrame* GetFrame() const { return m_pFrame; } + void ImplGetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/qt5/QtPainter.hxx b/vcl/inc/qt5/QtPainter.hxx index 51a251d06875..518a7d69c2dd 100644 --- a/vcl/inc/qt5/QtPainter.hxx +++ b/vcl/inc/qt5/QtPainter.hxx @@ -39,32 +39,32 @@ public: sal_uInt8 nTransparency = 255); ~QtPainter() { - if (m_rGraphics.m_pFrame && !m_aRegion.isEmpty()) - m_rGraphics.m_pFrame->GetQWidget().update(m_aRegion); + if (m_rGraphics.GetFrame() && !m_aRegion.isEmpty()) + m_rGraphics.GetFrame()->GetQWidget().update(m_aRegion); } void update(int nx, int ny, int nw, int nh) { - if (m_rGraphics.m_pFrame) + if (m_rGraphics.GetFrame()) m_aRegion += scaledQRect({ nx, ny, nw, nh }, 1 / m_rGraphics.devicePixelRatioF()); } void update(const QRect& rRect) { - if (m_rGraphics.m_pFrame) + if (m_rGraphics.GetFrame()) m_aRegion += scaledQRect(rRect, 1 / m_rGraphics.devicePixelRatioF()); } void update(const QRectF& rRectF) { - if (m_rGraphics.m_pFrame) + if (m_rGraphics.GetFrame()) update(scaledQRect(rRectF.toAlignedRect(), 1 / m_rGraphics.devicePixelRatioF())); } void update() { - if (m_rGraphics.m_pFrame) - m_aRegion += m_rGraphics.m_pFrame->GetQWidget().rect(); + if (m_rGraphics.GetFrame()) + m_aRegion += m_rGraphics.GetFrame()->GetQWidget().rect(); } }; diff --git a/vcl/inc/qt5/QtSvpGraphics.hxx b/vcl/inc/qt5/QtSvpGraphics.hxx index 0e4455d2dfc6..e2455f805505 100644 --- a/vcl/inc/qt5/QtSvpGraphics.hxx +++ b/vcl/inc/qt5/QtSvpGraphics.hxx @@ -30,8 +30,6 @@ class QtFrame; class VCLPLUG_QT_PUBLIC QtSvpGraphics final : public SvpSalGraphics, public QtGraphicsBase { - QtFrame* const m_pFrame; - void handleDamage(const tools::Rectangle&) override; public: diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index b4c3ca6f1c2d..ab43554e4009 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -1359,6 +1359,25 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testColorChangeToTransparent) rBitmapAfter.GetPixelColor(410, 140)); } +CPPUNIT_TEST_FIXTURE(GraphicTest, testSwappedOutGraphicKeepsSizeAfterThreadedLoad) +{ + // Given a PNG graphic that was loaded once and then swapped out: + Graphic aGraphic = makeUnloadedGraphic(u"png"); + CPPUNIT_ASSERT(aGraphic.makeAvailable()); + CPPUNIT_ASSERT(aGraphic.ImplGetImpGraphic()->swapOut()); + + // When it is loaded again by the threaded loader and swapped out once more: + std::vector aGraphics{ &aGraphic }; + GraphicFilter::GetGraphicFilter().MakeGraphicsAvailableThreaded(aGraphics); + CPPUNIT_ASSERT(aGraphic.isAvailable()); + CPPUNIT_ASSERT(aGraphic.ImplGetImpGraphic()->swapOut()); + + // Then it still reports its size, so it does not look like an empty graphic. + // Without the fix in place, this test would have failed, the graphic reported a size of 0 + // bytes. + CPPUNIT_ASSERT(aGraphic.GetSizeBytes() > 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qa/cppunit/PDFiumLibraryTest.cxx b/vcl/qa/cppunit/PDFiumLibraryTest.cxx index 1bd2d3b1cd8a..2b84aa4bc49b 100644 --- a/vcl/qa/cppunit/PDFiumLibraryTest.cxx +++ b/vcl/qa/cppunit/PDFiumLibraryTest.cxx @@ -515,6 +515,12 @@ CPPUNIT_TEST_FIXTURE(PDFiumLibraryTest, testStructureTree) auto pPage = pDocument->openPage(0); CPPUNIT_ASSERT(pPage); + // the page object side of the marked content ids the structure tree references + bool bFoundFirstMark = false; + for (int i = 0; !bFoundFirstMark && i < pPage->getObjectCount(); ++i) + bFoundFirstMark = pPage->getObject(i)->getMarkedContentID() == 0; + CPPUNIT_ASSERT(bFoundFirstMark); + auto pTree = pPage->getStructureTree(); CPPUNIT_ASSERT(pTree); CPPUNIT_ASSERT_EQUAL(1, pTree->getNumberOfChildren()); diff --git a/vcl/qa/cppunit/pdfexport/PDFEncryptionTest.cxx b/vcl/qa/cppunit/pdfexport/PDFEncryptionTest.cxx index b59cfe80feb0..ec6111ca93b9 100644 --- a/vcl/qa/cppunit/pdfexport/PDFEncryptionTest.cxx +++ b/vcl/qa/cppunit/pdfexport/PDFEncryptionTest.cxx @@ -12,16 +12,21 @@ #include #include +#include #include #include #include +#include #include #include #include #include +#include +#include +#include #include #include @@ -88,6 +93,80 @@ CPPUNIT_TEST_FIXTURE(PDFEncryptionTest, testEncryptionRoundtrip_PDF_1_7) CPPUNIT_ASSERT_EQUAL(17, nFileVersion); } +// encryption used to cost a tagged file its object streams, and so most of its size +CPPUNIT_TEST_FIXTURE(PDFEncryptionTest, testEncryptedTaggedUsesObjectStreams) +{ + loadFromURL(u"private:factory/swriter"_ustr); + auto xText = mxComponent.queryThrow()->getText(); + xText->setString(u"Some tagged text"_ustr); + // a footnote, because its element is the one this writer gives an /ID to + auto xFactory = mxComponent.queryThrow(); + auto xFootnote = xFactory->createInstance(u"com.sun.star.text.Footnote"_ustr) + .queryThrow(); + xText->insertTextContent(xText->getEnd(), xFootnote, false); + xFootnote.queryThrow()->setString(u"The note this refers to"_ustr); + + uno::Sequence aFilterData{ comphelper::makePropertyValue(u"UseTaggedPDF"_ustr, true), + comphelper::makePropertyValue(u"EncryptFile"_ustr, true), + comphelper::makePropertyValue(u"DocumentOpenPassword"_ustr, + u"secret"_ustr) }; + mxComponent.queryThrow()->storeToURL( + maTempFile.GetURL(), + { comphelper::makePropertyValue(u"FilterName"_ustr, u"writer_pdf_Export"_ustr), + comphelper::makePropertyValue(u"FilterData"_ustr, aFilterData) }); + + std::unique_ptr pPdfDocument + = parsePDFExport(vcl::pdf::PDFiumLibrary::get(), "secret"_ostr); + + // the structure tree went into object streams, which is what the encryption used to cost. + // Only strings and stream data are encrypted, so the stream's own dictionary reads plainly + const std::string_view aFile(static_cast(maMemory.GetData()), maMemory.GetSize()); + // an unencrypted export has object streams anyway, so the rest tests nothing without this + CPPUNIT_ASSERT(aFile.find("/Encrypt") != std::string_view::npos); + // the dictionary entry, not a chance match in binary data + const size_t nObjStm = aFile.find("/Type/ObjStm"); + CPPUNIT_ASSERT(nObjStm != std::string_view::npos); + + // /Length has to count what the cipher adds, or a reader that trusts it stops mid-block. + // pdfium does not: it scans for endstream, so only the byte count catches this + // the writer puts exactly one newline here, and the cipher's own first byte may be another + const size_t nData = aFile.find(">>\nstream\n", nObjStm); + CPPUNIT_ASSERT(nData != std::string_view::npos); + const size_t nLength = aFile.find("/Length ", nObjStm); + CPPUNIT_ASSERT(nLength != std::string_view::npos); + // inside this dictionary, so it is this stream's length and not a later object's + CPPUNIT_ASSERT_LESS(nData, nLength); + const sal_Int32 nDeclared = o3tl::toInt32(aFile.substr(nLength + 8, 12)); + CPPUNIT_ASSERT(nData + 10 + nDeclared + 10 <= aFile.size()); + CPPUNIT_ASSERT_EQUAL("\nendstream"_ostr, OString(aFile.substr(nData + 10 + nDeclared, 10))); + + // reading the footnote element's /ID back through the password distinguishes a plain + // string from one encrypted a second time + CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount()); + auto pPage = pPdfDocument->openPage(0); + CPPUNIT_ASSERT(pPage); + auto pTree = pPage->getStructureTree(); + CPPUNIT_ASSERT(pTree); + CPPUNIT_ASSERT_GREATER(0, pTree->getNumberOfChildren()); + + OUString aID; + const auto aFindID = [&aID](auto& rSelf, vcl::pdf::PDFiumStructureElement& rElement) -> void { + if (aID.isEmpty()) + aID = rElement.getID(); + for (int i = 0; i < rElement.getNumberOfChildren() && aID.isEmpty(); ++i) + { + if (const auto pKid = rElement.getChild(i)) + rSelf(rSelf, *pKid); + } + }; + for (int i = 0; i < pTree->getNumberOfChildren() && aID.isEmpty(); ++i) + { + if (const auto pChild = pTree->getChild(i)) + aFindID(aFindID, *pChild); + } + CPPUNIT_ASSERT(aID.startsWith("id")); +} + CPPUNIT_TEST_FIXTURE(PDFEncryptionTest, testEncryptionRoundtrip_PDF_2_0) { loadFromURL(u"private:factory/swriter"_ustr); diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 2306cffbad57..91af7f55e361 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -179,11 +179,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testCommentAnnotation) CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); vcl::filter::PDFObjectElement* pAnnot(nullptr); - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { @@ -241,11 +238,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testFigurePlacement) std::vector aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { @@ -1112,11 +1106,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testAlternativeText) std::vector aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { @@ -1166,11 +1157,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972) CPPUNIT_ASSERT_EQUAL(static_cast(3), pAnnots->GetElements().size()); sal_uInt32 nTextFieldCount = 0; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("FT"_ostr)); if (pType && pType->GetValue() == "Tx") { @@ -1241,11 +1229,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148442) CPPUNIT_ASSERT_EQUAL(static_cast(3), pAnnots->GetElements().size()); sal_uInt32 nBtnCount = 0; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("FT"_ostr)); if (pType && pType->GetValue() == "Btn") { @@ -1323,11 +1308,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf118244_radioButtonGroup) pAnnots->GetElements().size()); sal_uInt32 nRadioGroups = 0; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("FT"_ostr)); if (pType && pType->GetValue() == "Btn") { @@ -1362,11 +1344,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_1) vcl::filter::PDFObjectElement* pToUnicode = nullptr; // Get access to ToUnicode of the first font - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { @@ -1439,11 +1418,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_2) vcl::filter::PDFObjectElement* pToUnicode = nullptr; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { @@ -1550,7 +1526,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_2a) for (int i = 0; i < nChars; i++) aChars[i] = pPdfTextPage->getUnicode(i); OUString aActualText(aChars.data(), aChars.size()); - CPPUNIT_ASSERT_EQUAL(u"\u0627\u0644 \u0648\u0642\u0641 \u0628\u0627\u0644 \u0627\u0644"_ustr, + CPPUNIT_ASSERT_EQUAL(u"\u0627\u0644 \u0628\u0627\u0644 \u0648\u0642\u0641 \u0627\u0644"_ustr, aActualText); #endif } @@ -1583,7 +1559,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf154549) // Without the fix in place, this test would have failed with // - Expected: ִبي // - Actual : بִي - CPPUNIT_ASSERT_EQUAL(u"\u0628\u064A\u05B4"_ustr, aActualText); + CPPUNIT_ASSERT_EQUAL(u"\u05B4\u0628\u064A"_ustr, aActualText); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf150846) @@ -1645,7 +1621,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf160401) // אאא בבב // - Actual : אאא בבב // בבב אאא - CPPUNIT_ASSERT_EQUAL(u"בבב אאא\r\nבבב אאא"_ustr, aActualText); + CPPUNIT_ASSERT_EQUAL(u"אאא בבב\r\nאאא בבב"_ustr, aActualText); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf103492) @@ -1785,11 +1761,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1) { // Get access to ToUnicode of the first font vcl::filter::PDFObjectElement* pToUnicode = nullptr; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { @@ -1892,11 +1865,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_2) { // Get access to ToUnicode of the first font vcl::filter::PDFObjectElement* pToUnicode = nullptr; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { @@ -1999,11 +1969,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_3) { // Get access to ToUnicode of the first font vcl::filter::PDFObjectElement* pToUnicode = nullptr; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { @@ -2123,11 +2090,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testVariableFontPSName1) CPPUNIT_ASSERT(aDocument.Read(aStream)); std::set aFontNames; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { @@ -2157,11 +2121,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testVariableFontPSName2) CPPUNIT_ASSERT(aDocument.Read(aStream)); std::set aFontNames; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { @@ -2193,11 +2154,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testOpticalSizing) CPPUNIT_ASSERT(aDocument.Read(aStream)); std::set aFontNames; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { @@ -2549,11 +2507,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); vcl::filter::PDFObjectElement* pDocument(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { @@ -2943,11 +2898,8 @@ void AssertLinkAnnotsAreTagged(vcl::filter::PDFDocument& rDocument, const size_t // what the Link structure elements claim as their annotations size_t nLinkSE(0); std::set aKidAnnots; - for (const auto& rDocElement : rDocument.GetElements()) + for (auto* pObject : rDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); if (!pType || pType->GetValue() != "StructElem" || !pS || pS->GetValue() != "Link") @@ -3054,11 +3006,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testIndexMarkWithSpan) // the tag a marked run needs is not always a Link: this one carries the language vcl::filter::PDFObjectElement* pSpanSE(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); if (pType && pType->GetValue() == "StructElem" && pS && pS->GetValue() == "Span") @@ -3101,11 +3050,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testLinkWithRuby) CPPUNIT_ASSERT(pAnnot); vcl::filter::PDFObjectElement* pLinkSE(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); if (pType && pType->GetValue() == "StructElem" && pS && pS->GetValue() == "Link") @@ -3159,8 +3105,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testLinkWithRuby) // the ruby reads between the text before it and the text after it CPPUNIT_ASSERT_EQUAL(size_t(1), nMCIDBeforeRuby); - // the base and the ruby text, each with its own content; RB before RT would - // be the reading order, but the paint order puts RT first + // the base and the ruby text, each with its own content, in the order + // ISO 32000-2 Table 369 requires rather than the paint order auto pRubyKids = dynamic_cast(pRubySE->Lookup("K"_ostr)); CPPUNIT_ASSERT(pRubyKids); CPPUNIT_ASSERT_EQUAL(size_t(2), pRubyKids->GetElements().size()); @@ -3179,8 +3125,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testLinkWithRuby) CPPUNIT_ASSERT_EQUAL(size_t(1), pKidKids->GetElements().size()); CPPUNIT_ASSERT(dynamic_cast(pKidKids->GetElement(0))); } - CPPUNIT_ASSERT(std::find(aRubyKids.begin(), aRubyKids.end(), "RB"_ostr) != aRubyKids.end()); - CPPUNIT_ASSERT(std::find(aRubyKids.begin(), aRubyKids.end(), "RT"_ostr) != aRubyKids.end()); + CPPUNIT_ASSERT_EQUAL("RB"_ostr, aRubyKids[0]); + CPPUNIT_ASSERT_EQUAL("RT"_ostr, aRubyKids[1]); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testLinkWithSpan) @@ -3196,11 +3142,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testLinkWithSpan) CPPUNIT_ASSERT(aDocument.Read(aStream)); vcl::filter::PDFObjectElement* pLinkSE(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); if (pType && pType->GetValue() == "StructElem" && pS && pS->GetValue() == "Link") @@ -3271,11 +3214,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testLinkSpanWithFly) // the link closes there - one link, one span, and the frame nested in the span vcl::filter::PDFObjectElement* pLinkSE(nullptr); vcl::filter::PDFObjectElement* pSpanSE(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); if (!pType || pType->GetValue() != "StructElem" || !pS) @@ -3331,11 +3271,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testSpanWithFly) // the frame opens its tags inside the span, so the span is not what closes at the // frame's own paragraph - one span, and the frame nested in it vcl::filter::PDFObjectElement* pSpanSE(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); if (pType && pType->GetValue() == "StructElem" && pS && pS->GetValue() == "Span") @@ -3391,11 +3328,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testLinkSpanWraps) CPPUNIT_ASSERT_GREATER(size_t(1), pAnnots->GetElements().size()); vcl::filter::PDFObjectElement* pLinkSE(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); if (pType && pType->GetValue() == "StructElem" && pS && pS->GetValue() == "Link") @@ -3474,11 +3408,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testRubyWithSpan) CPPUNIT_ASSERT(aDocument.Read(aStream)); vcl::filter::PDFObjectElement* pRubySE(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); if (pType && pType->GetValue() == "StructElem" && pS && pS->GetValue() == "Ruby") @@ -3593,11 +3524,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf163240) // ... but only one Link structure element for the whole link vcl::filter::PDFObjectElement* pLinkSE(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); if (pType && pType->GetValue() == "StructElem" && pS && pS->GetValue() == "Link") @@ -3660,11 +3588,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf163240) // ... and each of them resolves to it through the parent tree vcl::filter::PDFArrayElement* pNums(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructTreeRoot") { @@ -3723,11 +3648,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); vcl::filter::PDFObjectElement* pDocument(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { @@ -4003,11 +3925,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf142806) CPPUNIT_ASSERT_EQUAL(static_cast(4), aPages.size()); vcl::filter::PDFObjectElement* pDocument(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { @@ -4496,11 +4415,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testFontVariationSettingsODT) CPPUNIT_ASSERT(aDocument.Read(aStream)); std::set aFontNames; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { @@ -4531,11 +4447,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testFontVariationSettingsODP) CPPUNIT_ASSERT(aDocument.Read(aStream)); std::set aFontNames; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index 3386486941a4..3647fc96b55f 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -137,12 +137,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf160705) CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); int nTable(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; - auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { @@ -206,12 +202,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf159895) std::vector aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObj : aDocument.GetObjects()) { - auto pObj = dynamic_cast(rDocElement.get()); - if (!pObj) - continue; - auto pType = dynamic_cast(pObj->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "XObject") { @@ -353,11 +345,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf141171) CPPUNIT_ASSERT(aDocument.Read(aStream)); int nImages(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Subtype"_ostr)); if (pType && pType->GetValue() == "Image") { @@ -1043,11 +1032,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTaggedNestedTableInRepeatedHeaderRow) int nTables(0); int nRows(0); int nParagraphs(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (!pType || pType->GetValue() != "StructElem") continue; @@ -1492,11 +1478,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf160117) bool bFound1 = false; bool bFound2 = false; bool bFound3 = false; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "FontDescriptor") { @@ -1897,11 +1880,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf152231) CPPUNIT_ASSERT_GREATEREQUAL(1, nArtifacts); int nPara(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { @@ -2144,11 +2124,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf149140) CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); int nTH(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { @@ -2213,11 +2190,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf173162) // the namespace each element points at, by object std::unordered_map aNamespaceOf; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (!pType || pType->GetValue() != "Namespace") continue; @@ -2253,12 +2227,30 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf173162) aNamespaceOf.contains(pRef->LookupObject())); } - // The references have to be separated in the file itself: "1 0 R2 0 R" is not two - // references, and this parser reads it as though it were, so check the bytes. veraPDF is + // The references have to be separated in the bytes themselves: "1 0 R2 0 R" is not two + // references, and this parser reads it as though it were, so check them. veraPDF is // stricter - it fails to parse such a file and reports nothing, which reads as a pass. + // The structure tree rides in an object stream, so the bytes to read are what it holds. + OStringBuffer aBytes; + for (auto* pObject : aDocument.GetObjects()) + { + auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); + if (!pType || pType->GetValue() != "ObjStm") + continue; + vcl::filter::PDFStreamElement* pObjStm = pObject->GetStream(); + CPPUNIT_ASSERT(pObjStm); + SvMemoryStream aDecompressed; + ZCodec aCodec; + aCodec.BeginCompression(); + pObjStm->GetMemory().Seek(0); + aCodec.Decompress(pObjStm->GetMemory(), aDecompressed); + CPPUNIT_ASSERT(aCodec.EndCompression() >= 0); + aBytes.append(static_cast(aDecompressed.GetData()), aDecompressed.GetSize()); + } SvStream* pStream = maTempFile.GetStream(StreamMode::READ); pStream->Seek(0); - const OString aFile(read_uInt8s_ToOString(*pStream, pStream->remainingSize())); + aBytes.append(read_uInt8s_ToOString(*pStream, pStream->remainingSize())); + const OString aFile(aBytes.makeStringAndClear()); const sal_Int32 nStart(aFile.indexOf("/Namespaces [")); CPPUNIT_ASSERT_GREATER(sal_Int32(-1), nStart); const sal_Int32 nEnd(aFile.indexOf("]", nStart)); @@ -2274,11 +2266,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf173162) // the namespace each structure type landed in std::unordered_map aNamespaceOfType; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (!pType || pType->GetValue() != "StructElem") continue; @@ -2309,6 +2298,56 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf173162) CPPUNIT_ASSERT_EQUAL(aPDF20, aNamespaceOfType["FENote"_ostr]); } +CPPUNIT_TEST_FIXTURE(PdfExportTest2, testObjectStreams) +{ + loadFromFile(u"SimpleTestDocument.fodt"); + + // the bytes of the export, since what is asserted is the shape of the file itself + auto aExport = [this](const uno::Sequence& rFilterData) { + comphelper::SequenceAsHashMap aMediaDescriptor; + aMediaDescriptor[u"FilterData"_ustr] <<= rFilterData; + // the temp file hands out one stream and keeps it, so the second export needs a new one + maTempFile.CloseStream(); + save(TestFilter::PDF_WRITER, aMediaDescriptor.getAsConstPropertyValueList()); + maTempFile.CloseStream(); + SvStream* pStream = maTempFile.GetStream(StreamMode::READ); + pStream->Seek(0); + return read_uInt8s_ToOString(*pStream, pStream->remainingSize()); + }; + + const OString aTagged(aExport({ comphelper::makePropertyValue(u"UseTaggedPDF"_ustr, true) })); + CPPUNIT_ASSERT(aTagged.indexOf("/Type/ObjStm") != -1); + CPPUNIT_ASSERT(aTagged.indexOf("/Type/XRef") != -1); + // a cross-reference stream replaces the table, so neither the keyword nor a table is left + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aTagged.indexOf("\ntrailer\n")); + + // the structure tree has to stay reachable through all of that + vcl::filter::PDFDocument aDocument; + SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ); + CPPUNIT_ASSERT(aDocument.Read(aStream)); + int nStructElements(0); + for (auto* pObject : aDocument.GetObjects()) + { + auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); + if (pType && pType->GetValue() == "StructElem") + ++nStructElements; + } + CPPUNIT_ASSERT_GREATER(0, nStructElements); + + // ISO 32000-2 7.5.7 put object streams at PDF 1.5, and PDF/A-1b is built on 1.4 + const OString aArchive( + aExport({ comphelper::makePropertyValue(u"SelectPdfVersion"_ustr, sal_Int32(1)) })); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aArchive.indexOf("/Type/ObjStm")); + CPPUNIT_ASSERT(aArchive.indexOf("\ntrailer\n") != -1); + + // sdext finds the embedded original document through the trailer, so a hybrid file keeps one + const OString aHybrid(aExport({ comphelper::makePropertyValue(u"UseTaggedPDF"_ustr, true), + comphelper::makePropertyValue(u"IsAddStream"_ustr, true) })); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aHybrid.indexOf("/Type/ObjStm")); + CPPUNIT_ASSERT(aHybrid.indexOf("/AdditionalStreams ") != -1); + CPPUNIT_ASSERT(aHybrid.indexOf("\ntrailer\n") != -1); +} + CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf166963) { // Takes about two minutes locally, most of it in the PDFDocument below, which rescans its @@ -2362,11 +2401,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf166963) // which element actually lists each structure element as its kid std::unordered_map aLister; std::vector aElements; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (!pType) continue; @@ -2423,11 +2459,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf173194) CPPUNIT_ASSERT(aDocument.Read(aStream)); vcl::filter::PDFObjectElement* pTableSE(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); if (pType && pType->GetValue() == "StructElem" && pS && pS->GetValue() == "Table") @@ -2484,11 +2517,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf153935) // when PDF/UA is requested, since PDF/UA mandates structural tab order on // any page that holds annotations. int nPagesWithTabs(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (!pType || pType->GetValue() != "Page") continue; @@ -2504,11 +2534,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf153935) // the /Table owner (clause 7.5), regardless of PDF version when PDF/UA is // requested. The fixture has 6 TH cells. int nTH(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (!pType || pType->GetValue() != "StructElem") continue; @@ -2562,11 +2589,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testNestedSection) CPPUNIT_ASSERT_EQUAL(size_t(3), aPages.size()); int nDoc(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { @@ -2710,11 +2734,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157817) CPPUNIT_ASSERT_EQUAL(size_t(2), aPages.size()); vcl::filter::PDFObjectElement* pTOC(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { @@ -2907,11 +2928,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf135638) CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); int nFigure(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { @@ -3004,11 +3022,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157703) CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); vcl::filter::PDFObjectElement* pDocument(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { @@ -3085,11 +3100,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) CPPUNIT_ASSERT_EQUAL(size_t(2), aPages.size()); int nDoc(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { @@ -3579,89 +3591,43 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf57423) std::vector aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); - int nFigure(0); - int nFormula(0); - int nDiv(0); - for (const auto& rDocElement : aDocument.GetElements()) + // each kind's descriptions in one string, so the assertion does not depend on the order the + // objects come back in + OUString aFigures; + OUString aFormulas; + OUString aDivs; + auto aAlt = [](vcl::filter::PDFObjectElement* pObject) -> OUString { + auto pAlt = dynamic_cast(pObject->Lookup("Alt"_ostr)); + return pAlt ? vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAlt) : OUString(); + }; + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); - if (pType && pType->GetValue() == "StructElem") - { - auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); - if (pS && pS->GetValue() == "Figure") - { - switch (nFigure) - { - case 2: - CPPUNIT_ASSERT_EQUAL(u"QR Code - Tells how to get to Mosegaard"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast( - pObject->Lookup("Alt"_ostr)))); - break; - case 0: - CPPUNIT_ASSERT_EQUAL(u"Title: Arrows - Description: Explains the " - u"different arrow appearances"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast( - pObject->Lookup("Alt"_ostr)))); - break; - case 1: - CPPUNIT_ASSERT_EQUAL( - u"My blue triangle - Does not need further description"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast( - pObject->Lookup("Alt"_ostr)))); - break; - } - ++nFigure; - } - if (pS && pS->GetValue() == "Formula") - { - CPPUNIT_ASSERT_EQUAL( - u"Equation 1 - Now we give the full description of eq 1 here"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast( - pObject->Lookup("Alt"_ostr)))); - ++nFormula; - } - if (pS && pS->GetValue() == "Div") - { - switch (nDiv) - { - case 0: - CPPUNIT_ASSERT_EQUAL(u"This frame has a description"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast( - pObject->Lookup("Alt"_ostr)))); - break; - case 1: - // no properties set on this - CPPUNIT_ASSERT(!pObject->Lookup("Alt"_ostr)); - break; - case 2: - CPPUNIT_ASSERT_EQUAL(u"My textbox - Has a light background"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast( - pObject->Lookup("Alt"_ostr)))); - break; - case 3: - CPPUNIT_ASSERT_EQUAL(u"Hey! There is no alternate text for Frame " - u"// but maybe not needed?"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast( - pObject->Lookup("Alt"_ostr)))); - break; - } - ++nDiv; - } - } + if (!pType || pType->GetValue() != "StructElem") + continue; + auto pS = dynamic_cast(pObject->Lookup("S"_ostr)); + if (!pS) + continue; + if (pS->GetValue() == "Figure") + aFigures += aAlt(pObject) + "|"; + else if (pS->GetValue() == "Formula") + aFormulas += aAlt(pObject) + "|"; + else if (pS->GetValue() == "Div") + aDivs += aAlt(pObject) + "|"; } - CPPUNIT_ASSERT_EQUAL(3, nFigure); - CPPUNIT_ASSERT_EQUAL(1, nFormula); - CPPUNIT_ASSERT_EQUAL(4, nDiv); + + CPPUNIT_ASSERT_EQUAL( + u"QR Code - Tells how to get to Mosegaard|" + "My blue triangle - Does not need further description|" + "Title: Arrows - Description: Explains the different arrow appearances|"_ustr, + aFigures); + CPPUNIT_ASSERT_EQUAL(u"Equation 1 - Now we give the full description of eq 1 here|"_ustr, + aFormulas); + // the first frame here has no properties set on it + CPPUNIT_ASSERT_EQUAL(u"|This frame has a description|" + "Hey! There is no alternate text for Frame // but maybe not needed?|" + "My textbox - Has a light background|"_ustr, + aDivs); } CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf154982) @@ -3685,11 +3651,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf154982) CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); int nFigure(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { @@ -3860,11 +3823,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testStyleNamedStructureTypes) maTempFile.CloseStream(); CPPUNIT_ASSERT(aDocument.Read(*maTempFile.GetStream(StreamMode::READ))); OStringBuffer aTypes; - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (!pType || pType->GetValue() != "StructElem") continue; @@ -3900,10 +3860,9 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testStyleNamedStructureTypes) // its own; the run in Source Text is the one element really of the Code type, and the // style really called Code1 keeps a name of its own, being a different style const auto[aTypes17, aRoles17] = aExport(17); - CPPUNIT_ASSERT_EQUAL(u8"Étude TD Étude TD TR Table" + CPPUNIT_ASSERT_EQUAL(u8"Document Table TR TD Étude TD Étude" " Code-1 Title Index-1 Code1 H-1 THead-1 H7 Sub Artifact-1 Code-1-1 H7-1 " - "Code-2 Code Étude-1" - " Standard Document "_ostr, + "Standard Code-2 Code Étude-1 "_ostr, aTypes17); CPPUNIT_ASSERT_EQUAL( u8"Artifact-1=P Code-1=P Code-1-1=P Code-2=Span Code1=P H-1=P" @@ -3913,10 +3872,9 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testStyleNamedStructureTypes) // PDF 2.0 has a Title type, and heading levels without limit, so Title names its own // elements while H7 and Sub have to give way const auto[aTypes20, aRoles20] = aExport(20); - CPPUNIT_ASSERT_EQUAL(u8"Étude TD Étude TD TR Table" + CPPUNIT_ASSERT_EQUAL(u8"Document Table TR TD Étude TD Étude" " Code-1 Title Index-1 Code1 H-1 THead-1 H7-1 Sub-1 Artifact-1 Code-1-1 " - "H7 Code-2 Code Étude-1" - " Standard Document "_ostr, + "H7 Standard Code-2 Code Étude-1 "_ostr, aTypes20); CPPUNIT_ASSERT_EQUAL( u8"Artifact-1=P Code-1=P Code-1-1=P Code-2=Span Code1=P H-1=P" diff --git a/vcl/qa/cppunit/pdfexport/pdfexport3.cxx b/vcl/qa/cppunit/pdfexport/pdfexport3.cxx index 3958570f1bbb..7e043cf7c805 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport3.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport3.cxx @@ -95,11 +95,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf157397) CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); vcl::filter::PDFObjectElement* pDocument(nullptr); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { @@ -425,11 +422,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf135192) CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); int nTable(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { @@ -624,11 +618,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf154955) CPPUNIT_ASSERT_GREATEREQUAL(1, nArtifacts); int nFigure(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(rDocElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { @@ -693,11 +684,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf155190) int nDiv(0); int nFigure(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); auto pS1 = dynamic_cast(pObject1->Lookup("S"_ostr)); @@ -829,11 +817,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testMediaShapeAnnot) // check ParentTree to find StructElem int nRoots(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructTreeRoot") { @@ -952,11 +937,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testFlyFrameHyperlinkAnnot) // check ParentTree to find StructElem int nRoots(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructTreeRoot") { @@ -1090,11 +1072,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testFormControlAnnot) // check ParentTree to find StructElem int nRoots(0); - for (const auto& rDocElement : aDocument.GetElements()) + for (auto* pObject1 : aDocument.GetObjects()) { - auto pObject1 = dynamic_cast(rDocElement.get()); - if (!pObject1) - continue; auto pType1 = dynamic_cast(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructTreeRoot") { @@ -1712,7 +1691,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf139627) int rehmim = 0, kasreh = 1, jehtatweel = 2; CPPUNIT_ASSERT_EQUAL(u"رم"_ustr, sText[rehmim].trim()); - CPPUNIT_ASSERT_EQUAL(OUString::fromUtf8("\xD8\xAC\xD9\x90"), sText[kasreh].trim()); + CPPUNIT_ASSERT_EQUAL(OUString::fromUtf8("\xD9\x90\xD8\xAC"), sText[kasreh].trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, sText[jehtatweel].trim()); // "Kasreh" should be within "jeh" character @@ -1993,11 +1972,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf155161) // Check that all fonts in the document are not Type 3 fonts. std::set aFontNames; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { @@ -2029,11 +2005,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTrueTypeCompositeFont) vcl::filter::PDFObjectElement* pType0 = nullptr; vcl::filter::PDFObjectElement* pCIDFont = nullptr; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (!pType || pType->GetValue() != "Font") continue; @@ -2096,11 +2069,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testPDFA1CIDSet) CPPUNIT_ASSERT(aDocument.Read(aStream)); vcl::filter::PDFObjectElement* pCIDFont = nullptr; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pSubtype = dynamic_cast(pObject->Lookup("Subtype"_ostr)); if (pSubtype && pSubtype->GetValue() == "CIDFontType0") pCIDFont = pObject; @@ -2144,11 +2114,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testNoCIDSetWithoutPDFA1) CPPUNIT_ASSERT(aDocument.Read(aStream)); bool bSawDescriptor = false; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (!pType || pType->GetValue() != "FontDescriptor") continue; @@ -2173,11 +2140,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf171869) vcl::filter::PDFObjectElement* pType0 = nullptr; vcl::filter::PDFObjectElement* pCIDFont = nullptr; int nFonts = 0; - for (const auto& aElement : aDocument.GetElements()) + for (auto* pObject : aDocument.GetObjects()) { - auto pObject = dynamic_cast(aElement.get()); - if (!pObject) - continue; auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); if (!pType || pType->GetValue() != "Font") continue; @@ -2572,9 +2536,9 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf134226) CPPUNIT_ASSERT_EQUAL(u"ة"_ustr, aText[0].trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText[1].trim()); - CPPUNIT_ASSERT_EQUAL(u"ق\r\n\u0651"_ustr, aText[2].trim()); + CPPUNIT_ASSERT_EQUAL(u"\u0651ق"_ustr, aText[2].trim()); CPPUNIT_ASSERT_EQUAL(u"ش"_ustr, aText[3].trim()); - CPPUNIT_ASSERT_EQUAL(u"ق\u0651"_ustr, aText[4].trim()); + CPPUNIT_ASSERT_EQUAL(u"\u0651ق"_ustr, aText[4].trim()); CPPUNIT_ASSERT_EQUAL(u"ش"_ustr, aText[5].trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText[6].trim()); CPPUNIT_ASSERT_EQUAL(u"ة"_ustr, aText[7].trim()); @@ -2606,13 +2570,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf71956) CPPUNIT_ASSERT_EQUAL(size_t(12), aText.size()); CPPUNIT_ASSERT_EQUAL(u"ه"_ustr, aText[0].trim()); - CPPUNIT_ASSERT_EQUAL(u"ل\r\n\u064e\u0651\u0670"_ustr, aText[1].trim()); + CPPUNIT_ASSERT_EQUAL(u"\u064e\u0651\u0670ل"_ustr, aText[1].trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText[2].trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText[3].trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText[4].trim()); CPPUNIT_ASSERT_EQUAL(u"ل"_ustr, aText[5].trim()); CPPUNIT_ASSERT_EQUAL(u"ل"_ustr, aText[6].trim()); - CPPUNIT_ASSERT_EQUAL(u"ل\u064e\u0651\u0670"_ustr, aText[7].trim()); + CPPUNIT_ASSERT_EQUAL(u"\u064e\u0651\u0670ل"_ustr, aText[7].trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText[8].trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText[9].trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText[10].trim()); @@ -2920,19 +2884,19 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf151748KashidaSpace) CPPUNIT_ASSERT_EQUAL(size_t(17), aText.size()); // Box 1: Not enough room for kashida - CPPUNIT_ASSERT_EQUAL(u"تخوردگی خط"_ustr, aText.at(0).trim()); + CPPUNIT_ASSERT_EQUAL(u"خط تخوردگی"_ustr, aText.at(0).trim()); CPPUNIT_ASSERT_EQUAL(u"وتوسط"_ustr, aText.at(1).trim()); // Box 2: One kashida toward end CPPUNIT_ASSERT_EQUAL(u"وردگی"_ustr, aText.at(2).trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(3).trim()); // Kashida - CPPUNIT_ASSERT_EQUAL(u"تخ خط"_ustr, aText.at(4).trim()); + CPPUNIT_ASSERT_EQUAL(u"خط تخ"_ustr, aText.at(4).trim()); CPPUNIT_ASSERT_EQUAL(u"وتوسط"_ustr, aText.at(5).trim()); // Box 3: Two kashida CPPUNIT_ASSERT_EQUAL(u"وردگی"_ustr, aText.at(6).trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(7).trim()); // Kashida - CPPUNIT_ASSERT_EQUAL(u"تخ ط"_ustr, aText.at(8).trim()); + CPPUNIT_ASSERT_EQUAL(u"ط تخ"_ustr, aText.at(8).trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(9).trim()); // Kashida CPPUNIT_ASSERT_EQUAL(u"خ"_ustr, aText.at(10).trim()); CPPUNIT_ASSERT_EQUAL(u"وتوسط"_ustr, aText.at(11).trim()); @@ -2960,7 +2924,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf163105SwKashidaSpaceExpansion) CPPUNIT_ASSERT_EQUAL(u"یده"_ustr, aText.at(0).trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(1).trim()); - CPPUNIT_ASSERT_EQUAL(u"کش ه"_ustr, aText.at(2).trim()); // This span is whitespace justified + CPPUNIT_ASSERT_EQUAL(u"ه کش"_ustr, aText.at(2).trim()); // This span is whitespace justified CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(3).trim()); CPPUNIT_ASSERT_EQUAL(u"نویس"_ustr, aText.at(4).trim()); @@ -2985,7 +2949,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf163105Writer) CPPUNIT_ASSERT_EQUAL(u"ارسی"_ustr, aText.at(0).trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(1).trim()); - CPPUNIT_ASSERT_EQUAL(u"ف تن"_ustr, aText.at(2).trim()); // This span is whitespace justified + CPPUNIT_ASSERT_EQUAL(u"تن ف"_ustr, aText.at(2).trim()); // This span is whitespace justified CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(3).trim()); CPPUNIT_ASSERT_EQUAL(u"م"_ustr, aText.at(4).trim()); @@ -3010,7 +2974,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf163105Editeng) CPPUNIT_ASSERT_EQUAL(u"ارسی"_ustr, aText.at(0).trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(1).trim()); - CPPUNIT_ASSERT_EQUAL(u"ف تن"_ustr, aText.at(2).trim()); // This span is whitespace justified + CPPUNIT_ASSERT_EQUAL(u"تن ف"_ustr, aText.at(2).trim()); // This span is whitespace justified CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(3).trim()); CPPUNIT_ASSERT_EQUAL(u"م"_ustr, aText.at(4).trim()); @@ -3030,16 +2994,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest3, testTdf140767SyriacJustification) CPPUNIT_ASSERT_EQUAL(size_t(11), aText.size()); CPPUNIT_ASSERT_EQUAL(u"ܝ"_ustr, aText.at(0).trim()); - CPPUNIT_ASSERT_EQUAL(u"ܛܺ"_ustr, aText.at(1).trim()); + CPPUNIT_ASSERT_EQUAL(u"ܺܛ"_ustr, aText.at(1).trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(2).trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(3).trim()); - CPPUNIT_ASSERT_EQUAL(u"ܚܰ"_ustr, aText.at(4).trim()); + CPPUNIT_ASSERT_EQUAL(u"ܰܚ"_ustr, aText.at(4).trim()); CPPUNIT_ASSERT_EQUAL(u"ܕ"_ustr, aText.at(5).trim()); // This span is whitespace justified CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(6).trim()); - CPPUNIT_ASSERT_EQUAL(u"ܓܰ"_ustr, aText.at(7).trim()); + CPPUNIT_ASSERT_EQUAL(u"ܰܓ"_ustr, aText.at(7).trim()); CPPUNIT_ASSERT_EQUAL(u"ܒ"_ustr, aText.at(8).trim()); CPPUNIT_ASSERT_EQUAL(u""_ustr, aText.at(9).trim()); - CPPUNIT_ASSERT_EQUAL(u"ܐܰ"_ustr, aText.at(10).trim()); + CPPUNIT_ASSERT_EQUAL(u"ܰܐ"_ustr, aText.at(10).trim()); // Without kashida justification, this space will be 224.328 CPPUNIT_ASSERT_LESS(90.0, aRect.at(5).getWidth()); diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index b15e60f85c61..0692b38286bf 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -1177,7 +1177,7 @@ void QtFrame::SetScreenNumber(unsigned int nScreen) void QtFrame::SetApplicationID(const OUString& rWMClass) { -#if CHECK_QT5_USING_X11 +#if CHECK_ANY_QT_USING_X11 if (GetQtInstance().GetPlatform() != Platform::Xcb || !m_pTopLevel) return; diff --git a/vcl/qt5/QtGraphics.cxx b/vcl/qt5/QtGraphics.cxx index 803c4dd35128..541b7a1928b8 100644 --- a/vcl/qt5/QtGraphics.cxx +++ b/vcl/qt5/QtGraphics.cxx @@ -44,20 +44,20 @@ #include #include -QtGraphics::QtGraphics( QtFrame *pFrame, QImage *pQImage ) - : m_pFrame( pFrame ) +QtGraphics::QtGraphics(QtFrame* pFrame, QImage* pQImage) + : QtGraphicsBase(pFrame) , m_pTextStyle{ nullptr, } , m_aTextColor( 0x00, 0x00, 0x00 ) { - m_pBackend = std::make_unique(m_pFrame, pQImage); + m_pBackend = std::make_unique(pFrame, pQImage); if (!initWidgetDrawBackends(false)) { if (!QtInstance::noNativeControls()) m_pWidgetDraw.reset(new QtGraphics_Controls(*this)); } - if (m_pFrame) - setDevicePixelRatioF(m_pFrame->devicePixelRatioF()); + if (pFrame) + setDevicePixelRatioF(pFrame->devicePixelRatioF()); } QtGraphics::~QtGraphics() { ReleaseFonts(); } @@ -88,7 +88,7 @@ void QtGraphics::handleDamage(const tools::Rectangle& rDamagedRegion) void QtGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) { - QtGraphicsBase::ImplGetResolution(m_pFrame, rDPIX, rDPIY); + ImplGetResolution(rDPIX, rDPIY); } void QtGraphics::SetTextColor(Color nColor) { m_aTextColor = nColor; } diff --git a/vcl/qt5/QtGraphicsBase.cxx b/vcl/qt5/QtGraphicsBase.cxx index a6b99eb39640..29f35dcf725f 100644 --- a/vcl/qt5/QtGraphicsBase.cxx +++ b/vcl/qt5/QtGraphicsBase.cxx @@ -16,7 +16,7 @@ #include -void QtGraphicsBase::ImplGetResolution(const QtFrame* pFrame, sal_Int32& rDPIX, sal_Int32& rDPIY) +void QtGraphicsBase::ImplGetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) { char* pForceDpi; if ((pForceDpi = getenv("SAL_FORCEDPI"))) @@ -25,10 +25,10 @@ void QtGraphicsBase::ImplGetResolution(const QtFrame* pFrame, sal_Int32& rDPIX, return; } - if (!pFrame) + if (!m_pFrame) return; - QScreen* pScreen = pFrame->GetQWidget().screen(); + QScreen* pScreen = m_pFrame->GetQWidget().screen(); qreal devicePixelRatio = GetQtInstance().EmscriptenLightweightRunInMainThread( [pScreen] { return pScreen->devicePixelRatio(); }); rDPIX = pScreen->logicalDotsPerInchX() * devicePixelRatio + 0.5; diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx index 4cd9961ac4c6..9905dad56d02 100644 --- a/vcl/qt5/QtGraphics_GDI.cxx +++ b/vcl/qt5/QtGraphics_GDI.cxx @@ -31,7 +31,7 @@ #include QtGraphicsBackend::QtGraphicsBackend(QtFrame* pFrame, QImage* pQImage) - : m_pFrame(pFrame) + : QtGraphicsBase(pFrame) , m_pQImage(pQImage) , m_oLineColor(std::in_place, 0x00, 0x00, 0x00) , m_oFillColor(std::in_place, 0xFF, 0xFF, 0XFF) diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index 7f3e92f85ce4..e9fe00b224e3 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -70,6 +70,7 @@ constexpr auto SUPPORTED_UI_FILES = frozen::make_unordered_setGetQWidget())) + assert(rGraphics.GetFrame()); + if (!begin(&rGraphics.GetFrame()->GetQWidget())) std::abort(); } if (!rGraphics.m_aClipPath.isEmpty()) diff --git a/vcl/qt5/QtSvpGraphics.cxx b/vcl/qt5/QtSvpGraphics.cxx index 897fd9d89371..3d1aa838871e 100644 --- a/vcl/qt5/QtSvpGraphics.cxx +++ b/vcl/qt5/QtSvpGraphics.cxx @@ -20,21 +20,22 @@ #include QtSvpGraphics::QtSvpGraphics(QtFrame* pFrame) - : m_pFrame(pFrame) + : QtGraphicsBase(pFrame) { if (!QtInstance::noNativeControls()) m_pWidgetDraw.reset(new QtGraphics_Controls(*this)); - if (m_pFrame) - setDevicePixelRatioF(m_pFrame->devicePixelRatioF()); + if (pFrame) + setDevicePixelRatioF(pFrame->devicePixelRatioF()); } QtSvpGraphics::~QtSvpGraphics() {} void QtSvpGraphics::updateQWidget() const { - if (!m_pFrame) + QtFrame* pFrame = GetFrame(); + if (!pFrame) return; - QWidget& rQWidget = m_pFrame->GetQWidget(); + QWidget& rQWidget = pFrame->GetQWidget(); rQWidget.update(rQWidget.rect()); } @@ -89,7 +90,7 @@ void QtSvpGraphics::handleDamage(const tools::Rectangle& rDamagedRegion) void QtSvpGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) { - QtGraphicsBase::ImplGetResolution(m_pFrame, rDPIX, rDPIY); + ImplGetResolution(rDPIX, rDPIY); } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index c6b179e09ddf..2098c77deb5f 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -114,13 +114,7 @@ void QtWidget::handleMouseButtonEvent(const QMouseEvent* pEvent) const m_rFrame.CallCallback(nEventType, &aEvent); } -void QtWidget::mousePressEvent(QMouseEvent* pEvent) -{ - handleMouseButtonEvent(pEvent); - if (m_rFrame.isPopup() - && !geometry().translated(geometry().topLeft() * -1).contains(pEvent->pos())) - closePopup(); -} +void QtWidget::mousePressEvent(QMouseEvent* pEvent) { handleMouseButtonEvent(pEvent); } void QtWidget::mouseReleaseEvent(QMouseEvent* pEvent) { handleMouseButtonEvent(pEvent); } @@ -520,14 +514,15 @@ void QtWidget::closePopup() } } -void QtWidget::focusOutEvent(QFocusEvent*) +void QtWidget::focusOutEvent(QFocusEvent* pEvent) { #if CHECK_ANY_QT_USING_X11 m_rFrame.m_nKeyModifiers = ModKeyFlags::NONE; #endif endExtTextInput(); m_rFrame.CallCallback(SalEvent::LoseFocus, nullptr); - closePopup(); + if (pEvent->reason() != Qt::FocusReason::PopupFocusReason) + closePopup(); } QtWidget::QtWidget(QtFrame& rFrame, Qt::WindowFlags f) diff --git a/vcl/qt5/QtX11Support.cxx b/vcl/qt5/QtX11Support.cxx index 37a40037b444..93751993b754 100644 --- a/vcl/qt5/QtX11Support.cxx +++ b/vcl/qt5/QtX11Support.cxx @@ -20,7 +20,16 @@ void QtX11Support::setApplicationID(const xcb_window_t nWinId, std::u16string_view rWMClass) { + xcb_connection_t* pConnection = nullptr; #if CHECK_QT5_USING_X11 + pConnection = QX11Info::connection(); +#else + auto* x11Application = qGuiApp->nativeInterface(); + if (x11Application) + pConnection = x11Application->connection(); +#endif + if (!pConnection) + return; OString aResClass = OUStringToOString(rWMClass, RTL_TEXTENCODING_ASCII_US); const char* pResClass = !aResClass.isEmpty() ? aResClass.getStr() : X11Helper::getFrameClassName(); @@ -32,13 +41,9 @@ void QtX11Support::setApplicationID(const xcb_window_t nWinId, std::u16string_vi memcpy(data, aResName.getStr(), aResName.getLength() + 1); memcpy(data + aResName.getLength() + 1, pResClass, strlen(pResClass) + 1); - xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, nWinId, XCB_ATOM_WM_CLASS, + xcb_change_property(pConnection, XCB_PROP_MODE_REPLACE, nWinId, XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8, data_len, data); delete[] data; -#else - Q_UNUSED(nWinId); - Q_UNUSED(rWMClass); -#endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/app/salplug.cxx b/vcl/source/app/salplug.cxx index 08359289014d..61847c266f5e 100644 --- a/vcl/source/app/salplug.cxx +++ b/vcl/source/app/salplug.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// Th current high-level preprocessor structure is: +// The current high-level preprocessor structure is: // // if !HAVE_FEATURE_UI // => STATIC_SAL_INSTANCE diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index eeccc451098f..a37d42130860 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -4431,6 +4431,7 @@ bool SalInstanceTreeView::get_row_expanded(const weld::TreeIter& rIter) const bool SalInstanceTreeView::get_children_on_demand(const weld::TreeIter& rIter) const { const SalInstanceTreeIter& rVclIter = static_cast(rIter); + assert(rVclIter.iter && "Invalid iter"); if (m_aExpandingPlaceHolderParents.contains(rVclIter.iter)) return true; return GetPlaceHolderChild(rVclIter.iter) != nullptr; diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index d0d3b236bf7b..829b1bd38446 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -2059,6 +2060,14 @@ PDFObjectElement* PDFDocument::GetCatalog() return pRoot->LookupObject(); } +std::vector PDFDocument::GetObjects() +{ + // the map holds what the file lists and what ParseStoredObjects unpacked from an object + // stream, so an object is here whether or not it stands in the file + auto aObjects = m_aIDObjects | std::views::values; + return { aObjects.begin(), aObjects.end() }; +} + std::vector PDFDocument::GetPages() { std::vector aRet; diff --git a/vcl/source/filter/jxl/reader.cxx b/vcl/source/filter/jxl/reader.cxx index 4393b02bc8d9..1af5d1e61c0c 100644 --- a/vcl/source/filter/jxl/reader.cxx +++ b/vcl/source/filter/jxl/reader.cxx @@ -78,7 +78,6 @@ static bool readJxl(SvStream& stream, Graphic& graphic) } // Try using partially read image if there is an error. - bool success = true; for (;;) { JxlDecoderStatus status = JxlDecoderProcessInput(dec.get()); @@ -86,8 +85,7 @@ static bool readJxl(SvStream& stream, Graphic& graphic) if (status == JXL_DEC_ERROR) { SAL_WARN("vcl.filter.jxl", "Decoder error"); - success = false; - break; + return false; } else if (status == JXL_DEC_NEED_MORE_INPUT || status == JXL_DEC_SUCCESS || status == JXL_DEC_FULL_IMAGE) @@ -103,8 +101,7 @@ static bool readJxl(SvStream& stream, Graphic& graphic) if (status == JXL_DEC_NEED_MORE_INPUT) { SAL_WARN("vcl.filter.jxl", "Incomplete/truncated file"); - success = false; - break; + return false; } else { @@ -117,8 +114,7 @@ static bool readJxl(SvStream& stream, Graphic& graphic) if (JXL_DEC_SUCCESS != JxlDecoderSetInput(dec.get(), data.data(), nBytesRead)) { SAL_WARN("vcl.filter.jxl", "JxlDecoderSetInput failed"); - success = false; - break; + return false; } } else if (status == JXL_DEC_BASIC_INFO) @@ -126,8 +122,7 @@ static bool readJxl(SvStream& stream, Graphic& graphic) if (JXL_DEC_SUCCESS != JxlDecoderGetBasicInfo(dec.get(), &info)) { SAL_WARN("vcl.filter.jxl", "JxlDecoderGetBasicInfo failed"); - success = false; - break; + return false; } xsize = info.xsize; ysize = info.ysize; @@ -140,30 +135,26 @@ static bool readJxl(SvStream& stream, Graphic& graphic) if (JXL_DEC_SUCCESS != JxlDecoderImageOutBufferSize(dec.get(), &format, &buffer_size)) { SAL_WARN("vcl.filter.jxl", "JxlDecoderImageOutBufferSize failed"); - success = false; - break; + return false; } if (buffer_size != xsize * ysize * 4) { SAL_WARN("vcl.filter.jxl", "Invalid out buffer size, expected " << xsize * ysize * 4 << " but got " << buffer_size); - success = false; - break; + return false; } pixels.resize(xsize * ysize * 4); if (JXL_DEC_SUCCESS != JxlDecoderSetImageOutBuffer(dec.get(), &format, pixels.data(), pixels.size())) { SAL_WARN("vcl.filter.jxl", "JxlDecoderSetImageOutBuffer failed"); - success = false; - break; + return false; } } else if (status != JXL_DEC_COLOR_ENCODING) // not using color profile { SAL_WARN("vcl.filter.jxl", "Unknown JxlDecoderStatus"); - success = false; - break; + return false; } } @@ -191,7 +182,7 @@ static bool readJxl(SvStream& stream, Graphic& graphic) access.reset(); // Flush BitmapScopedWriteAccess graphic = bitmap; - return success; + return true; } bool ImportJxlGraphic(SvStream& rStream, Graphic& rGraphic) diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 03801668c2d4..32078ac09d6c 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1412,6 +1412,10 @@ void ImpGraphic::updateFromLoadedGraphic(const ImpGraphic* pGraphic) mbSwapOut = false; } + + // The loaded content is measured while it is in memory, so the graphic still knows its size + // after it is swapped out again. + ensureCurrentSizeInBytes(); } void ImpGraphic::dumpState(rtl::OStringBuffer &rState) diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 8e16aa5279f5..1717c4cf24bc 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -151,11 +151,9 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev, if( !pOutDev ) return; - SalGraphics* pGraphics; if ( !pOutDev->mpGraphics ) (void)pOutDev->AcquireGraphics(); - pGraphics = pOutDev->mpGraphics; - if ( pGraphics ) + if (SalGraphics* pGraphics = pOutDev->mpGraphics) { if (pData) mpVirDev = pSVData->mpDefInst->CreateVirtualDevice(*pGraphics, nDX, nDY, meFormatAndAlpha, *pData); diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index ac69706fbfb3..6da998815ee7 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -63,8 +63,6 @@ using namespace css; -static bool bPreferDark; //initialized in ImplImageTree c'tor - bool ImageRequestParameters::convertToDarkTheme() { static bool bIconsForDarkTheme = !!getenv("VCL_ICONS_FOR_DARK_THEME"); @@ -225,7 +223,7 @@ void loadImageFromStream(std::shared_ptr const & xStream, OUString con ImplImageTree::ImplImageTree() { - bPreferDark = ThemeColors::GetThemeColors().GetWindowColor().IsDark(); + mbPreferDark = ThemeColors::GetThemeColors().GetWindowColor().IsDark(); } ImplImageTree::~ImplImageTree() @@ -353,11 +351,10 @@ OUString ImplImageTree::fallbackStyle(std::u16string_view rsStyle) sResult = "breeze_dark"; else if (rsStyle == u"colibre_dark" ) sResult = "colibre"; + else if (mbPreferDark) + sResult = "colibre_dark"; else - if (bPreferDark) - sResult = "colibre_dark"; - else - sResult = "colibre"; + sResult = "colibre"; return sResult; } diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 9ebba821c0bd..498b979db460 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -950,29 +950,33 @@ static std::pair lcl_calcConversionMapRes(const MapMode& return result; } -static tools::Long lcl_convertLogicValue(const tools::Long n1, const o3tl::Length eFrom, const o3tl::Length eTo) +static tools::Long lcl_convertLogicValue(const tools::Long nSourceValue, const o3tl::Length eSourceUnit, const o3tl::Length eDestUnit) { - if (n1 == 0 || eFrom == o3tl::Length::invalid || eTo == o3tl::Length::invalid) + if (nSourceValue == 0 || eSourceUnit == o3tl::Length::invalid || eDestUnit == o3tl::Length::invalid) return 0; bool bOverflow; - const auto nResult = o3tl::convert(n1, eFrom, eTo, bOverflow); + const auto nResult = o3tl::convert(nSourceValue, eSourceUnit, eDestUnit, bOverflow); + // Fast path: conversion succeeded without integer overflow if (!bOverflow) return nResult; - const auto [n2, n3] = o3tl::getConversionMulDiv(eFrom, eTo); - BigInt a4 = n1; - a4 *= n2; + // Fallback: Use BigInt to prevent overflow during intermediate multiplication + const auto [nMultiplier, nDivisor] = o3tl::getConversionMulDiv(eSourceUnit, eDestUnit); + BigInt aBigValue = nSourceValue; + aBigValue *= nMultiplier; - if ( a4.IsNeg() ) - a4 -= n3 / 2; + // Manual rounding: standard integer division truncates towards zero. + // We add or subtract half the divisor before dividing to achieve round-to-nearest. + if (aBigValue.IsNeg()) + aBigValue -= nDivisor / 2; else - a4 += n3 / 2; + aBigValue += nDivisor / 2; - a4 /= n3; + aBigValue /= nDivisor; - return static_cast(a4); + return static_cast(aBigValue); } Point OutputDevice::LogicToLogic( const Point& rPtSource, diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx index 3c8c6f4f0875..ba8cec5bf443 100644 --- a/vcl/source/pdf/PDFiumLibrary.cxx +++ b/vcl/source/pdf/PDFiumLibrary.cxx @@ -443,6 +443,7 @@ public: PDFPageObjectType getType() override; OUString getText(std::unique_ptr const& pTextPage) override; + int getMarkedContentID() override; int getFormObjectCount() override; std::unique_ptr getFormObject(int nIndex) override; @@ -1215,6 +1216,11 @@ OUString PDFiumPageObjectImpl::getText(std::unique_ptr const& rT return pTextPage->getText(mpPageObject); } +int PDFiumPageObjectImpl::getMarkedContentID() +{ + return FPDFPageObj_GetMarkedContentID(mpPageObject); +} + PDFPageObjectType PDFiumPageObjectImpl::getType() { return static_cast(FPDFPageObj_GetType(mpPageObject)); diff --git a/vcl/source/pdf/pdfwriter_impl.cxx b/vcl/source/pdf/pdfwriter_impl.cxx index e1717e082ef1..3459e15e2d12 100644 --- a/vcl/source/pdf/pdfwriter_impl.cxx +++ b/vcl/source/pdf/pdfwriter_impl.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -127,6 +128,29 @@ namespace void removePlaceholderSE(std::vector & rStructure, PDFStructureElement& rEle); +// a reader inflates a whole object stream to reach any one object in it +constexpr size_t nMaxObjectsPerStream = 200; + +// deflates a buffer for a /FlateDecode stream whose /Length has to be known before it is written +std::vector deflateBuffer(std::string_view aData) +{ + if (g_bDebugDisableCompression) + return { aData.begin(), aData.end() }; + + SvMemoryStream aInput(const_cast(aData.data()), aData.size(), StreamMode::READ); + SvMemoryStream aOutput(aData.size(), 0x4000); + ZCodec aCodec(0x4000, 0x4000); + aCodec.BeginCompression(); + aCodec.Compress(aInput, aOutput); + // it answers with the bytes it took, and a short count would leave a stream that does not + // hold what its /Length claims + if (aCodec.EndCompression() != static_cast(aData.size())) + return {}; + + const sal_uInt8* pBegin = static_cast(aOutput.GetData()); + return { pBegin, pBegin + aOutput.Tell() }; +} + // the types ISO 32000-2 14.8.6 left out of the PDF 2.0 standard structure namespace bool isPDF17OnlyType(StructElement eType) { @@ -795,7 +819,7 @@ void PDFWriterImpl::endPage() sal_Int32 PDFWriterImpl::createObject() { - m_aObjects.push_back( ~0U ); + m_aObjects.emplace_back(); return m_aObjects.size(); } @@ -804,7 +828,7 @@ bool PDFWriterImpl::updateObject( sal_Int32 n ) if( ! m_bOpen ) return false; - sal_uInt64 nOffset = ~0U; + sal_uInt64 nOffset = SAL_MAX_UINT64; osl::File::RC aError = m_aFile.getPos(nOffset); SAL_WARN_IF( aError != osl::File::E_None, "vcl.pdfwriter", "could not register object" ); if (aError != osl::File::E_None) @@ -812,19 +836,115 @@ bool PDFWriterImpl::updateObject( sal_Int32 n ) m_aFile.close(); m_bOpen = false; } - m_aObjects[ n-1 ] = nOffset; + m_aObjects[n - 1].m_nOffset = nOffset; return aError == osl::File::E_None; } +bool PDFWriterImpl::useObjectStreams() const +{ + if (m_aContext.Version < PDFWriter::PDFVersion::PDF_1_5) + return false; + // sdext reads the embedded original document out of a trailer, and a cross-reference + // stream leaves none + return m_aDocumentAttachedFiles.empty(); +} + +std::shared_ptr PDFWriterImpl::getStringEncryptor(sal_Int32 nObject) +{ + if (!useObjectStreams()) + return m_pPDFEncryptor; + +#ifndef NDEBUG + m_aPlainStringObjects.insert(nObject); +#else + (void)nObject; +#endif + // ISO 32000-2 7.5.7: a string in an object stream is not encrypted on its own, the + // stream carrying it is + return nullptr; +} + +bool PDFWriterImpl::writeObject(sal_Int32 nObject, std::string_view aBody) +{ + if (useObjectStreams()) + return writeCompressedObject(nObject, aBody); + + return updateObject(nObject) && writeBuffer(OString::number(nObject) + " 0 obj\n") + && writeBuffer(aBody) && writeBuffer("\nendobj\n\n"); +} + +bool PDFWriterImpl::writeCompressedObject(sal_Int32 nObject, std::string_view aBody) +{ + m_aCompressedObjects.emplace_back(nObject, OString(aBody)); + + return m_aCompressedObjects.size() < nMaxObjectsPerStream || emitObjectStream(); +} + +bool PDFWriterImpl::emitObjectStream() +{ + if (m_aCompressedObjects.empty()) + return true; + + // ISO 32000-2 7.5.7: /N pairs of object number and offset, then the bodies at /First + OStringBuffer aPairs(12 * m_aCompressedObjects.size()); + OStringBuffer aBodies(4096); + const sal_Int32 nStreamObject = createObject(); + for (const auto& rPending : m_aCompressedObjects) + { + aPairs.append(OString::number(rPending.m_nObject) + " " + + OString::number(aBodies.getLength()) + " "); + aBodies.append(rPending.m_aBody + "\n"); + } + + const sal_Int32 nFirst = aPairs.getLength(); + aPairs.append(aBodies.makeStringAndClear()); + const std::vector aStream(deflateBuffer(aPairs)); + if (aStream.empty()) + return false; + + OStringBuffer aLine(256); + aLine.append(OString::number(nStreamObject) + " 0 obj\n<(m_aCompressedObjects.size())) + "/First " + + OString::number(nFirst) + "/Length " + + OString::number(calculateStreamSize(aStream.size()))); + if (!g_bDebugDisableCompression) + aLine.append("/Filter/FlateDecode"); + aLine.append(">>\nstream\n"); + + if (!updateObject(nStreamObject) || !writeBuffer(aLine)) + return false; + + // ISO 32000-2 7.5.7: a string in here is not encrypted on its own, the stream holding + // it is, with the cipher set up for the stream's own object number + checkAndEnableStreamEncryption(nStreamObject); + // the strings inside are covered by nothing else, so stream encryption must really be on + assert((!m_aContext.Encryption.canEncrypt() + || (m_pPDFEncryptor && m_pPDFEncryptor->isStreamEncryptionEnabled())) + && "an object stream is going out unencrypted"); + const bool bBodies = writeBufferBytes(aStream.data(), aStream.size()); + disableStreamEncryption(); + if (!bBodies || !writeBuffer("\nendstream\nendobj\n\n")) + return false; + + // only now can an entry name the stream, which is in the file + sal_Int32 nIndex = 0; + for (const auto& rPending : m_aCompressedObjects) + { + m_aObjects[rPending.m_nObject - 1] + = { .m_nObjectStream = nStreamObject, .m_nIndex = nIndex }; + ++nIndex; + } + m_aCompressedObjects.clear(); + return true; +} + sal_Int32 PDFWriterImpl::emitStructParentTree( sal_Int32 nObject ) { if( nObject > 0 ) { OStringBuffer aLine( PDFWRITER_IMPL_BUFFERSIZE ); - aLine.append( OString::number(nObject) - + " 0 obj\n" - "<>\nendobj\n\n" ); - if (!updateObject(nObject)) - return 0; - if (!writeBuffer(aLine)) + aLine.append("]>>"); + if (!writeObject(nObject, aLine)) return 0; } return nObject; @@ -861,8 +979,7 @@ sal_Int32 PDFWriterImpl::emitStructIDTree(sal_Int32 const nObject) ids.emplace(GenerateID(n), n); } OStringBuffer buf; - COSWriter aWriter(buf, m_aContext.Encryption.getParams(), m_pPDFEncryptor); - appendObjectID(nObject, buf); + COSWriter aWriter(buf, m_aContext.Encryption.getParams(), getStringEncryptor(nObject)); buf.append("<>\nendobj\n\n"); + buf.append("] >>"); - if (!updateObject(nObject)) return 0; - if (!writeBuffer(buf)) return 0; + if (!writeObject(nObject, buf)) + return 0; return nObject; } @@ -1178,11 +1295,8 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle ) } OStringBuffer aLine( 512 ); - COSWriter aWriter(aLine, m_aContext.Encryption.getParams(), m_pPDFEncryptor); - aLine.append( - OString::number(rEle.m_nObject) - + " 0 obj\n" - "<>\nendobj\n\n" ); + aLine.append(">>"); - if (!updateObject(rEle.m_nObject)) return 0; - if (!writeBuffer(aLine)) return 0; + if (!writeObject(rEle.m_nObject, aLine)) + return 0; if (!emitStructParentTree(nParentTree)) return 0; if (!emitStructIDTree(nIDTree)) return 0; @@ -4551,6 +4665,13 @@ bool PDFWriterImpl::emitCatalog() addInternalStructureContainer(0); nStructureDict = m_aStructure[0].m_nObject = createObject(); emitStructure( m_aStructure[ 0 ] ); + if (!emitObjectStream()) + return false; + // whatever put its strings in plain has to have landed in an object stream; that the + // stream is encrypted is asserted where it is written + assert(std::ranges::all_of(m_aPlainStringObjects, [this](sal_Int32 nPlain) { + return m_aObjects[nPlain - 1].isCompressed(); + })); } // adjust tree node file offset @@ -5425,34 +5546,41 @@ bool PDFWriterImpl::emitTrailer() { nSecObject = emitEncrypt(); } - // emit xref table - // remember start + // a cross-reference table cannot address an object inside an object stream + const bool bXRefStream = std::ranges::any_of(m_aObjects, &ObjectLocation::isCompressed); + sal_uInt64 nXRefOffset = 0; - if (osl::File::E_None != m_aFile.getPos(nXRefOffset)) - return false; - if (!writeBuffer("xref\n")) - return false; - - sal_Int32 nObjects = m_aObjects.size(); OStringBuffer aLine; - aLine.append( "0 " ); - aLine.append( static_cast(nObjects+1) ); - aLine.append( "\n" ); - aLine.append( "0000000000 65535 f \n" ); - if (!writeBuffer(aLine)) - return false; - - for( sal_Int32 i = 0; i < nObjects; i++ ) + if (!bXRefStream) { - aLine.setLength( 0 ); - OString aOffset = OString::number( m_aObjects[i] ); - for( sal_Int32 j = 0; j < (10-aOffset.getLength()); j++ ) - aLine.append( '0' ); - aLine.append( aOffset ); - aLine.append( " 00000 n \n" ); - SAL_WARN_IF( aLine.getLength() != 20, "vcl.pdfwriter", "invalid xref entry" ); + // emit the xref table, remembering where it starts + if (osl::File::E_None != m_aFile.getPos(nXRefOffset)) + return false; + if (!writeBuffer("xref\n")) + return false; + + aLine.append("0 "); + aLine.append(static_cast(m_aObjects.size() + 1)); + aLine.append("\n"); + aLine.append("0000000000 65535 f \n"); if (!writeBuffer(aLine)) return false; + + for (const auto& rLocation : m_aObjects) + { + if (rLocation.m_nOffset == SAL_MAX_UINT64) + { + SAL_WARN("vcl.pdfwriter", "object was created but never written"); + if (!writeBuffer("0000000000 65535 f \n")) + return false; + continue; + } + auto aOffset(OString::number(rLocation.m_nOffset)); + aLine = RepeatedChar('0', 10 - aOffset.length) + aOffset + " 00000 n \n"; + SAL_WARN_IF(aLine.getLength() != 20, "vcl.pdfwriter", "invalid xref entry"); + if (!writeBuffer(aLine)) + return false; + } } // prepare document checksum @@ -5463,9 +5591,6 @@ bool PDFWriterImpl::emitTrailer() // document id set in setDocInfo method // emit trailer aLine.setLength( 0 ); - aLine.append( "trailer\n" - "<(nObjects+1) ); aLine.append( "/Root " ); aLine.append( m_nCatalogObject ); aLine.append( " 0 R\n" ); @@ -5530,12 +5655,78 @@ bool PDFWriterImpl::emitTrailer() // Assertion failure: rv == SECSuccess, at sechash.c:140 m_DocDigest.initialize(); - aLine.append( ">>\n" - "startxref\n" ); - aLine.append( static_cast(nXRefOffset) ); - aLine.append( "\n" - "%%EOF\n" ); - return writeBuffer( aLine ); + if (bXRefStream) + return emitXRefStream(aLine); + + return writeBuffer("trailer\n<>\nstartxref\n" + OString::number(static_cast(nXRefOffset)) + + "\n%%EOF\n"); +} + +bool PDFWriterImpl::emitXRefStream(std::string_view aTrailerEntries) +{ + // ISO 32000-2 7.5.8.3 requires an entry for the stream itself + const sal_Int32 nXRefObject = createObject(); + sal_uInt64 nXRefOffset = 0; + if (osl::File::E_None != m_aFile.getPos(nXRefOffset)) + return false; + m_aObjects[nXRefObject - 1].m_nOffset = nXRefOffset; + + // the second field is a byte offset or an object stream number, so measure both + const auto aSecondField = [](const ObjectLocation& rLocation) -> sal_uInt64 { + if (rLocation.isCompressed()) + return rLocation.m_nObjectStream; + // an unwritten object gets a free entry, which has no offset + return rLocation.m_nOffset == SAL_MAX_UINT64 ? 0 : rLocation.m_nOffset; + }; + sal_Int32 nOffsetBytes = 1; + for (sal_uInt64 nWidest = std::ranges::max(m_aObjects | std::views::transform(aSecondField)); + nWidest > 0xff; nWidest >>= 8) + ++nOffsetBytes; + + OStringBuffer aEntries(static_cast((3 + nOffsetBytes) * (m_aObjects.size() + 1))); + auto appendEntry + = [&aEntries, nOffsetBytes](sal_uInt8 nType, sal_uInt64 nSecond, sal_uInt16 nThird) { + aEntries.append(char(nType)); + for (sal_Int32 nByte = nOffsetBytes; nByte-- > 0;) + aEntries.append(char(nSecond >> (8 * nByte))); + aEntries.append(char(nThird >> 8)); + aEntries.append(char(nThird)); + }; + + // object 0 heads the list of free objects, as it does in a table + appendEntry(0, 0, 0xffff); + for (const auto& rLocation : m_aObjects) + { + if (rLocation.isCompressed()) + appendEntry(2, rLocation.m_nObjectStream, rLocation.m_nIndex); + else if (rLocation.m_nOffset == SAL_MAX_UINT64) + appendEntry(0, 0, 0xffff); + else + appendEntry(1, rLocation.m_nOffset, 0); + } + + const std::vector aStream(deflateBuffer(aEntries)); + if (aStream.empty()) + return false; + + OStringBuffer aLine(512); + // 7.5.8.2: every entry of Table 17 shall be direct, and a reader cannot resolve an + // indirect /Length before it has read this stream + aLine.append(OString::number(nXRefObject) + " 0 obj\n<(m_aObjects.size() + 1)) + "/W[1 " + + OString::number(nOffsetBytes) + " 2]/Length " + + OString::number(static_cast(aStream.size()))); + if (!g_bDebugDisableCompression) + aLine.append("/Filter/FlateDecode"); + aLine.append(aTrailerEntries); + aLine.append(">>\nstream\n"); + + // 7.5.8.2 forbids encrypting this stream, so it goes out as built + return writeBuffer(aLine) && writeBufferBytes(aStream.data(), aStream.size()) + && writeBuffer("\nendstream\nendobj\n\nstartxref\n" + + OString::number(static_cast(nXRefOffset)) + "\n%%EOF\n"); } namespace { diff --git a/vcl/source/treelist/SvLBoxButton.cxx b/vcl/source/treelist/SvLBoxButton.cxx index 519a34d80125..c6419a501feb 100644 --- a/vcl/source/treelist/SvLBoxButton.cxx +++ b/vcl/source/treelist/SvLBoxButton.cxx @@ -142,7 +142,7 @@ void SvLBoxButton::ClickHdl(SvTreeListEntry* pEntry) } void SvLBoxButton::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry& /*rEntry*/) + const SvViewDataEntry& /*rView*/, const SvTreeListEntry& /*rEntry*/) { SvBmp nIndex = SvLBoxButtonData::GetIndex(m_nItemFlags); DrawImageFlags nStyle diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx index 17827a954104..d27039b6b604 100644 --- a/vcl/source/treelist/iconview.cxx +++ b/vcl/source/treelist/iconview.cxx @@ -167,7 +167,7 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n Point aEntryPos(nX, nY); auto popIt = rRenderContext.ScopedPush(vcl::PushFlags::FILLCOLOR | vcl::PushFlags::LINECOLOR - | vcl::PushFlags::FONT); + | vcl::PushFlags::FONT | vcl::PushFlags::TEXTCOLOR); const Color aBackupColor = rRenderContext.GetFillColor(); const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings(); @@ -252,7 +252,7 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n auto nItemHeight = SvLBoxItem::GetHeight(rViewDataEntry, nCurItem); nLabelYPos += nItemHeight; - rEntry.GetItem(nCurItem).Paint(aEntryPos, *this, rRenderContext, &rViewDataEntry, rEntry); + rEntry.GetItem(nCurItem).Paint(aEntryPos, *this, rRenderContext, rViewDataEntry, rEntry); } if (bFillColorSet) @@ -277,7 +277,7 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n } aEntryPos.AdjustY((nImageAreaHeight - nItemHeight) / 2 + m_nSpacing); - rItem.Paint(aEntryPos, *this, rRenderContext, &rViewDataEntry, rEntry); + rItem.Paint(aEntryPos, *this, rRenderContext, rViewDataEntry, rEntry); } } diff --git a/vcl/source/treelist/svlbitm.cxx b/vcl/source/treelist/svlbitm.cxx index 77f4053927bc..3b6225d66f24 100644 --- a/vcl/source/treelist/svlbitm.cxx +++ b/vcl/source/treelist/svlbitm.cxx @@ -71,9 +71,8 @@ namespace } } -void SvLBoxString::Paint( - const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) +void SvLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, + const SvViewDataEntry& /*rView*/, const SvTreeListEntry& rEntry) { DrawTextFlags nStyle = (rDev.IsEnabled() && !mbDisabled) ? DrawTextFlags::NONE : DrawTextFlags::Disable; if (rEntry.IsSeparator()) @@ -219,13 +218,13 @@ void SvLBoxContextBmp::InitViewData(SvTreeListBox& rView, SvTreeListEntry& rEntr pViewData->mnHeight = aSize.Height(); } -void SvLBoxContextBmp::Paint( - const Point& _rPos, SvTreeListBox& _rDev, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) +void SvLBoxContextBmp::Paint(const Point& _rPos, SvTreeListBox& _rDev, + vcl::RenderContext& rRenderContext, const SvViewDataEntry& rView, + const SvTreeListEntry& rEntry) { // get the image. - const Image& rImage = !pView->IsExpanded() ? m_aImage1 : m_aImage2; + const Image& rImage = !rView.IsExpanded() ? m_aImage1 : m_aImage2; bool _bSemiTransparent = bool( SvTLEntryFlags::SEMITRANSPARENT & rEntry.GetFlags( ) ); // draw diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index a5857ea5ae9e..e0dcfd7ca2bb 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -2928,7 +2928,7 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, tools::Long nLine, vcl: // center vertically aEntryPos.AdjustY((nTempEntryHeight - aSize.Height()) / 2 ); - rItem.Paint(aEntryPos, *this, rRenderContext, &rViewDataEntry, rEntry); + rItem.Paint(aEntryPos, *this, rRenderContext, rViewDataEntry, rEntry); // division line between tabs (but not if this is a separator line) if (!bSeparator && pNextTab && rItem.GetType() == SvLBoxItemType::String && diff --git a/vcl/source/window/colorpicker.cxx b/vcl/source/window/colorpicker.cxx index d7ef32922567..f31ca8c578b4 100644 --- a/vcl/source/window/colorpicker.cxx +++ b/vcl/source/window/colorpicker.cxx @@ -417,7 +417,6 @@ void ColorFieldControl::UpdatePosition() ColorSliderControl::ColorSliderControl() : meMode( DefaultMode ) - , mnLevel( 0 ) , mdValue( -1.0 ) { } @@ -519,7 +518,6 @@ void ColorSliderControl::ChangePosition(tools::Long nY) else if (nY > nHeight) nY = nHeight; - mnLevel = nY; mdValue = double(nHeight - nY) / double(nHeight); } @@ -567,6 +565,7 @@ void ColorSliderControl::Resize() { CustomWidgetController::Resize(); UpdateBitmap(); + maResizeHdl.Call(*this); } void ColorSliderControl::Modify() @@ -581,7 +580,6 @@ void ColorSliderControl::SetValue(const Color& rColor, ColorMode eMode, double d { maColor = rColor; mdValue = dValue; - mnLevel = static_cast((1.0-dValue) * GetOutputSizePixel().Height()); meMode = eMode; if (bUpdateBitmap) UpdateBitmap(); @@ -618,6 +616,7 @@ ColorPickerDialog::ColorPickerDialog(weld::Window* pParent, const Color& rColor, { m_aColorField.SetModifyHdl( LINK( this, ColorPickerDialog, ColorFieldControlModifydl ) ); m_aColorSlider.SetModifyHdl( LINK( this, ColorPickerDialog, ColorSliderControlModifyHdl ) ); + m_aColorSlider.SetResizeHdl(LINK(this, ColorPickerDialog, ColorSliderResizeHdl)); int nMargin = (m_xFISliderLeft->get_preferred_size().Height() + 1) / 2; m_xColorSlider->set_margin_top(nMargin); @@ -648,6 +647,9 @@ ColorPickerDialog::ColorPickerDialog(weld::Window* pParent, const Color& rColor, m_xRBSaturation->connect_toggled( aLink2 ); m_xRBBrightness->connect_toggled( aLink2 ); + // tdf#108295 - set the initial focus explicitly to the first input field + m_xMFRed->grab_focus(); + if (eDialogMode == vcl::ColorPickerMode::Modify) m_xColorPrevious->show(); @@ -677,6 +679,9 @@ void ColorPickerDialog::SetColor(const Color& rColor) RGBtoCMYK(mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey); update_color(); + + // tdf#108295 - select the first field content so a new value can be typed directly + m_xMFRed->select_region(0, -1); } void ColorPickerDialog::update_color( UpdateFlags n ) @@ -763,12 +768,12 @@ void ColorPickerDialog::update_color( UpdateFlags n ) } } + // tdf#171730 - always sync slider markers with current slider level + m_xFISliderLeft->set_margin_top(m_aColorSlider.GetLevel()); + m_xFISliderRight->set_margin_top(m_aColorSlider.GetLevel()); + if (n & UpdateFlags::Hex) // update hex - { - m_xFISliderLeft->set_margin_top(m_aColorSlider.GetLevel()); - m_xFISliderRight->set_margin_top(m_aColorSlider.GetLevel()); m_xEDHex->SetColor(aColor); - } m_aColorPreview.SetColor(aColor); } @@ -836,6 +841,13 @@ IMPL_LINK_NOARG(ColorPickerDialog, ColorSliderControlModifyHdl, ColorSliderContr update_color(UpdateFlags::All & ~UpdateFlags::ColorSlider); } +IMPL_LINK_NOARG(ColorPickerDialog, ColorSliderResizeHdl, ColorSliderControl&, void) +{ + // tdf#171730 - sync slider markers with current slider level + m_xFISliderLeft->set_margin_top(m_aColorSlider.GetLevel()); + m_xFISliderRight->set_margin_top(m_aColorSlider.GetLevel()); +} + IMPL_LINK(ColorPickerDialog, ColorModifyMetricHdl, weld::MetricSpinButton&, rEdit, void) { UpdateFlags n = UpdateFlags::NONE; diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 2599f2a860bd..d45aedb6125e 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -359,13 +359,13 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap() // tdf#141761 // The display quality of the Preview is pretty ugly when // FormControls are used. I made a deep-dive why this happens, - // and in principle the reason is the Mteafile::Scale used + // and in principle the reason is the Metafile::Scale used // below. Since Metafile actions are integer, that floating point // scale leads to rounding errors that make the lines painting // the FormControls disappear in the surrounding ClipRegions. - // That Scale cannot be avoided since the Metafile contains it's + // That Scale cannot be avoided since the Metafile contains its // own SetMapMode commands which *will* be executed on ::Play, - // so the ::Scale is the only possibility fr Metafile currently: + // so the ::Scale is the only possibility for Metafile currently: // Giving a Size as parameter in ::Play will *not* work due to // the relativeMapMode that gets created will fail on // ::SetMapMode actions in the Metafile - and FormControls DO @@ -393,7 +393,7 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap() // memory problems, still limit to a useful factor is // necessary, also empirically estimated to // avoid the quality from collapsing (using a direct - // in-between , ceil'd result) + // in-between, ceil'd result) static const double fMaximumQualitySquare(1396221.0); if(fNewNeededPixels > fMaximumQualitySquare) @@ -586,6 +586,7 @@ PrintDialog::PrintDialog(weld::Window* i_pWindow, std::shared_ptrgetValue(u"PageRange"_ustr); @@ -663,6 +664,10 @@ PrintDialog::PrintDialog(weld::Window* i_pWindow, std::shared_ptrgetMultipage() ); // setup optional UI options set by application @@ -1031,6 +1036,12 @@ IMPL_LINK_NOARG(PrintDialog, updatePreviewIdle, Timer*, void) preparePreview(std::exchange(mbUseCacheForPreview, true)); } +IMPL_LINK_NOARG(PrintDialog, PageRangeUpdateTimerHdl, Timer*, void) +{ + schedulePreviewUpdate(false); +} + + void PrintDialog::preparePreview( bool i_bMayUseCache ) { VclPtr aPrt( maPController->getPrinter() ); @@ -1169,17 +1180,7 @@ void PrintDialog::updatePageRange(sal_Int32 nPages) pContentVal->Value >>= nContent; if (nContent == 1) - { - OUString sRange; - if (nPages == 1) - sRange = u"1"_ustr; - else - sRange = u"1-"_ustr + OUString::number(nPages); - - mxPageRangeEdit->set_text(sRange); - maPController->setValue(u"PageRange"_ustr, Any(sRange)); - return; - } + return; // User-controlled page range OUString sRange; @@ -1203,7 +1204,6 @@ void PrintDialog::updatePageRange(sal_Int32 nPages) return; } - mxPageRangeEdit->set_text(sRange); maPController->setValue(u"PageRange"_ustr, Any(sRange)); } @@ -1899,7 +1899,10 @@ void PrintDialog::setupOptionalUI() PropertyValue* pVal = maPController->getValue( aPropertyName ); if( pVal && pVal->Value.hasValue() ) pVal->Value >>= aCurVal; - xField->set_text( aCurVal ); + if (aPropertyName != "PageRange") + { + xField->set_text( aCurVal ); + } xField->connect_changed( LINK( this, PrintDialog, UIOption_EntryModifyHdl ) ); xField->show(); @@ -2495,8 +2498,11 @@ IMPL_LINK(PrintDialog, UIOption_EntryModifyHdl, weld::TextWidget&, i_rBox, void) checkOptionalControlDependencies(); - // update preview and page settings - schedulePreviewUpdate(false); + if (pVal->Name == "PageRange") + maPageRangeUpdateTimer.Start(); + else + schedulePreviewUpdate(false); + } } diff --git a/wizards/source/scriptforge/SF_FileSystem.xba b/wizards/source/scriptforge/SF_FileSystem.xba index fd166ed524dc..1d7eda971a25 100644 --- a/wizards/source/scriptforge/SF_FileSystem.xba +++ b/wizards/source/scriptforge/SF_FileSystem.xba @@ -54,6 +54,14 @@ Option Explicit ''' The file manifest.xml is managed automatically. ''' The FileNaming setting is ignored. ''' +''' The FileSystem service provides also simple methods to extract files from or load files +''' into archive (zip) files. +''' .odf and .oxt files being compressed files, direct vreation or update of such files (with care !) is made easy. +''' Note that multipart and encrypted zip files are not supported. +''' +''' The service provides symbolic names for a number of system folders (home, LibreOffice install, ...) +''' that contribute to improving the portability of user scripts. +''' ''' Service invocation example: ''' Dim FSO As Variant ''' Set FSO = CreateScriptService("FileSystem") @@ -377,6 +385,96 @@ CatchNotSupported: GoTo Finally End Function ' ScriptForge.SF_FileSystem.CompareFiles +REM ----------------------------------------------------------------------------- +Public Function CompressToZip(Optional ByVal FileName As Variant _ + , Optional ByVal FolderName As Variant _ + , Optional ByVal RootFolder As Variant _ + ) As Variant +''' Stores the content of Folder, including its subfolders, into a zip archive. +''' Encrypted archives are not supported. +''' The compressed files are stored optionally under a RootFolder. +''' Files existing already in the archive are not overwritten. +''' The method is not supported for document's internal file systems. +''' Args: +''' FileName: A string representing the zip file. +''' If it does not exist, the archive is created, oncluding its parent folders. +''' All files present in the archive are kept untouched. +''' FolderName: The folder to compress, as a string. +''' All files and subfolders are included. The Folder itself is not. +''' RootFolder: When absent, files and folders are loaded in the archive from the root ("/"). +''' When a RootFolder is given, as a string without path separator, they are stored below that folder. +''' Returns: +''' True when successful. +''' When False, an error message might be found in the console. +''' Exceptions: +''' UNKNOWNFOLDERERROR Source folder does not exist +''' NOTAFOLDERERROR The folder is a file, not a folder +''' FILESYSTEMERROR The method is not applicable on document's file systems +''' Example: +''' a = SF_FileSystem.CompressToZip("C:\archive.zip", Folder := "C:\Downloads") + +Dim bCompress As Boolean ' Return value +Dim vCompress As Variant ' Returned from Python (True/False, error message) +Dim sFile As String ' Alias of FileName +Dim sMode As String ' a = append, file exists - x = exclusive read/write +Dim sParentFolder As String ' Parent folder of FileName +Dim vRootFolder As Variant ' Alias of RootFolder +Const cstPyHelper = "$" & "_SF_FileSystem__CompressToZip" +Const cstThisSub = "FileSystem.CompressToZip" +Const cstSubArgs = "FileName, FolderName, [RootFolder=""""]" + + If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch + bCompress = False + +Check: + If IsMissing(RootFolder) Or IsEmpty(RootFolder) Then RootFolder = "" + If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then + If Not SF_Utils._ValidateFile(FileName, "FileName") Then GoTo Finally + If Not SF_Utils._ValidateFile(FolderName, "FolderName") Then GoTo Finally + If Not SF_Utils._Validate(RootFolder, "RootFolder", V_STRING) Then GoTo Finally + End If + If SF_FileSystem._IsDocFileSystem(FileName) Then GoTo CatchNotSupported + + If SF_FileSystem.FileExists(FolderName) Then GoTo CatchFileNotFolder + If Not SF_FileSystem.FolderExists(FolderName) Then GoTo CatchFolderNotExists + +Try: + With ScriptForge.SF_FileSystem + ' Append (a) or exclusive create (x) mode ? Eventually, create parent folder + If .FileExists(FileName) Then + sMode = "a" + Else + sParentFolder = .GetParentFolderName(FileName) + If Not .FolderExists(sParentFolder) Then .CreateFolder(sParentFolder) + sMode = "x" + End If + If Len(RootFolder) > 0 Then vRootFolder = RootFolder Else vRootFolder = Null + With ScriptForge.SF_Session + ' Python requires OS notation for files and folders + vCompress = .ExecutePythonScript(.SCRIPTISSHARED, _SF_.PythonHelper & cstPyHelper _ + , _ConvertFromUrl(FileName), sMode, ConvertFromUrl(FolderName), vRootFolder) + End With + bCompress = vCompress(0) + If Not bCompress Then SF_Exception.DebugPrint("CompressToZip", vCompress(1)) + End With + +Finally: + CompressToZip = bCompress + SF_Utils._ExitFunction(cstThisSub) + Exit Function +Catch: + GoTo Finally +CatchFolderNotExists: + SF_Exception.RaiseFatal(UNKNOWNFOLDERERROR, "FolderName", FolderName) + GoTo Finally +CatchFileNotFolder: + SF_Exception.RaiseFatal(NOTAFOLDERERROR, "FolderName", FolderName) + GoTo Finally +CatchNotSupported: + SF_Exception.RaiseFatal(FILESYSTEMERROR, "FileName", Split(cstThisSub, ".")(1), FileName) + GoTo Finally +End Function ' ScriptForge.SF_FileSystem.CompressToZip + REM ----------------------------------------------------------------------------- Public Function CopyFile(Optional ByVal Source As Variant _ , Optional ByVal Destination As Variant _ @@ -725,6 +823,85 @@ Catch: GoTo Finally End Function ' ScriptForge.SF_FileSystem.ExtensionFolder +REM ----------------------------------------------------------------------------- +Public Function ExtractFromZip(Optional ByVal FileName As Variant _ + , Optional ByVal Destination As Variant _ + , Optional ByVal Source As Variant _ + ) As Variant +''' Extracts a list of files contained in a zip container and stores them in a folder. +''' The process ends at the first error. Existing files are overwritten without warning. +''' The method is not supported for document's internal file systems. +''' Args: +''' FileName: A string representing a zip file +''' Destination: The folder where to extract the compressed files to. +''' Existing files with the same names are overwritten. Other files stay untouched. +''' When the folder does not exist, it is created, as are subfolders. +''' Source: A single string or an array of strings with valid names of files contained in the zip file +''' When Source is omitted, is an empty array or an empty string, all the files and folders are extracted. +''' Returns: +''' True when successful. +''' When False, an error message might be found in the console. +''' Exceptions: +''' UNKNOWNFILEERROR The file does not exist or is a folder +''' FILESYSTEMERROR The method is not applicable on document's file systems +''' Example: +''' a = SF_FileSystem.ExtractFromZip("C:\writerdoc.odt", Source := Array("content.xml", "meta.xml"), Desctination := "C:\TEMP") + +Dim bExtract As Boolean ' Return value +Dim vExtract As Variant ' Returned from Python (True/False, error message) +Dim vSource As Variant ' Alias of Source +Const cstPyHelper = "$" & "_SF_FileSystem__ExtractFromZip" +Const cstThisSub = "FileSystem.ExtractFromZip" +Const cstSubArgs = "FileName, Destination, [Source=""""]" + + If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch + bExtract = False + +Check: + If IsMissing(Source) Or IsEmpty(Source) Then Source = "" + If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then + If Not SF_Utils._ValidateFile(FileName, "FileName") Then GoTo Finally + If Not SF_Utils._ValidateFile(Destination, "Destination") Then GoTo Finally + If IsArray(Source) Then + If Not SF_Utils._ValidateArray(Source, "Source", 1, V_STRING) Then GoTo Finally + Else + If Not SF_Utils._Validate(Source, "Source", V_STRING) Then GoTo Finally + End If + End If + If SF_FileSystem._IsDocFileSystem(FileName) Then GoTo CatchNotSupported + +Try: + If SF_FileSystem.FileExists(FileName) Then + With ScriptForge.SF_Session + ' Be sure to pass an array to the Python script + If Not IsArray(Source) Then + If Len(Source) = 0 Then vSource = Array() Else vSource = Array(Source) + Else + vSource = Source + End If + vExtract = .ExecutePythonScript(.SCRIPTISSHARED, _SF_.PythonHelper & cstPyHelper _ + , _ConvertFromUrl(FileName), Destination, vSource) + bExtract = vExtract(0) + If Not bExtract Then SF_Exception.DebugPrint("ExtractFromZip", vExtract(1)) + End With + Else + GoTo CatchNotExists + End If + +Finally: + ExtractFromZip = bExtract + SF_Utils._ExitFunction(cstThisSub) + Exit Function +Catch: + GoTo Finally +CatchNotExists: + SF_Exception.RaiseFatal(UNKNOWNFILEERROR, "FileName", FileName) + GoTo Finally +CatchNotSupported: + SF_Exception.RaiseFatal(FILESYSTEMERROR, "FileName", Split(cstThisSub, ".")(1), FileName) + GoTo Finally +End Function ' ScriptForge.SF_FileSystem.ExtractFromZip + REM ----------------------------------------------------------------------------- Public Function FileExists(Optional ByVal FileName As Variant) As Boolean ''' Return True if the given file exists @@ -829,6 +1006,74 @@ CatchFolder: GoTo Finally End Function ' ScriptForge.SF_FileSystem.Files +REM ----------------------------------------------------------------------------- +Public Function FilesInZip(Optional ByVal FileName As Variant _ + , Optional ByVal Pattern As Variant _ + ) As Variant +''' Returns The list of the files contained in a zip container. +''' The list of names may optionally be filtered. +''' The method is not supported for document's internal file systems. +''' Args: +''' FileName: A string representing a zip file +''' Pattern: A pattern as a not case-sensitive string containing 0 or more wildcards +''' Admitted wildcard are: the "?" represents any single character +''' the "*" represents zero, one, or multiple characters +''' Returns: +''' An unordered array of file names without a heading slash. +''' The path separator is always the slash ("/"), also on Windows. +''' The list may be filtered with a name pattern. Without pattern, all files are returned. +''' The resulting array may be empty. +''' An empty array is returned when the file is not a valid zip file. +''' Exceptions: +''' UNKNOWNFILEERROR The file does not exist or is a folder +''' FILESYSTEMERROR The method is not applicable on document's file systems +''' Example: +''' a = SF_FileSystem.FilesInZip("C:\writerdoc.odt", Pattern := "*.xml") + +Dim vFiles As Variant ' Return value +Const cstPyHelper = "$" & "_SF_FileSystem__FilesInZip" +Const cstThisSub = "FileSystem.FilesInZip" +Const cstSubArgs = "FileName, [Pattern=""""]" + + If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch + vFiles = Array() + +Check: + If IsMissing(Pattern) Or IsEmpty(Pattern) Then Pattern = "" + If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then + If Not SF_Utils._ValidateFile(FileName, "FileName") Then GoTo Finally + If Not SF_Utils._Validate(Pattern, "Pattern", V_STRING) Then GoTo Finally + End If + If SF_FileSystem._IsDocFileSystem(FileName) Then GoTo CatchNotSupported + +Try: + If SF_FileSystem.FileExists(FileName) Then + With ScriptForge.SF_Session + vFiles = .ExecutePythonScript(.SCRIPTISSHARED, _SF_.PythonHelper & cstPyHelper _ + , _ConvertFromUrl(FileName)) + End With + ' Filter files based on pattern + If Len(Pattern) > 0 And UBound(vFiles) > -1 Then + vFiles = ScriptForge.SF_Array.Filter(ScriptForge.SF_String, "IsLike", vFiles, Pattern, False) + End If + Else + GoTo CatchNotExists + End If + +Finally: + FilesInZip = vFiles + SF_Utils._ExitFunction(cstThisSub) + Exit Function +Catch: + GoTo Finally +CatchNotExists: + SF_Exception.RaiseFatal(UNKNOWNFILEERROR, "FileName", FileName) + GoTo Finally +CatchNotSupported: + SF_Exception.RaiseFatal(FILESYSTEMERROR, "FileName", Split(cstThisSub, ".")(1), FileName) + GoTo Finally +End Function ' ScriptForge.SF_FileSystem.FilesInZip + REM ----------------------------------------------------------------------------- Public Function FolderExists(Optional ByVal FolderName As Variant) As Boolean ''' Return True if the given folder name exists @@ -1293,12 +1538,65 @@ CatchNotSupported: GoTo Finally End Function ' ScriptForge.SF_FileSystem.HashFile +REM ----------------------------------------------------------------------------- +Public Function IsZipFile(Optional ByVal FileName As Variant) As Boolean +''' Returns True if filename is a valid ZIP file based on its magic number. +''' The method is not supported for document's internal file systems. +''' Args: +''' FileName: a string representing a file +''' Returns: +''' True when FileName is a valid zip file. Otherwise False. +''' Exceptions: +''' UNKNOWNFILEERROR The file does not exist or is a folder +''' FILESYSTEMERROR The method is not applicable on document's file systems +''' Example: +''' MsgBox SF_FileSystem.IsZipFile("C:\writerdoc.odt") + +Dim bIsZip As Boolean ' Return value +Const cstPyHelper = "$" & "_SF_FileSystem__IsZipFile" +Const cstThisSub = "FileSystem.IsZipFile" +Const cstSubArgs = "FileName" + + If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch + bIsZip = False + +Check: + If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then + If Not SF_Utils._ValidateFile(FileName, "FileName") Then GoTo Finally + End If + If SF_FileSystem._IsDocFileSystem(FileName) Then GoTo CatchNotSupported + +Try: + If SF_FileSystem.FileExists(FileName) Then + With ScriptForge.SF_Session + bIsZip = .ExecutePythonScript(.SCRIPTISSHARED, _SF_.PythonHelper & cstPyHelper _ + , _ConvertFromUrl(FileName)) + End With + Else + GoTo CatchNotExists + End If + +Finally: + IsZipFile = bIsZip + SF_Utils._ExitFunction(cstThisSub) + Exit Function +Catch: + GoTo Finally +CatchNotExists: + SF_Exception.RaiseFatal(UNKNOWNFILEERROR, "FileName", FileName) + GoTo Finally +CatchNotSupported: + SF_Exception.RaiseFatal(FILESYSTEMERROR, "FileName", Split(cstThisSub, ".")(1), FileName) + GoTo Finally +End Function ' ScriptForge.SF_FileSystem.IsZipFile + REM ----------------------------------------------------------------------------- Public Function Methods() As Variant ''' Return the list or methods of the FileSystem service as an array Methods = Array("BuildPath" _ , "CompareFiles" _ + , "CompressToZip" _ , "CopyFile" _ , "CopyFolder" _ , "CreateFolder" _ @@ -1306,8 +1604,10 @@ Public Function Methods() As Variant , "DeleteFile" _ , "DeleteFolder" _ , "ExtensionFolder" _ + , "ExtractFromZip" _ , "FileExists" _ , "Files" _ + , "FilesInZip" _ , "FolderExists" _ , "GetBaseName" _ , "GetExtension" _ @@ -1317,6 +1617,7 @@ Public Function Methods() As Variant , "GetParentFolderName" _ , "GetTempName" _ , "HashFile" _ + , "IsZipFile" _ , "MoveFile" _ , "MoveFolder" _ , "Normalize" _ diff --git a/wizards/source/scriptforge/python/ScriptForgeHelper.py b/wizards/source/scriptforge/python/ScriptForgeHelper.py index f2fe8db8aebc..5604df51bf5f 100644 --- a/wizards/source/scriptforge/python/ScriptForgeHelper.py +++ b/wizards/source/scriptforge/python/ScriptForgeHelper.py @@ -22,26 +22,28 @@ # distributed with this file, see http://www.gnu.org/licenses/ . """ -Collection of Python helper functions called from the ScriptForge Basic libraries -to execute specific services that are not or not easily available from Basic directly. -When relevant, the methods present in the ScriptForge Python module (scriptforge.py) might call the -functions below for compatibility reasons. -""" + Collection of Python helper functions called from the ScriptForge Basic libraries + to execute specific services that are not or not easily available from Basic directly. + When relevant, the methods present in the ScriptForge Python module (scriptforge.py) may call the + functions below directly to bypass the Python-Basic bridge. + """ import getpass import os import platform import hashlib import filecmp +import pathlib +import zipfile import webbrowser import json class _Singleton(type): """ - A Singleton design pattern - Credits: « Python in a Nutshell » by Alex Martelli, O'Reilly - """ + A Singleton design pattern + Credits: « Python in a Nutshell » by Alex Martelli, O'Reilly + """ instances = {} def __call__(cls, *args, **kwargs): @@ -57,8 +59,8 @@ class _Singleton(type): def _SF_Dictionary__ConvertToJson(propval, indent = None) -> str: # used by Dictionary.ConvertToJson() Basic method """ - Given an array of PropertyValues as argument, convert it to a JSON string - """ + Given an array of PropertyValues as argument, convert it to a JSON string + """ # Array of property values => Dict(ionary) => JSON pvDict = {} for pv in propval: @@ -66,11 +68,12 @@ def _SF_Dictionary__ConvertToJson(propval, indent = None) -> str: return json.dumps(pvDict, indent=indent, skipkeys=True) -def _SF_Dictionary__ImportFromJson(jsonstr: str): # used by Dictionary.ImportFromJson() Basic method - """ - Given a JSON string as argument, convert it to a list of tuples (name, value) - The value must not be a (sub)dict. This doesn't pass the python-basic bridge. +def _SF_Dictionary__ImportFromJson(jsonstr: str) -> list: + # used by Dictionary.ImportFromJson() Basic method """ + Given a JSON string as argument, convert it to a list of tuples (name, value) + The value must not be a (sub)dict. This doesn't pass the python-basic bridge. + """ # JSON => Dictionary => Array of tuples/lists dico = json.loads(jsonstr) result = [] @@ -94,9 +97,9 @@ def _SF_Dictionary__ImportFromJson(jsonstr: str): # used by Dictionary.ImportFr def _SF_Exception__PythonPrint(string: str) -> bool: # used by SF_Exception.PythonPrint() Basic method """ - Write the argument to stdout. - If the APSO shell console is active, the argument will be displayed in the console window - """ + Write the argument to stdout. + If the APSO shell console is active, the argument will be displayed in the console window + """ print(string) return True @@ -108,27 +111,84 @@ def _SF_Exception__PythonPrint(string: str) -> bool: def _SF_FileSystem__CompareFiles(filename1: str, filename2: str, comparecontents=True) -> bool: # used by SF_FileSystem.CompareFiles() Basic method """ - Compare the 2 files, returning True if they seem equal, False otherwise. - By default, only their signatures (modification time, ...) are compared. - When comparecontents == True, their contents are compared. - """ + Compare the 2 files, returning True if they seem equal, False otherwise. + By default, only their signatures (modification time, ...) are compared. + When comparecontents == True, their contents are compared. + """ try: return filecmp.cmp(filename1, filename2, not comparecontents) except Exception: return False -def _SF_FileSystem__GetFilelen(systemfilepath: str) -> str: # used by SF_FileSystem.GetFilelen() Basic method +def _SF_FileSystem__CompressToZip(filename: str, mode: str, folder: str, rootfolder: str = None) -> tuple[bool, str]: + # used by SF_FileSystem.CompressToZip() Basic method + """ + Stores the content of folder, including its subfolders, into a zip archive. + The mode argument determines if the zip file is created (e'x'clusive create) or not ('a'ppend). + The compressed files are stored optionally under a root folder. + """ + try: + if mode == 'a': # existence of filename is checked in the calling routine + if not zipfile.is_zipfile(filename): + return False, "File is not a zip archive: '%s'" % filename + directory = pathlib.Path(folder) + # Write compressed files under root or under the given root folder. Normal slashes are required, also in Windows.. + topfolder = (None if rootfolder is None else pathlib.PurePosixPath(rootfolder + '/')) + with zipfile.ZipFile(filename, mode, strict_timestamps = False) as archive: + for filepath in directory.rglob('*'): + name = (filepath.relative_to(directory) if topfolder is None + else topfolder.joinpath(filepath.relative_to(directory))) + archive.write(filepath, arcname = name, compress_type = zipfile.ZIP_DEFLATED) + return True, '' + except Exception as e: + return False, str(e) + + +def _SF_FileSystem__ExtractFromZip(filename: str, destination: str, source: tuple = ()) -> tuple[bool, str]: + # used by SF_FileSystem.ExtractFromZip() Basic method + """ + Stores the source file(s) found in the given ZIP file into a destination folder. + """ + try: + if not zipfile.is_zipfile(filename): + return False, "File is not a zip archive: '%s'" % filename + with zipfile.ZipFile(filename, mode = 'r') as archive: + archive.extractall(destination, members = (None if len(source) == 0 else source)) + return True, '' + except Exception as e: + return False, str(e) + + +def _SF_FileSystem__FilesInZip(filename: str) -> list: + # used by SF_FileSystem.FilesInZip() Basic method + """ + Returns a list of archive members by name. The objects are in the same order as their entries + in the given ZIP file. + """ + try: + if not zipfile.is_zipfile(filename): + return [] + with zipfile.ZipFile(filename, mode = 'r') as archive: + namelist = archive.namelist() + return namelist + except Exception: + return [] + + +def _SF_FileSystem__GetFilelen(systemfilepath: str) -> str: + # used by SF_FileSystem.GetFilelen() Basic method return str(os.path.getsize(systemfilepath)) -def _SF_FileSystem__HashFile(filename: str, algorithm: str) -> str: # used by SF_FileSystem.HashFile() Basic method - """ - Hash a given file with the given hashing algorithm - cfr. https://www.pythoncentral.io/hashing-files-with-python/ - Example - hash = _SF_FileSystem__HashFile('myfile.txt','MD5') +def _SF_FileSystem__HashFile(filename: str, algorithm: str) -> str: + # used by SF_FileSystem.HashFile() Basic method """ + Hash a given file with the given hashing algorithm + cfr. https://www.pythoncentral.io/hashing-files-with-python/ + Example + hash = _SF_FileSystem__HashFile('myfile.txt','MD5') + """ algo = algorithm.lower() try: if algo in hashlib.algorithms_guaranteed: @@ -159,13 +219,21 @@ def _SF_FileSystem__HashFile(filename: str, algorithm: str) -> str: # used by S return '' +def _SF_FileSystem__IsZipFile(filename: str) -> bool: + # used by SF_FileSystem.IsZipFile() Basic method + """ + Returns True if filename is a valid ZIP file based on its magic number, otherwise returns False. + """ + return zipfile.is_zipfile(filename) + + def _SF_FileSystem__Normalize(systemfilepath: str) -> str: # used by SF_FileSystem.Normalize() Basic method """ - Normalize a pathname by collapsing redundant separators and up-level references so that - A//B, A/B/, A/./B and A/foo/../B all become A/B. - On Windows, it converts forward slashes to backward slashes. - """ + Normalize a pathname by collapsing redundant separators and up-level references so that + A//B, A/B/, A/./B and A/foo/../B all become A/B. + On Windows, it converts forward slashes to backward slashes. + """ return os.path.normpath(systemfilepath) @@ -175,8 +243,8 @@ def _SF_FileSystem__Normalize(systemfilepath: str) -> str: def _SF_Platform(propertyname: str): # used by SF_Platform Basic module """ - Switch between SF_Platform properties (read the documentation about the ScriptForge.Platform service) - """ + Switch between SF_Platform properties (read the documentation about the ScriptForge.Platform service) + """ pf = Platform() if propertyname == 'Architecture': return pf.Architecture @@ -249,8 +317,8 @@ class Platform(object, metaclass = _Singleton): def _SF_Session__OpenURLInBrowser(url: str): # Used by SF_Session.OpenURLInBrowser() Basic method """ - Display url using the default browser - """ + Display url using the default browser + """ try: webbrowser.open(url, new = 2) except Exception: # whatever happened, continue the execution ... @@ -264,10 +332,10 @@ def _SF_Session__OpenURLInBrowser(url: str): # Used by SF_Session.OpenURLInBr def _SF_String__HashStr(string: str, algorithm: str) -> str: # used by SF_String.HashStr() Basic method """ - Hash a given UTF-8 string with the given hashing algorithm - Example - hash = _SF_String__HashStr('This is a UTF-8 encoded string.','MD5') - """ + Hash a given UTF-8 string with the given hashing algorithm + Example + hash = _SF_String__HashStr('This is a UTF-8 encoded string.','MD5') + """ algo = algorithm.lower() try: if algo in hashlib.algorithms_guaranteed: @@ -301,6 +369,7 @@ def _SF_String__HashStr(string: str, algorithm: str) -> str: # used by SF_Strin g_exportedScripts = () if __name__ == "__main__": + """ print(_SF_Platform('Architecture')) print(_SF_Platform('ComputerName')) print(_SF_Platform('CPUCount')) @@ -323,10 +392,13 @@ if __name__ == "__main__": # _SF_Session__OpenURLInBrowser('https://docs.python.org/3/library/webbrowser.html') # js = """ - {"firstName": "John","lastName": "Smith","isAlive": true,"age": 27, + """{"firstName": "John","lastName": "Smith","isAlive": true,"age": 27, "address": {"streetAddress": "21 2nd Street","city": "New York","state": "NY","postalCode": "10021-3100"}, "phoneNumbers": [{"type": "home","number": "212 555-1234"},{"type": "office","number": "646 555-4567"}], "children": ["Q", "M", "G", "T"],"spouse": null} """ - arr = _SF_Dictionary__ImportFromJson(js) - print(arr) + """arr = _SF_Dictionary__ImportFromJson(js) + print(arr)""" + a = "/tmp/SF_YYY/zipped.odt" + b = _SF_FileSystem__CompressToZip(a, "a", "/tmp/SF_XXX", "New") + print(b) \ No newline at end of file diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 2f54e5462f0a..cf86a1ca2e09 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1220,6 +1220,9 @@ class SFScriptForge: else: return False + def CompressToZip(self, filename, foldername, rootfolder = ''): + return self.ExecMethod(self.vbMethod, 'CompressToZip', filename, foldername, rootfolder) + def CopyFile(self, source, destination, overwrite = True): return self.ExecMethod(self.vbMethod, 'CopyFile', source, destination, overwrite) @@ -1241,12 +1244,18 @@ class SFScriptForge: def ExtensionFolder(self, extension): return self.ExecMethod(self.vbMethod, 'ExtensionFolder', extension) + def ExtractFromZip(self, filename, destination, source = ''): + return self.ExecMethod(self.vbMethod, 'ExtractFromZip', filename, destination, source) + def FileExists(self, filename): return self.ExecMethod(self.vbMethod, 'FileExists', filename) def Files(self, foldername, filter = '', includesubfolders = False): return self.ExecMethod(self.vbMethod, 'Files', foldername, filter, includesubfolders) + def FilesInZip(self, filename, pattern = ''): + return self.ExecMethod(self.vbMethod, 'FilesInZip', filename, pattern) + def FolderExists(self, foldername): return self.ExecMethod(self.vbMethod, 'FolderExists', foldername) @@ -1284,6 +1293,14 @@ class SFScriptForge: else: return '' + def IsZipFile(self, filename): + py = ScriptForge.pythonhelpermodule + '$' + '_SF_FileSystem__IsZipFile' + if self.FileExists(filename): + file = self._ConvertFromUrl(filename) + return self.SIMPLEEXEC(py, file) + else: + return False + def MoveFile(self, source, destination): return self.ExecMethod(self.vbMethod, 'MoveFile', source, destination) diff --git a/wizards/source/scriptforge/python/scriptforge.pyi b/wizards/source/scriptforge/python/scriptforge.pyi index 444863a5da55..ed29d33944e9 100644 --- a/wizards/source/scriptforge/python/scriptforge.pyi +++ b/wizards/source/scriptforge/python/scriptforge.pyi @@ -975,6 +975,26 @@ class SFScriptForge: """ ... + def CompressToZip(self, filename: FILE, foldername: FILE, rootfolder: str = ...) -> bool: + """ + Stores the content of Folder, including its subfolders, into a zip archive. + Encrypted files are not supported. The compressed files are stored optionally under a root folder. + Files existing already in the archive are not overwritten. + Args + ``filename``: a string representing the zip file. + If it does not exist, the archive is created, oncluding its parent folders. + All files present in the archive are kept untouched. + + ``foldername``: the folder to compress, as a string. All files and subfolders are included. + The folder itself is not. + + ``rootfolder``: when absent, files and folders are loaded in the archive from the root ("/"). + When present, given as a string without path separator, they are stored below that folder. + Returns + ``True`` when successful. When ``False``, the reason might be found in the console. + """ + ... + def CopyFile(self, source: FILE, destination: FILE, overwrite: bool = ...) -> bool: """ Copies one or more files from one location to another. @@ -1092,6 +1112,24 @@ class SFScriptForge: """ ... + def ExtractFromZip(self, filename: FILE, destination: FILE, source: str | tuple[str, ...] = ...) -> bool: + """ + Extracts a list of files contained in a zip archive and stores them in a folder. + Args + ``filename``: a string representing the zip archive. + + ``destination``: the folder where to extract the compressed files to. + Existing files with the same names are overwritten without warning. Other files stay untouched. + When the folder or a subfolder does not exist, it is created. + + ``source``: a single string or a tuple of strings with valid names of files contained in + the zip file. When Source is omitted, is an empty tuple or an empty string, + all the files and folders are extracted. + Returns + ``True`` when successful. When ``False``, the reason might be found in the console. + """ + ... + def FileExists(self, filename: FILE) -> bool: """ Return ``True`` if the given file exists. @@ -1121,6 +1159,24 @@ class SFScriptForge: """ ... + def FilesInZip(self, filename: FILE, pattern: str = ...) -> tuple[str, ...]: + """ + Returns The list of the files contained in a zip container. The list of names may optionally + be filtered. + Args + ``filename``: a string representing the zip archive. + + ``pattern``: a pattern as a not case-sensitive string containing 0 or more wildcards. + Admitted wildcard are: the "?" represents any single character, + the "*" represents zero, one, or multiple characters. + Returns + An unordered tuple of file names without a heading slash. The path separator is always + the slash ("/"), also on Windows. The list may be filtered with a name pattern. + Without pattern, all files are returned. The resulting tuple may be empty. An empty tuple + is returned when the file is not a valid zip file. + """ + ... + def FolderExists(self, foldername: FILE) -> bool: """ Returns ``True`` if the given folder name exists. @@ -1235,6 +1291,16 @@ class SFScriptForge: """ ... + def IsZipFile(self, filename: FILE) -> bool: + """ + Returns ``True`` if filename is a valid ZIP file based on its magic number. + Args + ``filename``: a string representing the zip archive. + Returns + ``True`` when ``filename`` is a valid zip file. Otherwise ``False``. + """ + ... + def MoveFile(self, source: FILE, destination: FILE) -> bool: """ Moves one or more files from one location to another. diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index 49b32b8e4e60..43b1465f1d12 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -587,6 +588,13 @@ namespace xmloff OStringBuffer("OElementImport::createElement: service factory gave me no object (service name: " + OUStringToOString(m_sServiceName, RTL_TEXTENCODING_ASCII_US) + ")!").getStr()); + // only use the created object when it is a form component + if (!Reference< XFormComponent >(xPure, UNO_QUERY).is()) + { + SAL_WARN("xmloff.forms", "OElementImport::createElement: " << m_sServiceName + << " is not a form component"); + return xReturn; + } xReturn.set(xPure, UNO_QUERY); if (auto const props = Reference(xPure, css::uno::UNO_QUERY)) { diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index b286b324b2eb..b02435090dbf 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -108,7 +108,7 @@ void CertificateChooser::BeforeRun() // We can't check for personal certificates before raising this dialog, // because the mozilla implementation throws a NoPassword exception, // if the user pressed cancel, and also if the database does not exist! - // But in the later case, the is no password query, and the user is confused + // But in the later case, there is no password query, and the user is confused // that nothing happens when pressing "Add..." in the SignatureDialog. // PostUserEvent( LINK( this, CertificateChooser, Initialize ) );