diff --git a/Makefile.fetch b/Makefile.fetch index 7cb4fa60f0f3..3e071f6cbf05 100644 --- a/Makefile.fetch +++ b/Makefile.fetch @@ -202,6 +202,13 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S $(call fetch_Optional,MORE_FONTS,FONT_AMIRI_TARBALL) \ $(call fetch_Optional,MORE_FONTS,FONT_REEM_TARBALL) \ $(call fetch_Optional,MORE_FONTS,FONT_SCHEHERAZADE_TARBALL) \ + $(call fetch_Optional,MORE_FONTS,FONT_AGDASIMA_TARBALL) \ + $(call fetch_Optional,MORE_FONTS,FONT_BACASIME_ANTIQUE_TARBALL) \ + $(call fetch_Optional,MORE_FONTS,FONT_BELANOSIMA_TARBALL) \ + $(call fetch_Optional,MORE_FONTS,FONT_CAPRASIMO_TARBALL) \ + $(call fetch_Optional,MORE_FONTS,FONT_LUGRASIMO_TARBALL) \ + $(call fetch_Optional,MORE_FONTS,FONT_LUMANOSIMO_TARBALL) \ + $(call fetch_Optional,MORE_FONTS,FONT_LUNASIMA_TARBALL) \ $(call fetch_Optional,MSPUB,MSPUB_TARBALL) \ $(call fetch_Optional,MWAW,MWAW_TARBALL) \ $(call fetch_Optional,MYTHES,MYTHES_TARBALL) \ diff --git a/Repository.mk b/Repository.mk index f51fb7343b3c..7cd5ee81e6c8 100644 --- a/Repository.mk +++ b/Repository.mk @@ -1081,6 +1081,13 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo_fonts,\ fonts_noto_serif_lao \ fonts_reem \ fonts_scheherazade \ + fonts_agdasima \ + fonts_bacasime_antique \ + fonts_belanosima \ + fonts_caprasimo \ + fonts_lugrasimo \ + fonts_lumanosimo \ + fonts_lunasima \ ) \ )) diff --git a/basegfx/source/tools/bgradient.cxx b/basegfx/source/tools/bgradient.cxx index a8bbe95c526b..e27ab160463b 100644 --- a/basegfx/source/tools/bgradient.cxx +++ b/basegfx/source/tools/bgradient.cxx @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -732,6 +733,19 @@ void BColorStops::doApplySteps(sal_uInt16 nStepCount) *this = aNewColorStops; } +void BColorStops::tryToApplyBColorModifierStack(const BColorModifierStack& rBColorModifierStack) +{ + if (0 == rBColorModifierStack.count()) + // no content on stack, done + return; + + for (auto& candidate : *this) + { + candidate = BColorStop(candidate.getStopOffset(), + rBColorModifierStack.getModifiedColor(candidate.getStopColor())); + } +} + std::string BGradient::GradientStyleToString(css::awt::GradientStyle eStyle) { switch (eStyle) diff --git a/chart2/qa/extras/chart2import2.cxx b/chart2/qa/extras/chart2import2.cxx index 75adcd12c105..04404c0f45fa 100644 --- a/chart2/qa/extras/chart2import2.cxx +++ b/chart2/qa/extras/chart2import2.cxx @@ -888,6 +888,60 @@ CPPUNIT_TEST_FIXTURE(Chart2ImportTest2, testChartDataTableWithMultipleLegendEntr CPPUNIT_ASSERT(xDataTableShape.is()); } +namespace +{ +void lcl_assertAngles(const Reference& rAxis, const double& rExpectedLabelAngle, + const double& rExpectedTitleAngle) +{ + Reference xPS(rAxis, uno::UNO_QUERY_THROW); + double fAxisLabelAngle = 0.0; + xPS->getPropertyValue(u"TextRotation"_ustr) >>= fAxisLabelAngle; + CPPUNIT_ASSERT_DOUBLES_EQUAL(rExpectedLabelAngle, fAxisLabelAngle, 1e-10); + + Reference xAxisTitled(rAxis, uno::UNO_QUERY_THROW); + Reference xAxisTitle = xAxisTitled->getTitleObject(); + CPPUNIT_ASSERT(xAxisTitle.is()); + Reference xPropSet(xAxisTitle, uno::UNO_QUERY_THROW); + double fAxisTitleAngle = 0.0; + xPropSet->getPropertyValue(u"TextRotation"_ustr) >>= fAxisTitleAngle; + CPPUNIT_ASSERT_DOUBLES_EQUAL(rExpectedTitleAngle, fAxisTitleAngle, 1e-10); +} +} // end namespace + +CPPUNIT_TEST_FIXTURE(Chart2ImportTest2, testAngleUnits) +{ + loadFromFile(u"fods/tdf161483_AngleUnits.fods"); + double fExpXAxisLabelAngle = 344.61; // = 382.9grad = 6.01457913529766rad + double fExpXAxisTitleAngle = 342.63; // = 380.7grad = 5.98002161610817rad + double fExpYAxisLabelAngle = 15.12; // = 16.8grad = 0.263893782901543rad + double fExpYAxisTitleAngle = 14.94; // = 16.6grad = 0.260752190247953rad + double fExpZAxisLabelAngle = 344.16; // = 382.4grad = 6.00672515366369rad + double fExpZAxisTitleAngle = 60.39; // = 67.1grad = 1.05400433527938rad + + // sheet 0: no unit; sheet 1: unit deg; sheet 2: unit rad; sheet 3: unit grad + // Without fix, the values with unit grad and rad were read as if they are in degrees. + for (size_t i = 0; i < 4; i++) + { + uno::Reference xChartDoc = getChartDocFromSheet(i, mxComponent); + CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is()); + + // x-axis + Reference xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0); + CPPUNIT_ASSERT(xAxis.is()); + lcl_assertAngles(xAxis, fExpXAxisLabelAngle, fExpXAxisTitleAngle); + + // y-axis + xAxis = getAxisFromDoc(xChartDoc, 0, 1, 0); + CPPUNIT_ASSERT(xAxis.is()); + lcl_assertAngles(xAxis, fExpYAxisLabelAngle, fExpYAxisTitleAngle); + + //z-axis + xAxis = getAxisFromDoc(xChartDoc, 0, 2, 0); + CPPUNIT_ASSERT(xAxis.is()); + lcl_assertAngles(xAxis, fExpZAxisLabelAngle, fExpZAxisTitleAngle); + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/qa/extras/data/fods/tdf161483_AngleUnits.fods b/chart2/qa/extras/data/fods/tdf161483_AngleUnits.fods new file mode 100644 index 000000000000..a71fb533165a --- /dev/null +++ b/chart2/qa/extras/data/fods/tdf161483_AngleUnits.fods @@ -0,0 +1,1851 @@ + + + + + LODev_daily_installed/25.2.0.0.alpha0$Windows_X86_64 LibreOffice_project/aaf2967d74a9a7ba2d28433e1872422ce38b6244 + + Metric + Regina Henschel + 2024-07-04T20:11:31 + Regina Henschel + 2024-07-06T19:10:11 + + + + + 0 + 0 + 27494 + 13002 + + + view1 + + + 1 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 80 + 60 + true + false + false + false + false + + + 1 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 80 + 60 + true + false + false + false + false + + + 0 + 5 + 2 + 0 + 0 + 0 + 0 + 0 + 80 + 60 + true + false + false + false + false + + + 1 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 80 + 60 + true + false + false + false + false + + + noUnit + 1065 + 0 + 80 + 60 + false + true + true + true + false + true + 12632256 + 1 + true + true + true + false + false + false + 500 + 500 + 4 + 4 + true + false + false + false + false + + + + + true + true + true + 0 + true + true + false + true + false + 12632256 + true + true + 0 + false + false + true + true + false + 3 + false + false + false + 500 + 500 + 4 + 4 + true + false + false + true + true + true + true + true + 7 + true + + + Sheet1 + + + noUnit_2 + + + deg_2 + + + rad_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ??? + + + + + Page 1 + + + + + + + + ???(???) + + + 00.00.0000, 00:00:00 + + + + + + Page 1/ 99 + + + + + + + + + + + + + + + + LODev_daily_installed/25.2.0.0.alpha0$Windows_X86_64 LibreOffice_project/aaf2967d74a9a7ba2d28433e1872422ce38b6244 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sales 2023 + + + + + + + + + + + + + + + Quarter + + + + + + + + in 1000 EUR + + + + + + + Seller + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1st + + noUnit.B1:noUnit.E1 + + + 2nd + + + 3rd + + + 4th + + + + + + + John + + noUnit.A2:noUnit.A2 + + + 72 + + noUnit.B2:noUnit.E2 + + + 42 + + + 45 + + + 12 + + + + + Mary + + noUnit.A3:noUnit.A3 + + + 56 + + noUnit.B3:noUnit.E3 + + + 13 + + + 56 + + + 84 + + + + + Tim + + noUnit.A4:noUnit.A4 + + + 44 + + noUnit.B4:noUnit.E4 + + + 30 + + + 23 + + + 27 + + + + + Doris + + noUnit.A5:noUnit.A5 + + + 89 + + noUnit.B5:noUnit.E5 + + + 48 + + + 54 + + + 37 + + + + + + + + + + + + + + 2023 + + 1st + + 2nd + + 3rd + + 4th + + + + + + John + + + 72 + + + 42 + + + 45 + + + 12 + + + + + + Mary + + + 56 + + + 13 + + + 56 + + + 84 + + + + + + Tim + + + 44 + + + 30 + + + 23 + + + 27 + + + + + + Doris + + + 89 + + + 48 + + + 54 + + + 37 + + + + + + + + + + + + + + + + + + LODev_daily_installed/25.2.0.0.alpha0$Windows_X86_64 LibreOffice_project/aaf2967d74a9a7ba2d28433e1872422ce38b6244 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sales 2023 + + + + + + + + + + + + + + + Quarter + + + + + + + + in 1000 EUR + + + + + + + Seller + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1st + + deg.B1:deg.E1 + + + 2nd + + + 3rd + + + 4th + + + + + + + John + + deg.A2:deg.A2 + + + 72 + + deg.B2:deg.E2 + + + 42 + + + 45 + + + 12 + + + + + Mary + + deg.A3:deg.A3 + + + 56 + + deg.B3:deg.E3 + + + 13 + + + 56 + + + 84 + + + + + Tim + + deg.A4:deg.A4 + + + 44 + + deg.B4:deg.E4 + + + 30 + + + 23 + + + 27 + + + + + Doris + + deg.A5:deg.A5 + + + 89 + + deg.B5:deg.E5 + + + 48 + + + 54 + + + 37 + + + + + + + + + + + + + + 2023 + + 1st + + 2nd + + 3rd + + 4th + + + + + + John + + + 72 + + + 42 + + + 45 + + + 12 + + + + + + Mary + + + 56 + + + 13 + + + 56 + + + 84 + + + + + + Tim + + + 44 + + + 30 + + + 23 + + + 27 + + + + + + Doris + + + 89 + + + 48 + + + 54 + + + 37 + + + + + + + + + + + + + + + + + + LODev_daily_installed/25.2.0.0.alpha0$Windows_X86_64 LibreOffice_project/aaf2967d74a9a7ba2d28433e1872422ce38b6244 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sales 2023 + + + + + + + + + + + + + + + Quarter + + + + + + + + in 1000 EUR + + + + + + + Seller + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1st + + rad.B1:rad.E1 + + + 2nd + + + 3rd + + + 4th + + + + + + + John + + rad.A2:rad.A2 + + + 72 + + rad.B2:rad.E2 + + + 42 + + + 45 + + + 12 + + + + + Mary + + rad.A3:rad.A3 + + + 56 + + rad.B3:rad.E3 + + + 13 + + + 56 + + + 84 + + + + + Tim + + rad.A4:rad.A4 + + + 44 + + rad.B4:rad.E4 + + + 30 + + + 23 + + + 27 + + + + + Doris + + rad.A5:rad.A5 + + + 89 + + rad.B5:rad.E5 + + + 48 + + + 54 + + + 37 + + + + + + + + + + + + + + 2023 + + 1st + + 2nd + + 3rd + + 4th + + + + + + John + + + 72 + + + 42 + + + 45 + + + 12 + + + + + + Mary + + + 56 + + + 13 + + + 56 + + + 84 + + + + + + Tim + + + 44 + + + 30 + + + 23 + + + 27 + + + + + + Doris + + + 89 + + + 48 + + + 54 + + + 37 + + + + + + + + + + + + + + + + + + LODev_daily_installed/25.2.0.0.alpha0$Windows_X86_64 LibreOffice_project/aaf2967d74a9a7ba2d28433e1872422ce38b6244 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sales 2023 + + + + + + + + + + + + + + + Quarter + + + + + + + + in 1000 EUR + + + + + + + Seller + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1st + + grad.B1:grad.E1 + + + 2nd + + + 3rd + + + 4th + + + + + + + John + + grad.A2:grad.A2 + + + 72 + + grad.B2:grad.E2 + + + 42 + + + 45 + + + 12 + + + + + Mary + + grad.A3:grad.A3 + + + 56 + + grad.B3:grad.E3 + + + 13 + + + 56 + + + 84 + + + + + Tim + + grad.A4:grad.A4 + + + 44 + + grad.B4:grad.E4 + + + 30 + + + 23 + + + 27 + + + + + Doris + + grad.A5:grad.A5 + + + 89 + + grad.B5:grad.E5 + + + 48 + + + 54 + + + 37 + + + + + + + + + + + + + + 2023 + + 1st + + 2nd + + 3rd + + 4th + + + + + + John + + + 72 + + + 42 + + + 45 + + + 12 + + + + + + Mary + + + 56 + + + 13 + + + 56 + + + 84 + + + + + + Tim + + + 44 + + + 30 + + + 23 + + + 27 + + + + + + Doris + + + 89 + + + 48 + + + 54 + + + 37 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index d74ede874b36..787d094c8635 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -501,7 +501,8 @@ void ChartController::executeDispatch_InsertTrendline() // note: when a user pressed "OK" but didn't change any settings in the // dialog, the SfxTabDialog returns "Cancel" - SfxTabDialogController::runAsync(aDialog, [this, aDialog, aItemConverter, xUndoGuard=std::move(xUndoGuard)](int nResult) { + SfxTabDialogController::runAsync(aDialog, [this, aDialog, aItemConverter = std::move(aItemConverter), + xUndoGuard=std::move(xUndoGuard)](int nResult) { if ( nResult == RET_OK || aDialog->DialogWasClosedWithOK() ) { const SfxItemSet* pOutItemSet = aDialog->GetOutputItemSet(); diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index 0f831db3d6c5..561548ebc364 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -712,7 +712,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb // this is an OOo link, it has no persistence OUString aURL = xOrigLinkage->getLinkURL(); if ( aURL.isEmpty() ) - throw uno::RuntimeException(); + throw uno::RuntimeException("URL of the linked object is empty"); // create new linked object from the URL the link is based on uno::Reference < embed::XEmbeddedObjectCreator > xCreator = @@ -760,7 +760,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb // copy all the properties from xOrigProps to xTargetProps uno::Reference< beans::XPropertySetInfo > xOrigInfo = xOrigProps->getPropertySetInfo(); if ( !xOrigInfo.is() ) - throw uno::RuntimeException(); + throw uno::RuntimeException("Object has no properties"); const uno::Sequence< beans::Property > aPropertiesList = xOrigInfo->getProperties(); for ( const auto & p : aPropertiesList ) diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx index 87192678fc20..cc827822d57d 100644 --- a/comphelper/source/container/enumerablemap.cxx +++ b/comphelper/source/container/enumerablemap.cxx @@ -369,9 +369,9 @@ namespace comphelper void EnumerableMap::impl_initValues_throw( const Sequence< Pair< Any, Any > >& _initialValues ) { OSL_PRECOND( m_aData.m_pValues && m_aData.m_pValues->empty(), "EnumerableMap::impl_initValues_throw: illegal call!" ); - if (!m_aData.m_pValues || !m_aData.m_pValues->empty()) - throw RuntimeException(); - + if (!m_aData.m_pValues || !m_aData.m_pValues->empty()){ + throw IllegalTypeException("EnumerableMap m_aData container is invalid or not empty.", *this); + } for (auto& mapping : _initialValues) { impl_checkValue_throw(mapping.Second); diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index b00e8c543752..b0b7897fd2ab 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -566,10 +566,17 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreateGpgPackageEncryptionDat bool OStorageHelper::IsValidZipEntryFileName( std::u16string_view aName, bool bSlashAllowed ) { + long nDots{0}; for ( size_t i = 0; i < aName.size(); i++ ) { switch ( aName[i] ) { + case '.': + if (nDots != -1) + { + ++nDots; + } + break; case '\\': case '?': case '<': @@ -579,15 +586,17 @@ bool OStorageHelper::IsValidZipEntryFileName( std::u16string_view aName, bool bS case ':': return false; case '/': - if ( !bSlashAllowed ) + if (!bSlashAllowed || nDots == 1 || nDots == 2 || i == 0) return false; + nDots = 0; break; default: + nDots = -1; if ( aName[i] < 32 || (aName[i] >= 0xD800 && aName[i] <= 0xDFFF) ) return false; } } - return true; + return nDots != 1 && nDots != 2; } diff --git a/configure.ac b/configure.ac index 38dd927c6c47..13592d0ae71a 100644 --- a/configure.ac +++ b/configure.ac @@ -2740,9 +2740,9 @@ AC_ARG_WITH(perl-home, libo_FUZZ_ARG_WITH(doxygen, AS_HELP_STRING( [--with-doxygen=], - [Specifies the doxygen executable to use when generating ODK C/C++ - documentation. --without-doxygen disables generation of ODK C/C++ - documentation. Not relevant in the --disable-odk case.]), + [Only relevant when --enable-odk is set. Specifies the doxygen + executable to use when generating ODK C/C++ documentation. + --without-doxygen disables generation of ODK C/C++ documentation.]), ,with_doxygen=yes) AC_ARG_WITH(visual-studio, @@ -10286,8 +10286,8 @@ fi if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then SYSTEM_PYTHON= PYTHON_VERSION_MAJOR=3 - PYTHON_VERSION_MINOR=9 - PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.19 + PYTHON_VERSION_MINOR=10 + PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.14 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 diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index b042ffb71668..fa4ef4663255 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -486,12 +486,14 @@ void SvxMacroTabPage_::GenericHandler_Impl(const weld::Button* pBtn) if (bAppEvents) { EventsHash::iterator h_it = m_appEventsHash.find(sEventName); + assert(h_it != m_appEventsHash.end()); h_it->second.first = sEventType; h_it->second.second = sEventURL; } else { EventsHash::iterator h_it = m_docEventsHash.find(sEventName); + assert(h_it != m_docEventsHash.end()); h_it->second.first = sEventType; h_it->second.second = sEventURL; } diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index a0c9819f0485..3851a01e596e 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -1248,9 +1248,9 @@ namespace void ExtractErrorDescription(const EECharAttrib& rEECharAttrib, SpellErrorDescription& rSpellErrorDescription) { css::uno::Sequence aSequence; - const auto pGrabBag = static_cast(rEECharAttrib.pAttr)->GetGrabBag(); - const auto iter = pGrabBag.find(u"SpellErrorDescription"_ustr); - assert(iter != pGrabBag.end()); + const auto& rGrabBag = static_cast(rEECharAttrib.pAttr)->GetGrabBag(); + const auto iter = rGrabBag.find(u"SpellErrorDescription"_ustr); + assert(iter != rGrabBag.end()); iter->second >>= aSequence; rSpellErrorDescription.fromSequence(aSequence); } diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index bd1f6810cf31..235bda92d184 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -2488,13 +2488,13 @@ void SvxCharPositionPage::SetEscapement_Impl( SvxEscapement nEsc ) if ( SvxEscapement::Superscript == nEsc ) { - aEscItm.GetEsc() = m_nSuperEsc; - aEscItm.GetProportionalHeight() = m_nSuperProp; + aEscItm.SetEsc( m_nSuperEsc ); + aEscItm.SetProportionalHeight(m_nSuperProp); } else if ( SvxEscapement::Subscript == nEsc ) { - aEscItm.GetEsc() = m_nSubEsc; - aEscItm.GetProportionalHeight() = m_nSubProp; + aEscItm.SetEsc( m_nSubEsc ); + aEscItm.SetProportionalHeight( m_nSubProp ); } short nFac = aEscItm.GetEsc() < 0 ? -1 : 1; diff --git a/dbaccess/CppunitTest_dbaccess_CRMDatabase_test.mk b/dbaccess/CppunitTest_dbaccess_CRMDatabase_test.mk new file mode 100644 index 000000000000..118cb9a4cd97 --- /dev/null +++ b/dbaccess/CppunitTest_dbaccess_CRMDatabase_test.mk @@ -0,0 +1,51 @@ +# -*- 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_CRMDatabase_test)) + +$(eval $(call gb_CppunitTest_use_external,dbaccess_CRMDatabase_test,boost_headers)) + +$(eval $(call gb_CppunitTest_add_exception_objects,dbaccess_CRMDatabase_test, \ + dbaccess/qa/unit/CRMDatabase_test \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,dbaccess_CRMDatabase_test, \ + comphelper \ + cppu \ + cppuhelper \ + dbaxml \ + dbtools \ + sal \ + subsequenttest \ + utl \ + test \ + tk \ + tl \ + unotest \ + xo \ +)) + +$(eval $(call gb_CppunitTest_use_api,dbaccess_CRMDatabase_test,\ + offapi \ + oovbaapi \ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_use_ure,dbaccess_CRMDatabase_test)) +$(eval $(call gb_CppunitTest_use_vcl,dbaccess_CRMDatabase_test)) + +$(eval $(call gb_CppunitTest_use_rdb,dbaccess_CRMDatabase_test,services)) + +$(eval $(call gb_CppunitTest_use_configuration,dbaccess_CRMDatabase_test)) + +$(eval $(call gb_CppunitTest_use_uiconfigs,dbaccess_CRMDatabase_test, \ + dbaccess \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/dbaccess/CppunitTest_dbaccess_embeddeddb_performancetest.mk b/dbaccess/CppunitTest_dbaccess_embeddeddb_performancetest.mk index 6a92256937b3..80af11b4e826 100644 --- a/dbaccess/CppunitTest_dbaccess_embeddeddb_performancetest.mk +++ b/dbaccess/CppunitTest_dbaccess_embeddeddb_performancetest.mk @@ -41,32 +41,7 @@ $(eval $(call gb_CppunitTest_use_api,dbaccess_embeddeddb_performancetest,\ $(eval $(call gb_CppunitTest_use_ure,dbaccess_embeddeddb_performancetest)) $(eval $(call gb_CppunitTest_use_vcl,dbaccess_embeddeddb_performancetest)) -$(eval $(call gb_CppunitTest_use_components,dbaccess_embeddeddb_performancetest,\ - basic/util/sb \ - comphelper/util/comphelp \ - configmgr/source/configmgr \ - connectivity/source/cpool/dbpool2 \ - connectivity/source/drivers/firebird/firebird_sdbc \ - connectivity/source/manager/sdbc2 \ - dbaccess/util/dba \ - dbaccess/source/filter/xml/dbaxml \ - dbaccess/util/dbu \ - filter/source/config/cache/filterconfig1 \ - framework/util/fwk \ - i18npool/util/i18npool \ - linguistic/source/lng \ - package/source/xstor/xstor \ - package/util/package2 \ - sax/source/expatwrap/expwrap \ - sfx2/util/sfx \ - svl/source/fsstor/fsstorage \ - svl/util/svl \ - toolkit/util/tk \ - ucb/source/core/ucb1 \ - ucb/source/ucp/file/ucpfile1 \ - unotools/util/utl \ - xmloff/util/xo \ -)) +$(eval $(call gb_CppunitTest_use_rdb,dbaccess_embeddeddb_performancetest,services)) $(eval $(call gb_CppunitTest_use_configuration,dbaccess_embeddeddb_performancetest)) diff --git a/dbaccess/JunitTest_dbaccess_complex.mk b/dbaccess/JunitTest_dbaccess_complex.mk index ba333cbf3b27..99a3cd9f5cbc 100644 --- a/dbaccess/JunitTest_dbaccess_complex.mk +++ b/dbaccess/JunitTest_dbaccess_complex.mk @@ -33,7 +33,6 @@ $(eval $(call gb_JunitTest_add_sourcefiles,dbaccess_complex,\ dbaccess/qa/complex/dbaccess/CRMBasedTestCase \ dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler \ dbaccess/qa/complex/dbaccess/CopyTableWizard \ - dbaccess/qa/complex/dbaccess/DataSource \ dbaccess/qa/complex/dbaccess/DatabaseApplication \ dbaccess/qa/complex/dbaccess/DatabaseDocument \ dbaccess/qa/complex/dbaccess/FileHelper \ diff --git a/dbaccess/Module_dbaccess.mk b/dbaccess/Module_dbaccess.mk index e3df5dc33dc2..bfe11788bd12 100644 --- a/dbaccess/Module_dbaccess.mk +++ b/dbaccess/Module_dbaccess.mk @@ -53,6 +53,7 @@ $(eval $(call gb_Module_add_check_targets,dbaccess,\ CppunitTest_dbaccess_empty_stdlib_save \ CppunitTest_dbaccess_nolib_save \ CppunitTest_dbaccess_hsqlschema_import \ + $(if $(ENABLE_FIREBIRD_SDBC),CppunitTest_dbaccess_CRMDatabase_test) \ )) endif diff --git a/dbaccess/qa/complex/dbaccess/DataSource.java b/dbaccess/qa/complex/dbaccess/DataSource.java deleted file mode 100644 index 0413a6e07b69..000000000000 --- a/dbaccess/qa/complex/dbaccess/DataSource.java +++ /dev/null @@ -1,68 +0,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/. - * - * 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 . - */ -package complex.dbaccess; - -import com.sun.star.container.XNameAccess; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XNamingService; -import connectivity.tools.CRMDatabase; -import connectivity.tools.HsqlDatabase; - -// ---------- junit imports ----------------- -import org.junit.Test; -import static org.junit.Assert.*; - - - -public class DataSource extends TestCase -{ - - HsqlDatabase m_database; - connectivity.tools.DataSource m_dataSource; - - - private void createTestCase() throws Exception - { - if (m_database == null) - { - final CRMDatabase database = new CRMDatabase( getMSF(), false ); - m_database = database.getDatabase(); - m_dataSource = m_database.getDataSource(); - } - } - - - @Test - public void testRegistrationName() throws Exception - { - createTestCase(); - // 1. check the existing "Bibliography" data source whether it has the proper name - String dataSourceName = "Bibliography"; - final connectivity.tools.DataSource bibliography = new connectivity.tools.DataSource(getMSF(), dataSourceName); - assertEquals("pre-registered database has a wrong name!", dataSourceName, bibliography.getName()); - // 2. register a newly created data source, and verify it has the proper name - dataSourceName = "someDataSource"; - final XNamingService dataSourceRegistrations = UnoRuntime.queryInterface( - XNamingService.class, getMSF().createInstance( "com.sun.star.sdb.DatabaseContext" ) ); - final XNameAccess existenceCheck = UnoRuntime.queryInterface( XNameAccess.class, dataSourceRegistrations ); - if ( existenceCheck.hasByName( "someDataSource" ) ) - dataSourceRegistrations.revokeObject( "someDataSource" ); - dataSourceRegistrations.registerObject("someDataSource", m_dataSource.getXDataSource()); - assertEquals("registration name of a newly registered data source is wrong", dataSourceName, m_dataSource.getName()); - } -} diff --git a/dbaccess/qa/unit/CRMDatabase_test.cxx b/dbaccess/qa/unit/CRMDatabase_test.cxx new file mode 100644 index 000000000000..634bd17b0b0d --- /dev/null +++ b/dbaccess/qa/unit/CRMDatabase_test.cxx @@ -0,0 +1,134 @@ +/* -*- 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 +#include +#include +#include +#include + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +class CRMDBTest : public DBTestBase +{ +public: + void testCRMDatabase(); + void testRegistrationName(); + + CPPUNIT_TEST_SUITE(CRMDBTest); + CPPUNIT_TEST(testCRMDatabase); + CPPUNIT_TEST(testRegistrationName); + CPPUNIT_TEST_SUITE_END(); +}; + +void CRMDBTest::testCRMDatabase() +{ + 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); + + // test selection + Reference xStatement = xConnection->createStatement(); + Reference xResults + = xStatement->executeQuery(u"SELECT \"NAME\" FROM \"CATEGORIES\" ORDER BY \"ID\""_ustr); + CPPUNIT_ASSERT(xResults.is()); + + Reference xRow(xResults, UNO_QUERY_THROW); + CPPUNIT_ASSERT(xResults->next()); + CPPUNIT_ASSERT_EQUAL(u"Food"_ustr, xRow->getString(1)); + CPPUNIT_ASSERT(xResults->next()); + CPPUNIT_ASSERT_EQUAL(u"Furniture"_ustr, xRow->getString(1)); + + // test if the queries have been created and can be used + uno::Reference xQuerySupplier(xConnection, UNO_QUERY_THROW); + uno::Reference xQueryAccess = xQuerySupplier->getQueries(); + CPPUNIT_ASSERT(xQueryAccess->hasElements()); + + // the unshipped orders query depends on the all orders query, so we'll test + // to see if both work + uno::Reference xColumns( + xQueryAccess->getByName(u"unshipped orders"_ustr), UNO_QUERY); + uno::Reference xColumnAccess(xColumns->getColumns()); + CPPUNIT_ASSERT(xColumnAccess->hasElements()); + + Sequence ColumnNames = xColumnAccess->getElementNames(); + CPPUNIT_ASSERT(ColumnNames.hasElements()); + // first column returned should be from the all orders query + CPPUNIT_ASSERT_EQUAL(ColumnNames[0], u"Order No."_ustr); +} + +void CRMDBTest::testRegistrationName() +{ + // 1. check the existing "Bibliography" data source whether it has the proper name + Reference xNameAccess( + getMultiServiceFactory()->createInstance(u"com.sun.star.sdb.DatabaseContext"_ustr), + UNO_QUERY); + Reference xBiblioDataSource(xNameAccess->getByName(u"Bibliography"_ustr), + UNO_QUERY); + CPPUNIT_ASSERT(xBiblioDataSource.is()); + + Reference xBiblioProp(xBiblioDataSource, UNO_QUERY); + OUString sBiblioDataSourceName; + xBiblioProp->getPropertyValue(u"Name"_ustr) >>= sBiblioDataSourceName; + + CPPUNIT_ASSERT_EQUAL(u"Bibliography"_ustr, sBiblioDataSourceName); + + // 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 xDataSource = xDocument->getDataSource(); + CPPUNIT_ASSERT(xDataSource.is()); + + // Get a XDatabaseContext from XSingleService factory in order to register the DataSource + Reference xDatabaseContext(xNameAccess, UNO_QUERY_THROW); + CPPUNIT_ASSERT(xDatabaseContext.is()); + + // Register the datasource + xDatabaseContext->registerObject(u"SomeNewHsqlDataSource"_ustr, xDataSource); + + // Check the newly created data source to see if it has the proper name + Reference xProp(xDataSource, UNO_QUERY); + OUString sDataSourceName; + xProp->getPropertyValue(u"Name"_ustr) >>= sDataSourceName; + + CPPUNIT_ASSERT_EQUAL(u"SomeNewHsqlDataSource"_ustr, sDataSourceName); + + CPPUNIT_ASSERT_THROW_MESSAGE( + "Bibliography already exists", + xDatabaseContext->registerObject(u"Bibliography"_ustr, xDataSource), + container::ElementExistException); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(CRMDBTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/qa/unit/dbtest_base.cxx b/dbaccess/qa/unit/dbtest_base.cxx index 63a3951ad7b4..0208649906ad 100644 --- a/dbaccess/qa/unit/dbtest_base.cxx +++ b/dbaccess/qa/unit/dbtest_base.cxx @@ -13,10 +13,15 @@ #include #include +#include #include +#include #include +#include #include #include +#include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::beans; @@ -37,6 +42,12 @@ public: uno::Reference< XOfficeDatabaseDocument > const & xDocument); void createDBDocument(const OUString& rDriverURL); + void createTables(Reference< XConnection > xConnection); + void createQueries(Reference< XDataSource > xDataSource); + void createQuery(OUString sQuery, bool bEscapeProcessing, + OUString sQueryName, Reference xDataSource); + + virtual void tearDown() override; }; uno::Reference DBTestBase::getDocumentForUrl(OUString const & url) { @@ -74,4 +85,112 @@ void DBTestBase::createDBDocument(const OUString& rDriverURL) CPPUNIT_ASSERT(mxComponent); } +void DBTestBase::createTables(Reference xConnection) +{ + uno::Reference xStatement = xConnection->createStatement(); + + xStatement->execute( + u"CREATE TABLE \"CATEGORIES\" ( \"ID\" INTEGER NOT NULL PRIMARY KEY " + ", \"NAME\" VARCHAR (50) , \"DESCRIPTION\" VARCHAR (1024), \"IMAGE\" LONGVARBINARY" + ")"_ustr); + + xStatement->execute(u"INSERT INTO \"CATEGORIES\" (\"ID\", \"NAME\") VALUES ( 1, 'Food' )"_ustr); + xStatement->execute(u"INSERT INTO \"CATEGORIES\" (\"ID\", \"NAME\") VALUES ( 2, 'Furniture' )"_ustr); + + xStatement->execute( + u"CREATE TABLE \"PRODUCTS\" ( \"ID\" INTEGER NOT NULL PRIMARY KEY " + ", \"NAME\" VARCHAR (50) , \"CATEGORYID\" INTEGER NOT NULL, FOREIGN KEY (\"CATEGORYID\")" + "REFERENCES \"CATEGORIES\" (\"ID\") )"_ustr); + + xStatement->execute(u"INSERT INTO \"PRODUCTS\" VALUES ( 1, 'Orange', 1 )"_ustr); + xStatement->execute(u"INSERT INTO \"PRODUCTS\" VALUES ( 2, 'Apples', 1 )"_ustr); + xStatement->execute(u"INSERT INTO \"PRODUCTS\" VALUES ( 3, 'Pears', 1 )"_ustr); + xStatement->execute(u"INSERT INTO \"PRODUCTS\" VALUES ( 4, 'Strawberries', 1 )"_ustr); + + xStatement->execute( + u"CREATE TABLE \"CUSTOMERS\" ( \"ID\" INTEGER NOT NULL PRIMARY KEY " + ", \"NAME\" VARCHAR (50) , \"ADDRESS\" VARCHAR (50), \"CITY\" VARCHAR (50), \"POSTAL\" VARCHAR (50)" + ", \"COMMENT\" LONGVARCHAR )"_ustr); + + xStatement->execute(u"INSERT INTO \"CUSTOMERS\" VALUES(1,'Food, Inc.','Down Under','Melbourne','509','Preferred')"_ustr); + xStatement->execute(u"INSERT INTO \"CUSTOMERS\" VALUES(2,'Simply Delicious','Down Under','Melbourne','518',null)"_ustr); + xStatement->execute(u"INSERT INTO \"CUSTOMERS\" VALUES(3,'Pure Health','10 Fish St.','San Francisco','94107',null)"_ustr); + xStatement->execute(u"INSERT INTO \"CUSTOMERS\" VALUES(4,'Milk And More','Arlington Road 21','Dublin','31021','Good one.')"_ustr); + + xStatement->execute( + u"CREATE TABLE \"ORDERS\" ( \"ID\" INTEGER NOT NULL PRIMARY KEY, \"CUSTOMERID\" INTEGER NOT NULL " + ", \"ORDERDATE\" DATE, \"SHIPDATE\" DATE, FOREIGN KEY (\"CUSTOMERID\")" + "REFERENCES \"CUSTOMERS\" (\"ID\") )"_ustr); + + xStatement->execute(u"INSERT INTO \"ORDERS\" (\"ID\", \"CUSTOMERID\", \"ORDERDATE\") VALUES(1, 1, {D '2009-01-01'})"_ustr); + xStatement->execute(u"INSERT INTO \"ORDERS\" VALUES(2, 2, {D '2009-01-01'}, {D '2009-01-23'})"_ustr); + + xStatement->execute( + u"CREATE TABLE \"ORDERS_DETAILS\" ( \"ORDERID\" INTEGER NOT NULL, \"PRODUCTID\" INTEGER NOT NULL, \"QUANTITY\" INTEGER" + ", FOREIGN KEY (\"ORDERID\") REFERENCES \"ORDERS\" (\"ID\") " + ", FOREIGN KEY (\"PRODUCTID\") REFERENCES \"PRODUCTS\" (\"ID\"), PRIMARY KEY(\"ORDERID\", \"PRODUCTID\") )"_ustr); + + xStatement->execute(u"INSERT INTO \"ORDERS_DETAILS\" VALUES(1, 1, 100)"_ustr); + xStatement->execute(u"INSERT INTO \"ORDERS_DETAILS\" VALUES(1, 2, 100)"_ustr); + xStatement->execute(u"INSERT INTO \"ORDERS_DETAILS\" VALUES(2, 2, 2000)"_ustr); + xStatement->execute(u"INSERT INTO \"ORDERS_DETAILS\" VALUES(2, 3, 2000)"_ustr); + xStatement->execute(u"INSERT INTO \"ORDERS_DETAILS\" VALUES(2, 4, 2000)"_ustr); + xConnection->commit(); +} + +void DBTestBase::createQueries(Reference xDataSource) +{ + createQuery( + u"SELECT \"ORDERS\".\"ID\" AS \"Order No.\", " + "\"CUSTOMERS\".\"NAME\" AS \"Customer Name\", " + "\"ORDERS\".\"ORDERDATE\" AS \"Order Date\", " + "\"ORDERS\".\"SHIPDATE\" AS \"Ship Date\", " + "\"ORDERS_DETAILS\".\"QUANTITY\", " + "\"PRODUCTS\".\"NAME\" AS \"Product Name\" " + "FROM \"ORDERS_DETAILS\" AS \"ORDERS_DETAILS\", " + "\"ORDERS\" AS \"ORDERS\", " + "\"PRODUCTS\" AS \"PRODUCTS\", " + "\"CUSTOMERS\" AS \"CUSTOMERS\" " + "WHERE ( \"ORDERS_DETAILS\".\"ORDERID\" = \"ORDERS\".\"ID\" " + "AND \"ORDERS_DETAILS\".\"PRODUCTID\" = \"PRODUCTS\".\"ID\" " + "AND \"ORDERS\".\"CUSTOMERID\" = \"CUSTOMERS\".\"ID\" )"_ustr, + true, u"all orders"_ustr, xDataSource); + + createQuery( + u"SELECT *" + "FROM \"all orders\"" + "WHERE ( \"SHIPDATE\" IS NULL )"_ustr, true, u"unshipped orders"_ustr, xDataSource); + + createQuery(u"SELECT * FROM \"CUSTOMERS\""_ustr, true, u"parseable"_ustr, xDataSource); + createQuery(u"SELECT * FROM INFORMATION_SCHEMA.SYSTEM_VIEWS"_ustr, false, u"parseable native"_ustr, xDataSource); +} + +void DBTestBase::createQuery(OUString sQuery, bool bEscapeProcessing, OUString sQueryName, Reference xDataSource) +{ + Reference xQuerySupplier(xDataSource, UNO_QUERY_THROW); + Reference xQueryAccess = xQuerySupplier->getQueryDefinitions(); + CPPUNIT_ASSERT(xQueryAccess.is()); + + Reference xSingleServiceFactory(xQueryAccess, UNO_QUERY_THROW); + Reference xQueryProp(xSingleServiceFactory->createInstance(), UNO_QUERY_THROW); + + xQueryProp->setPropertyValue(u"Command"_ustr, Any(sQuery)); + xQueryProp->setPropertyValue(u"EscapeProcessing"_ustr, Any(bEscapeProcessing)); + + Reference xNameContainer(xQueryAccess, UNO_QUERY_THROW); + xNameContainer->insertByName(sQueryName, Any(xQueryProp)); +} + +void DBTestBase::tearDown() +{ + if (mxComponent) + { + // In order to close all windows + css::uno::Reference xCloseable(mxComponent, css::uno::UNO_QUERY_THROW); + xCloseable->close(false); + } + + UnoApiTest::tearDown(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/qa/unit/firebird.cxx b/dbaccess/qa/unit/firebird.cxx index 089f152ee2d5..5f2f4077125e 100644 --- a/dbaccess/qa/unit/firebird.cxx +++ b/dbaccess/qa/unit/firebird.cxx @@ -15,7 +15,6 @@ #include #include #include -#include using namespace ::com::sun::star; using namespace ::com::sun::star::sdb; @@ -48,9 +47,6 @@ void FirebirdTest::testEmptyDBConnection() getDocumentForUrl(maTempFile.GetURL()); getConnectionForDocument(xDocument); - - css::uno::Reference xCloseable(mxComponent, css::uno::UNO_QUERY_THROW); - xCloseable->close(false); } /** @@ -90,9 +86,6 @@ void FirebirdTest::testIntegerDatabase() xRow->getString(xColumnLocate->findColumn(u"_VARCHAR"_ustr))); CPPUNIT_ASSERT(!xResultSet->next()); // Should only be one row - - css::uno::Reference xCloseable(mxComponent, css::uno::UNO_QUERY_THROW); - xCloseable->close(false); } void FirebirdTest::testTdf132924() @@ -118,9 +111,6 @@ void FirebirdTest::testTdf132924() // - Actual : The column name 'TestId' is not valid CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xRow->getShort(xColumnLocate->findColumn(u"TestId"_ustr))); CPPUNIT_ASSERT_EQUAL(u"TestName"_ustr, xRow->getString(xColumnLocate->findColumn(u"TestName"_ustr))); - - css::uno::Reference xCloseable(mxComponent, css::uno::UNO_QUERY_THROW); - xCloseable->close(false); } CPPUNIT_TEST_SUITE_REGISTRATION(FirebirdTest); diff --git a/dbaccess/source/sdbtools/connection/objectnames.cxx b/dbaccess/source/sdbtools/connection/objectnames.cxx index 6f9232f7f689..fe1caa97289a 100644 --- a/dbaccess/source/sdbtools/connection/objectnames.cxx +++ b/dbaccess/source/sdbtools/connection/objectnames.cxx @@ -313,9 +313,9 @@ namespace sdbtools if ( aMeta.supportsSubqueriesInFrom() ) pReturn = std::make_shared( pTableCheck, pQueryCheck ); else if ( _nCommandType == CommandType::TABLE ) - pReturn = pTableCheck; + pReturn = std::move(pTableCheck); else - pReturn = pQueryCheck; + pReturn = std::move(pQueryCheck); return pReturn; } diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index e16b16f5efda..b6d18610011c 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -2575,7 +2575,7 @@ bool SbaTableQueryBrowser::implSelect(const weld::TreeIter* pEntry) selectPath(m_xCurrentlyDisplayed.get()); // get the name of the data source currently selected - ensureConnection(m_xCurrentlyDisplayed.get(), pConData->xConnection); + (void)ensureConnection(m_xCurrentlyDisplayed.get(), pConData->xConnection); if ( !pConData->xConnection.is() ) { diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx index 3331bd55930b..11fcf5ff6c1e 100644 --- a/dbaccess/source/ui/misc/datasourceconnector.cxx +++ b/dbaccess/source/ui/misc/datasourceconnector.cxx @@ -184,7 +184,7 @@ namespace dbaui { if ( _pErrorInfo ) { - *_pErrorInfo = aInfo; + *_pErrorInfo = std::move(aInfo); } else { diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 2519f2d985c6..03a5457edcc8 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5350,7 +5350,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma { bResult = comphelper::dispatchCommand(aCommand, comphelper::containerToSequence(aPropertyValuesVector), new DispatchResultListener(pCommand, pDocument->mpCallbackFlushHandlers[nView], - pDocSh->IsModified())); + pDocSh && pDocSh->IsModified())); } else bResult = comphelper::dispatchCommand(aCommand, comphelper::containerToSequence(aPropertyValuesVector)); @@ -8018,8 +8018,8 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char #else // Fun conversion dance back and forth between URLs and system paths... OUString aAppURL; - ::osl::Module::getUrlFromAddress( reinterpret_cast< oslGenericFunction >(lo_initialize), - aAppURL); + (void)::osl::Module::getUrlFromAddress(reinterpret_cast(lo_initialize), + aAppURL); osl::FileBase::getSystemPathFromFileURL( aAppURL, aAppPath ); #endif diff --git a/download.lst b/download.lst index 5109548968b7..ee933443ede9 100644 --- a/download.lst +++ b/download.lst @@ -265,6 +265,41 @@ FONT_SCHEHERAZADE_TARBALL := Scheherazade-2.100.zip # three static lines # so that git cherry-pick # will not run into conflicts +FONT_AGDASIMA_TARBALL := Agdasima-2.002.zip +FONT_AGDASIMA_SHA256SUM := b4c17499f8bc183320ffdcf1f8491c778dd68a237adc056dc08e1fcb2da488f3 +# three static lines +# so that git cherry-pick +# will not run into conflicts +FONT_BACASIME_ANTIQUE_TARBALL := Bacasime_Antique-2.000.zip +FONT_BACASIME_ANTIQUE_SHA256SUM := 81127cebc97d4ee0b950c2bc2d6be0ed29abfe0d5988435eb9a39e382557250a +# three static lines +# so that git cherry-pick +# will not run into conflicts +FONT_BELANOSIMA_TARBALL := Belanosima-2.000.zip +FONT_BELANOSIMA_SHA256SUM := 9c30e9e7cdb0797b651113a77f6b789659b8d8598a466b2ba92754e9dec30449 +# three static lines +# so that git cherry-pick +# will not run into conflicts +FONT_CAPRASIMO_TARBALL := Caprasimo-1.001.zip +FONT_CAPRASIMO_SHA256SUM := f066d27cfc99b6601083be102d08b4039da8d2834e2795aabd890f16c6fd1b9b +# three static lines +# so that git cherry-pick +# will not run into conflicts +FONT_LUGRASIMO_TARBALL := Lugrasimo-1.001.zip +FONT_LUGRASIMO_SHA256SUM := db24dff31e8ddf6a113556c947a219f9534b072852e9ce2079a08c94854a7503 +# three static lines +# so that git cherry-pick +# will not run into conflicts +FONT_LUMANOSIMO_TARBALL := Lumanosimo-1.010.zip +FONT_LUMANOSIMO_SHA256SUM := d4545ad6afded9a55d9a7728cfc7453cf5637861db87aafe0a730676a0cb960f +# three static lines +# so that git cherry-pick +# will not run into conflicts +FONT_LUNASIMA_TARBALL := Lunasima-2.009.zip +FONT_LUNASIMA_SHA256SUM := 4302809cf4b95b481bec53de87484d919b391c90a518d065f6c775fd435a5393 +# three static lines +# so that git cherry-pick +# will not run into conflicts FREEHAND_SHA256SUM := 0e422d1564a6dbf22a9af598535425271e583514c0f7ba7d9091676420de34ac FREEHAND_TARBALL := libfreehand-0.1.2.tar.xz # three static lines @@ -427,14 +462,14 @@ XMLSEC_TARBALL := xmlsec1-1.3.4.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -LIBXML_SHA256SUM := 25239263dc37f5f55a5393eff27b35f0b7d9ea4b2a7653310598ea8299e3b741 -LIBXML_VERSION_MICRO := 1 -LIBXML_TARBALL := libxml2-2.13.$(LIBXML_VERSION_MICRO).tar.xz +LIBXML_SHA256SUM := 43ad877b018bc63deb2468d71f95219c2fac196876ef36d1bee51d226173ec93 +LIBXML_VERSION_MICRO := 8 +LIBXML_TARBALL := libxml2-2.12.$(LIBXML_VERSION_MICRO).tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -LIBXSLT_SHA256SUM := 3ad392af91115b7740f7b50d228cc1c5fc13afc1da7f16cb0213917a37f71bda -LIBXSLT_VERSION_MICRO := 41 +LIBXSLT_SHA256SUM := 85ca62cac0d41fc77d3f6033da9df6fd73d20ea2fc18b0a3609ffb4110e1baeb +LIBXSLT_VERSION_MICRO := 42 LIBXSLT_TARBALL := libxslt-1.1.$(LIBXSLT_VERSION_MICRO).tar.xz # three static lines # so that git cherry-pick @@ -558,8 +593,8 @@ POSTGRESQL_TARBALL := postgresql-14.12.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts -PYTHON_SHA256SUM := d4892cd1618f6458cb851208c030df1482779609d0f3939991bd38184f8c679e -PYTHON_TARBALL := Python-3.9.19.tar.xz +PYTHON_SHA256SUM := 9c50481faa8c2832329ba0fc8868d0a606a680fc4f60ec48d26ce8e076751fda +PYTHON_TARBALL := Python-3.10.14.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index 8e5463606dd9..beef19918f7c 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -77,6 +77,7 @@ endif ifeq ($(USE_HEADLESS_CODE),TRUE) $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/processor2d/cairopixelprocessor2d \ + drawinglayer/source/processor2d/SDPRProcessor2dTools \ )) endif diff --git a/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx b/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx index 7d001cfd67fd..ae2ddfae81ad 100644 --- a/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx +++ b/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx @@ -184,7 +184,7 @@ bool prepareBitmapForDirectRender( basegfx::B2DRange aDiscreteRange(basegfx::B2DRange::getUnitB2DRange()); aDiscreteRange.transform(aLocalTransform); - if (!rDiscreteViewPort.overlaps(rDiscreteViewPort)) + if (!aDiscreteRange.overlaps(rDiscreteViewPort)) { // we have a Viewport and visible range of geometry is outside -> not visible, done return false; diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx index 89cb21ddcb74..ecdda41e9587 100644 --- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -32,63 +33,47 @@ #include #include #include +#include +#include #include #include #include #include +#include #include +#include +#include using namespace com::sun::star; namespace { -basegfx::B2DPoint impPixelSnap(const basegfx::B2DPolygon& rPolygon, - const drawinglayer::geometry::ViewInformation2D& rViewInformation, - sal_uInt32 nIndex) +void impl_cairo_set_hairline(cairo_t* pRT, + const drawinglayer::geometry::ViewInformation2D& rViewInformation) { - const sal_uInt32 nCount(rPolygon.count()); - - // get the data - const basegfx::B2ITuple aPrevTuple( - basegfx::fround(rViewInformation.getObjectToViewTransformation() - * rPolygon.getB2DPoint((nIndex + nCount - 1) % nCount))); - const basegfx::B2DPoint aCurrPoint(rViewInformation.getObjectToViewTransformation() - * rPolygon.getB2DPoint(nIndex)); - const basegfx::B2ITuple aCurrTuple(basegfx::fround(aCurrPoint)); - const basegfx::B2ITuple aNextTuple( - basegfx::fround(rViewInformation.getObjectToViewTransformation() - * rPolygon.getB2DPoint((nIndex + 1) % nCount))); - - // get the states - const bool bPrevVertical(aPrevTuple.getX() == aCurrTuple.getX()); - const bool bNextVertical(aNextTuple.getX() == aCurrTuple.getX()); - const bool bPrevHorizontal(aPrevTuple.getY() == aCurrTuple.getY()); - const bool bNextHorizontal(aNextTuple.getY() == aCurrTuple.getY()); - const bool bSnapX(bPrevVertical || bNextVertical); - const bool bSnapY(bPrevHorizontal || bNextHorizontal); - - if (bSnapX || bSnapY) +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 18, 0) + void* addr(dlsym(nullptr, "cairo_set_hairline")); + if (nullptr != addr) { - basegfx::B2DPoint aSnappedPoint(bSnapX ? aCurrTuple.getX() : aCurrPoint.getX(), - bSnapY ? aCurrTuple.getY() : aCurrPoint.getY()); - - aSnappedPoint *= rViewInformation.getInverseObjectToViewTransformation(); - - return aSnappedPoint; + cairo_set_hairline(pRT, true); + return; } - - return rPolygon.getB2DPoint(nIndex); +#endif + // avoid cairo_device_to_user_distance, see note on that below + const double fPx( + (rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)) + .getLength()); + cairo_set_line_width(pRT, fPx); } -void addB2DPolygonToPathGeometry(cairo_t* cr, const basegfx::B2DPolygon& rPolygon, - const drawinglayer::geometry::ViewInformation2D* pViewInformation) +void addB2DPolygonToPathGeometry(cairo_t* pRT, const basegfx::B2DPolygon& rPolygon) { // short circuit if there is nothing to do const sal_uInt32 nPointCount(rPolygon.count()); const bool bHasCurves(rPolygon.areControlPointsUsed()); const bool bClosePath(rPolygon.isClosed()); - basegfx::B2DPoint aLast; + const basegfx::B2DPoint* pLast(nullptr); for (sal_uInt32 nPointIdx = 0, nPrevIdx = 0;; nPrevIdx = nPointIdx++) { @@ -106,15 +91,13 @@ void addB2DPolygonToPathGeometry(cairo_t* cr, const basegfx::B2DPolygon& rPolygo } } - const basegfx::B2DPoint aPoint(nullptr == pViewInformation - ? rPolygon.getB2DPoint(nClosedIdx) - : impPixelSnap(rPolygon, *pViewInformation, nClosedIdx)); + const basegfx::B2DPoint& rPoint(rPolygon.getB2DPoint(nClosedIdx)); if (!nPointIdx) { // first point => just move there - cairo_move_to(cr, aPoint.getX(), aPoint.getY()); - aLast = aPoint; + cairo_move_to(pRT, rPoint.getX(), rPoint.getY()); + pLast = &rPoint; continue; } @@ -128,7 +111,7 @@ void addB2DPolygonToPathGeometry(cairo_t* cr, const basegfx::B2DPolygon& rPolygo if (!bPendingCurve) // line segment { - cairo_line_to(cr, aPoint.getX(), aPoint.getY()); + cairo_line_to(pRT, rPoint.getX(), rPoint.getY()); } else // cubic bezier segment { @@ -139,54 +122,321 @@ void addB2DPolygonToPathGeometry(cairo_t* cr, const basegfx::B2DPolygon& rPolygo // correct replacement ones to avoid problems with the graphical sub-system // tdf#101026 The 1st attempt to create a mathematically correct replacement control // vector was wrong. Best alternative is one as close as possible which means short. - if (aCP1.equal(aLast)) + if (aCP1.equal(*pLast)) { - aCP1 = aLast + ((aCP2 - aLast) * 0.0005); + aCP1 = *pLast + ((aCP2 - *pLast) * 0.0005); } - if (aCP2.equal(aPoint)) + if (aCP2.equal(rPoint)) { - aCP2 = aPoint + ((aCP1 - aPoint) * 0.0005); + aCP2 = rPoint + ((aCP1 - rPoint) * 0.0005); } - cairo_curve_to(cr, aCP1.getX(), aCP1.getY(), aCP2.getX(), aCP2.getY(), aPoint.getX(), - aPoint.getY()); + cairo_curve_to(pRT, aCP1.getX(), aCP1.getY(), aCP2.getX(), aCP2.getY(), rPoint.getX(), + rPoint.getY()); } - aLast = aPoint; + pLast = &rPoint; } if (bClosePath) { - cairo_close_path(cr); + cairo_close_path(pRT); } } -// split alpha remains as a constant irritant -std::vector createBitmapData(const BitmapEx& rBitmapEx) +// needed as helper, see below. It guarantees clean +// construction/cleanup using destructor +// NOTE: maybe mpSurface can be constructed even simpler, +// not sure about that. It is only used to construct +// and hold path data +struct CairoContextHolder { - const Size& rSizePixel(rBitmapEx.GetSizePixel()); - const bool bAlpha(rBitmapEx.IsAlpha()); - const sal_uInt32 nStride - = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, rSizePixel.Width()); - std::vector aData(nStride * rSizePixel.Height()); + cairo_surface_t* mpSurface; + cairo_t* mpRenderContext; - if (bAlpha) + CairoContextHolder() + : mpSurface(cairo_image_surface_create(CAIRO_FORMAT_A1, 1, 1)) + , mpRenderContext(cairo_create(mpSurface)) + { + } + + ~CairoContextHolder() + { + cairo_destroy(mpRenderContext); + cairo_surface_destroy(mpSurface); + } + + cairo_t* getContext() const { return mpRenderContext; } +}; + +// global static helper instance +CairoContextHolder globalStaticCairoContext; + +// it shows that re-using and buffering path geometry data using +// cairo is more complicated than initially thought: when adding +// a path to a cairo_t render context it already *uses* the set +// transformation, also usually consumes the path when painting. +// The (only available) method cairo_copy_path to preserve that +// data *also* transforms the path - if not already created in +// transformed form - using the current transformation set at the +// cairo context. +// This is not what we want to have a re-usable path that is +// buffered at the Poly(poly)gon: we explicitly want *exactly* +// the coordinates in the polygon preserved *at* the polygon to +// be able to re-use that data independent from any set +// transformation at any cairo context. +// Thus, create paths using a helper (CairoPathHelper) using a +// helper cairo context (CairoContextHolder) that never gets +// transformed. This removes the need to feed it the cairo context, +// but also does not immediately add the path data to the target +// context, that needs to be done using cairo_append_path at the +// target cairo context. That works since all geometry is designed +// to use exactly that coordinate system the polygon is already +// designed for anyways, and it transforms as needed inside the +// target cairo context as needed (if transform is set) +class CairoPathHelper +{ + // the created CairoPath + cairo_path_t* mpCairoPath; + +public: + CairoPathHelper(const basegfx::B2DPolygon& rPolygon) + : mpCairoPath(nullptr) + { + cairo_new_path(globalStaticCairoContext.getContext()); + addB2DPolygonToPathGeometry(globalStaticCairoContext.getContext(), rPolygon); + mpCairoPath = cairo_copy_path(globalStaticCairoContext.getContext()); + cairo_new_path(globalStaticCairoContext.getContext()); + } + + CairoPathHelper(const basegfx::B2DPolyPolygon& rPolyPolygon) + : mpCairoPath(nullptr) + { + cairo_new_path(globalStaticCairoContext.getContext()); + for (const auto& rPolygon : rPolyPolygon) + addB2DPolygonToPathGeometry(globalStaticCairoContext.getContext(), rPolygon); + mpCairoPath = cairo_copy_path(globalStaticCairoContext.getContext()); + cairo_new_path(globalStaticCairoContext.getContext()); + } + + ~CairoPathHelper() + { + // need to cleanup instance + cairo_path_destroy(mpCairoPath); + } + + // read access + cairo_path_t* getCairoPath() const { return mpCairoPath; } + + sal_Int64 getEstimatedSize() const + { + if (nullptr == mpCairoPath) + return 0; + + // per node: + // - num_data incarnations of + // - sizeof(cairo_path_data_t) which is a union of defines and point data + // thus may 2 x sizeof(double) + return mpCairoPath->num_data * sizeof(cairo_path_data_t); + } +}; + +class SystemDependentData_CairoPathGeometry : public basegfx::SystemDependentData +{ + // the CairoPath holder + std::shared_ptr mpCairoPathHelper; + +public: + SystemDependentData_CairoPathGeometry(const std::shared_ptr& pCairoPathHelper) + : basegfx::SystemDependentData(Application::GetSystemDependentDataManager()) + , mpCairoPathHelper(pCairoPathHelper) + { + } + + // read access + const std::shared_ptr& getCairoPathHelper() const { return mpCairoPathHelper; } + + virtual sal_Int64 estimateUsageInBytes() const override + { + return (nullptr != mpCairoPathHelper) ? mpCairoPathHelper->getEstimatedSize() : 0; + } +}; + +constexpr unsigned long nMinimalPointsPath(4); +constexpr unsigned long nMinimalPointsFill(12); + +void checkAndDoPixelSnap(cairo_t* pRT, + const drawinglayer::geometry::ViewInformation2D& rViewInformation) +{ + const bool bPixelSnap(rViewInformation.getPixelSnapHairline() + && rViewInformation.getUseAntiAliasing()); + + if (!bPixelSnap) + { + // no pixel snap, done + return; + } + + // with the comments above at CairoPathHelper we cannot do PixelSnap + // at path construction time, so it needs to be done *after* the path + // data is added to the cairo context. ADvantage is that all general + // path data can be buffered, though, but needs view-dependent manipulation + // here after being added. + // For now, just snap all points - no real need to identify hor/ver lines + // when you think about it + + // get helper path + cairo_path_t* path(cairo_copy_path(pRT)); + + if (0 == path->num_data) + { + // path is empty, done + cairo_path_destroy(path); + return; + } + + for (int a(0); a < path->num_data; a += path->data[a].header.length) + { + cairo_path_data_t* data(&path->data[a]); + + switch (data->header.type) + { + case CAIRO_PATH_MOVE_TO: + case CAIRO_PATH_LINE_TO: + case CAIRO_PATH_CURVE_TO: + { + // NOTE: for CAIRO_PATH_CURVE_TO we would also have the control + // points, but these do not really need correction. If that may + // change a correction using the deltas in x and y could be added + + // get pointers to double data + double* pX(&data[1].point.x); + double* pY(&data[1].point.y); + + // transform to discrete pixels + cairo_user_to_device(pRT, pX, pY); + + // round them, also subtract 0.5 which will be as transform in + // the paint method to move to 'inside' pixels when AA used. + // remember: this is only done when AA is active (see bPixelSnap + // above) + *pX = basegfx::fround(*pX) - 0.5; + *pY = basegfx::fround(*pY) - 0.5; + + // transform back to former transformed state + cairo_device_to_user(pRT, pX, pY); + break; + } + case CAIRO_PATH_CLOSE_PATH: + { + break; + } + } + } + + // set changed path back at cairo context + cairo_new_path(pRT); + cairo_append_path(pRT, path); + + // destroy helper path + cairo_path_destroy(path); +} + +void getOrCreatePathGeometry(cairo_t* pRT, const basegfx::B2DPolygon& rPolygon, + const drawinglayer::geometry::ViewInformation2D& rViewInformation) +{ + // try to access buffered data + std::shared_ptr pSystemDependentData_CairoPathGeometry( + rPolygon.getSystemDependentData()); + + if (pSystemDependentData_CairoPathGeometry) + { + // re-use data and do evtl. needed pixel snap after adding on cairo path data + cairo_append_path( + pRT, pSystemDependentData_CairoPathGeometry->getCairoPathHelper()->getCairoPath()); + checkAndDoPixelSnap(pRT, rViewInformation); + return; + } + + // create new data and add path data to pRT and do evtl. needed pixel snap after adding on cairo path data + std::shared_ptr pCairoPathHelper(std::make_shared(rPolygon)); + cairo_append_path(pRT, pCairoPathHelper->getCairoPath()); + checkAndDoPixelSnap(pRT, rViewInformation); + + // add to buffering mechanism if not trivial + if (rPolygon.count() > nMinimalPointsPath) + rPolygon.addOrReplaceSystemDependentData( + pCairoPathHelper); +} + +void getOrCreateFillGeometry(cairo_t* pRT, const basegfx::B2DPolyPolygon& rPolyPolygon) +{ + // try to access buffered data + std::shared_ptr pSystemDependentData_CairoPathGeometry( + rPolyPolygon.getSystemDependentData()); + + if (pSystemDependentData_CairoPathGeometry) + { + // re-use data + cairo_append_path( + pRT, pSystemDependentData_CairoPathGeometry->getCairoPathHelper()->getCairoPath()); + return; + } + + // create new data and add path data to pRT + std::shared_ptr pCairoPathHelper( + std::make_shared(rPolyPolygon)); + cairo_append_path(pRT, pCairoPathHelper->getCairoPath()); + + // get all PointCount to detect non-trivial + sal_uInt32 nAllPointCount(0); + for (const auto& rPolygon : rPolyPolygon) + nAllPointCount += rPolygon.count(); + + // add to buffering mechanism when no PixelSnapHairline (see above) and not trivial + if (nAllPointCount > nMinimalPointsFill) + rPolyPolygon.addOrReplaceSystemDependentData( + pCairoPathHelper); +} + +// check for env var that decides for using downscale pattern +const char* pDisableDownScale(getenv("SAL_DISABLE_CAIRO_DOWNSCALE")); +const bool bDisableDownScale(nullptr != pDisableDownScale); +constexpr unsigned long nMinimalDiscreteSize(15); +constexpr unsigned long nHalfMDSize((nMinimalDiscreteSize + 1) / 2); +constexpr unsigned long +nMinimalDiscreteSquareSizeToBuffer(nMinimalDiscreteSize* nMinimalDiscreteSize); + +class CairoSurfaceHelper +{ + // the buffered CairoSurface (bitmap data) + cairo_surface_t* mpCairoSurface; + + // evtl. MipMapped data (pre-scale to reduce data processing load) + mutable std::unordered_map maDownscaled; + + // create 32bit RGBA data for given BitmapEx + void createRGBA(const BitmapEx& rBitmapEx) { Bitmap aSrcAlpha(rBitmapEx.GetAlphaMask().GetBitmap()); BitmapScopedReadAccess pReadAccess(rBitmapEx.GetBitmap()); BitmapScopedReadAccess pAlphaReadAccess(aSrcAlpha); const tools::Long nHeight(pReadAccess->Height()); const tools::Long nWidth(pReadAccess->Width()); + mpCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nWidth, nHeight); + const sal_uInt32 nStride(cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nWidth)); + unsigned char* surfaceData(cairo_image_surface_get_data(mpCairoSurface)); - for (tools::Long y = 0; y < nHeight; ++y) + for (tools::Long y(0); y < nHeight; ++y) { - unsigned char* pPixelData = aData.data() + (nStride * y); - for (tools::Long x = 0; x < nWidth; ++x) + unsigned char* pPixelData(surfaceData + (nStride * y)); + + for (tools::Long x(0); x < nWidth; ++x) { const BitmapColor aColor(pReadAccess->GetColor(y, x)); const BitmapColor aAlpha(pAlphaReadAccess->GetColor(y, x)); - const sal_uInt16 nAlpha(255 - aAlpha.GetRed()); + const sal_uInt16 nAlpha(aAlpha.GetRed()); pPixelData[SVP_CAIRO_RED] = vcl::bitmap::premultiply(nAlpha, aColor.GetRed()); pPixelData[SVP_CAIRO_GREEN] = vcl::bitmap::premultiply(nAlpha, aColor.GetGreen()); @@ -195,41 +445,343 @@ std::vector createBitmapData(const BitmapEx& rBitmapEx) pPixelData += 4; } } + + cairo_surface_mark_dirty(mpCairoSurface); } - else + + // create 32bit RGB data for given BitmapEx + void createRGB(const BitmapEx& rBitmapEx) { BitmapScopedReadAccess pReadAccess(rBitmapEx.GetBitmap()); const tools::Long nHeight(pReadAccess->Height()); const tools::Long nWidth(pReadAccess->Width()); + mpCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, nWidth, nHeight); + sal_uInt32 nStride(cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, nWidth)); + unsigned char* surfaceData(cairo_image_surface_get_data(mpCairoSurface)); - for (tools::Long y = 0; y < nHeight; ++y) + for (tools::Long y(0); y < nHeight; ++y) { - unsigned char* pPixelData = aData.data() + (nStride * y); - for (tools::Long x = 0; x < nWidth; ++x) + unsigned char* pPixelData(surfaceData + (nStride * y)); + + for (tools::Long x(0); x < nWidth; ++x) { const BitmapColor aColor(pReadAccess->GetColor(y, x)); + pPixelData[SVP_CAIRO_RED] = aColor.GetRed(); pPixelData[SVP_CAIRO_GREEN] = aColor.GetGreen(); pPixelData[SVP_CAIRO_BLUE] = aColor.GetBlue(); - pPixelData[SVP_CAIRO_ALPHA] = 255; + pPixelData[SVP_CAIRO_ALPHA] = 255; // not really needed pPixelData += 4; } } + + cairo_surface_mark_dirty(mpCairoSurface); } - return aData; +// #define TEST_RGB16 +#ifdef TEST_RGB16 + // experimental: create 16bit RGB data for given BitmapEx + void createRGB16(const BitmapEx& rBitmapEx) + { + BitmapScopedReadAccess pReadAccess(rBitmapEx.GetBitmap()); + const tools::Long nHeight(pReadAccess->Height()); + const tools::Long nWidth(pReadAccess->Width()); + mpCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_RGB16_565, nWidth, nHeight); + sal_uInt32 nStride(cairo_format_stride_for_width(CAIRO_FORMAT_RGB16_565, nWidth)); + unsigned char* surfaceData(cairo_image_surface_get_data(mpCairoSurface)); + + for (tools::Long y(0); y < nHeight; ++y) + { + unsigned char* pPixelData(surfaceData + (nStride * y)); + + for (tools::Long x(0); x < nWidth; ++x) + { + const BitmapColor aColor(pReadAccess->GetColor(y, x)); + const sal_uInt8 aLeft((aColor.GetBlue() >> 3) | ((aColor.GetGreen() << 3) & 0xe0)); + const sal_uInt8 aRight((aColor.GetRed() & 0xf8) | (aColor.GetGreen() >> 5)); +#ifdef OSL_BIGENDIAN + pPixelData[1] = aRight; + pPixelData[0] = aLeft; +#else + pPixelData[0] = aLeft; + pPixelData[1] = aRight; +#endif + pPixelData += 2; + } + } + + cairo_surface_mark_dirty(mpCairoSurface); + } +#endif + +public: + CairoSurfaceHelper(const BitmapEx& rBitmapEx) + : mpCairoSurface(nullptr) + , maDownscaled() + { + if (rBitmapEx.IsAlpha()) + createRGBA(rBitmapEx); + else +#ifdef TEST_RGB16 + createRGB16(rBitmapEx); +#else + createRGB(rBitmapEx); +#endif + } + + ~CairoSurfaceHelper() + { + // cleanup surface + cairo_surface_destroy(mpCairoSurface); + + // cleanup MipMap surfaces + for (auto& candidate : maDownscaled) + cairo_surface_destroy(candidate.second); + } + + cairo_surface_t* getCairoSurface(sal_uInt32 nTargetWidth = 0, + sal_uInt32 nTargetHeight = 0) const + { + // in simple cases just return the single created surface + if (bDisableDownScale || nullptr == mpCairoSurface || 0 == nTargetWidth + || 0 == nTargetHeight) + return mpCairoSurface; + + // get width/height of original surface + const sal_uInt32 nSourceWidth(cairo_image_surface_get_width(mpCairoSurface)); + const sal_uInt32 nSourceHeight(cairo_image_surface_get_height(mpCairoSurface)); + + // zoomed in, need to stretch at paint, no pre-scale useful + if (nTargetWidth >= nSourceWidth || nTargetHeight >= nSourceHeight) + return mpCairoSurface; + + // calculate downscale factor. Only use ONE factor to get the diagonal + // MipMap, NOT the full MipMap field in X/Y for uneven factors in both dimensions + sal_uInt32 nFactor(1); + sal_uInt32 nW((nSourceWidth + 1) / 2); + sal_uInt32 nH((nSourceHeight + 1) / 2); + + while (nW > nTargetWidth && nW > nHalfMDSize && nH > nTargetHeight && nH > nHalfMDSize) + { + nW = (nW + 1) / 2; + nH = (nH + 1) / 2; + nFactor *= 2; + } + + if (1 == nFactor) + { + // original size *is* best binary size, use it + return mpCairoSurface; + } + + // go up one scale again + nW *= 2; + nH *= 2; + + // bail out if the multiplication for the key would overflow + if (nW >= SAL_MAX_UINT32 || nH >= SAL_MAX_UINT32) + return mpCairoSurface; + + // check if we have a downscaled version of required size + const sal_uInt64 key((nW * static_cast(SAL_MAX_UINT32)) + nH); + auto isHit(maDownscaled.find(key)); + + // found -> return it + if (isHit != maDownscaled.end()) + return isHit->second; + + // create new surface in the targeted size + cairo_surface_t* pSurfaceTarget(cairo_surface_create_similar( + mpCairoSurface, cairo_surface_get_content(mpCairoSurface), nW, nH)); + + // made a version to scale self first with direct memory access. + // That worked well, but would've been hard to support + // CAIRO_FORMAT_A1 and similar (including bit shifting), so + // I decided to go with cairo itself - use CAIRO_FILTER_FAST or + // CAIRO_FILTER_GOOD though. Please modify as needed for + // performance/quality + cairo_t* cr = cairo_create(pSurfaceTarget); + const double fScaleX(static_cast(nW) / static_cast(nSourceWidth)); + const double fScaleY(static_cast(nH) / static_cast(nSourceHeight)); + + cairo_scale(cr, fScaleX, fScaleY); + cairo_set_source_surface(cr, mpCairoSurface, 0.0, 0.0); + cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_GOOD); + cairo_paint(cr); + cairo_destroy(cr); + + // NOTE: Took out, until now not really needed + // need to set device_scale for downscale surfaces to get + // them handled correctly + // cairo_surface_set_device_scale(pSurfaceTarget, fScaleX, fScaleY); + + // add entry to cached entries + maDownscaled[key] = pSurfaceTarget; + + return pSurfaceTarget; + } + + bool isTrivial() const + { + if (nullptr == mpCairoSurface) + return true; + + const sal_uInt32 nSourceWidth(cairo_image_surface_get_width(mpCairoSurface)); + const sal_uInt32 nSourceHeight(cairo_image_surface_get_height(mpCairoSurface)); + + return nSourceWidth * nSourceHeight < nMinimalDiscreteSquareSizeToBuffer; + } +}; + +class SystemDependentData_CairoSurface : public basegfx::SystemDependentData +{ + // the CairoSurface holder + std::shared_ptr mpCairoSurfaceHelper; + + // need to remember alpha source for combined BitmapEx to detect/ + // react on that changing + std::shared_ptr maAssociatedAlpha; + +public: + SystemDependentData_CairoSurface(const BitmapEx& rBitmapEx) + : basegfx::SystemDependentData(Application::GetSystemDependentDataManager()) + , mpCairoSurfaceHelper(std::make_shared(rBitmapEx)) + , maAssociatedAlpha() + { + if (rBitmapEx.IsAlpha()) + maAssociatedAlpha = rBitmapEx.GetAlphaMask().GetBitmap().ImplGetSalBitmap(); + } + + // read access + const std::shared_ptr& getCairoSurfaceHelper() const + { + return mpCairoSurfaceHelper; + } + const std::shared_ptr& getAssociatedAlpha() const { return maAssociatedAlpha; } + + virtual sal_Int64 estimateUsageInBytes() const override; +}; + +sal_Int64 SystemDependentData_CairoSurface::estimateUsageInBytes() const +{ + sal_Int64 nRetval(0); + + if (mpCairoSurfaceHelper) + { + cairo_surface_t* pSurface(mpCairoSurfaceHelper->getCairoSurface()); + const tools::Long nStride(cairo_image_surface_get_stride(pSurface)); + const tools::Long nHeight(cairo_image_surface_get_height(pSurface)); + + nRetval = nStride * nHeight; + + // if we do downscale, size will grow by 1/4 + 1/16 + 1/32 + ..., + // rough estimation just multiplies by 1.25 .. 1.33, should be good enough + // for estimation of buffer survival time + if (!bDisableDownScale) + { + nRetval = (nRetval * 5) / 4; + } + } + + return nRetval; +} + +std::shared_ptr getOrCreateCairoSurfaceHelper(const BitmapEx& rBitmapEx) +{ + const basegfx::SystemDependentDataHolder* pHolder( + rBitmapEx.GetBitmap().accessSystemDependentDataHolder()); + std::shared_ptr pSystemDependentData_CairoSurface; + + if (nullptr != pHolder) + { + // try to access SystemDependentDataHolder and buffered data + pSystemDependentData_CairoSurface + = std::static_pointer_cast( + pHolder->getSystemDependentData( + typeid(SystemDependentData_CairoSurface).hash_code())); + + // check data validity for associated Alpha + if (pSystemDependentData_CairoSurface && rBitmapEx.IsAlpha() + && pSystemDependentData_CairoSurface->getAssociatedAlpha() + != rBitmapEx.GetAlphaMask().GetBitmap().ImplGetSalBitmap()) + { + // AssociatedAlpha did change, data invalid + pSystemDependentData_CairoSurface.reset(); + } + } + + if (!pSystemDependentData_CairoSurface) + { + // create new SystemDependentData_CairoSurface + pSystemDependentData_CairoSurface + = std::make_shared(rBitmapEx); + + // only add if feasible + if (nullptr != pHolder + && !pSystemDependentData_CairoSurface->getCairoSurfaceHelper()->isTrivial() + && pSystemDependentData_CairoSurface->calculateCombinedHoldCyclesInSeconds() > 0) + { + basegfx::SystemDependentData_SharedPtr r2(pSystemDependentData_CairoSurface); + const_cast(pHolder) + ->addOrReplaceSystemDependentData(r2); + } + } + + return pSystemDependentData_CairoSurface->getCairoSurfaceHelper(); +} + +// This bit-tweaking looping is unpleasant and unfortunate +void LuminanceToAlpha(cairo_surface_t* pMask) +{ + cairo_surface_flush(pMask); + + const sal_uInt32 nWidth(cairo_image_surface_get_width(pMask)); + const sal_uInt32 nHeight(cairo_image_surface_get_height(pMask)); + const sal_uInt32 nStride(cairo_image_surface_get_stride(pMask)); + + if (0 == nWidth || 0 == nHeight) + return; + + unsigned char* mask_surface_data = cairo_image_surface_get_data(pMask); + + // include/basegfx/color/bcolormodifier.hxx + constexpr double nRedMul(0.2125 / 255.0); + constexpr double nGreenMul(0.7154 / 255.0); + constexpr double nBlueMul(0.0721 / 255.0); + + // Only this alpha channel is taken into account by cairo_mask_surface + // so reuse this surface for the alpha result + for (sal_uInt32 y(0); y < nHeight; ++y) + { + unsigned char* pMaskPixelData = mask_surface_data + (nStride * y); + + for (sal_uInt32 x(0); x < nWidth; ++x) + { + // do not forget that we have pre-multiplied alpha + const sal_uInt8 nAlpha(pMaskPixelData[SVP_CAIRO_ALPHA]); + + if (0 != nAlpha) + { + const double fLuminance = pMaskPixelData[SVP_CAIRO_RED] * nRedMul + + pMaskPixelData[SVP_CAIRO_GREEN] * nGreenMul + + pMaskPixelData[SVP_CAIRO_BLUE] * nBlueMul; + + if (255 != nAlpha) + pMaskPixelData[SVP_CAIRO_ALPHA] = fLuminance / nAlpha; + else + pMaskPixelData[SVP_CAIRO_ALPHA] = 255.0 * fLuminance; + } + + pMaskPixelData += 4; + } + } + + cairo_surface_mark_dirty(pMask); } } namespace drawinglayer::processor2d { -CairoPixelProcessor2D::CairoPixelProcessor2D(const geometry::ViewInformation2D& rViewInformation) - : BaseProcessor2D(rViewInformation) - , maBColorModifierStack() - , mpRT(nullptr) -{ -} - CairoPixelProcessor2D::CairoPixelProcessor2D(const geometry::ViewInformation2D& rViewInformation, cairo_surface_t* pTarget) : BaseProcessor2D(rViewInformation) @@ -241,6 +793,7 @@ CairoPixelProcessor2D::CairoPixelProcessor2D(const geometry::ViewInformation2D& cairo_t* pRT = cairo_create(pTarget); cairo_set_antialias(pRT, rViewInformation.getUseAntiAliasing() ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE); + cairo_set_fill_rule(pRT, CAIRO_FILL_RULE_EVEN_ODD); setRenderTarget(pRT); } } @@ -251,81 +804,6 @@ CairoPixelProcessor2D::~CairoPixelProcessor2D() cairo_destroy(mpRT); } -void CairoPixelProcessor2D::processPolygonHairlinePrimitive2D( - const primitive2d::PolygonHairlinePrimitive2D& rPolygonHairlinePrimitive2D) -{ - const basegfx::B2DPolygon& rPolygon(rPolygonHairlinePrimitive2D.getB2DPolygon()); - - if (!rPolygon.count()) - return; - - cairo_save(mpRT); - - cairo_matrix_t aMatrix; - const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 0.5 : 0.0); - const basegfx::B2DHomMatrix& rObjectToView( - getViewInformation2D().getObjectToViewTransformation()); - cairo_matrix_init(&aMatrix, rObjectToView.a(), rObjectToView.b(), rObjectToView.c(), - rObjectToView.d(), rObjectToView.e() + fAAOffset, - rObjectToView.f() + fAAOffset); - - // set linear transformation - cairo_set_matrix(mpRT, &aMatrix); - - const basegfx::BColor aHairlineColor( - maBColorModifierStack.getModifiedColor(rPolygonHairlinePrimitive2D.getBColor())); - cairo_set_source_rgb(mpRT, aHairlineColor.getRed(), aHairlineColor.getGreen(), - aHairlineColor.getBlue()); - - // TODO: Unfortunately Direct2D paint of one pixel wide lines does not - // correctly and completely blend 100% over the background. Experimenting - // shows that a value around/slightly below 2.0 is needed which hints that - // alpha blending the half-shifted lines (see fAAOffset above) is involved. - // To get correct blending I try to use just wider hairlines for now. This - // may need to be improved - or balanced (trying sqrt(2) now...) - cairo_set_line_width(mpRT, 1.44f); - - addB2DPolygonToPathGeometry(mpRT, rPolygon, &getViewInformation2D()); - - cairo_stroke(mpRT); - - cairo_restore(mpRT); -} - -void CairoPixelProcessor2D::processPolyPolygonColorPrimitive2D( - const primitive2d::PolyPolygonColorPrimitive2D& rPolyPolygonColorPrimitive2D) -{ - const basegfx::B2DPolyPolygon& rPolyPolygon(rPolyPolygonColorPrimitive2D.getB2DPolyPolygon()); - const sal_uInt32 nCount(rPolyPolygon.count()); - - if (!nCount) - return; - - cairo_save(mpRT); - - cairo_matrix_t aMatrix; - const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 0.5 : 0.0); - const basegfx::B2DHomMatrix& rObjectToView( - getViewInformation2D().getObjectToViewTransformation()); - cairo_matrix_init(&aMatrix, rObjectToView.a(), rObjectToView.b(), rObjectToView.c(), - rObjectToView.d(), rObjectToView.e() + fAAOffset, - rObjectToView.f() + fAAOffset); - - // set linear transformation - cairo_set_matrix(mpRT, &aMatrix); - - const basegfx::BColor aFillColor( - maBColorModifierStack.getModifiedColor(rPolyPolygonColorPrimitive2D.getBColor())); - cairo_set_source_rgb(mpRT, aFillColor.getRed(), aFillColor.getGreen(), aFillColor.getBlue()); - - for (const auto& rPolygon : rPolyPolygon) - addB2DPolygonToPathGeometry(mpRT, rPolygon, &getViewInformation2D()); - - cairo_fill(mpRT); - - cairo_restore(mpRT); -} - void CairoPixelProcessor2D::processBitmapPrimitive2D( const primitive2d::BitmapPrimitive2D& rBitmapCandidate) { @@ -351,11 +829,13 @@ void CairoPixelProcessor2D::processBitmapPrimitive2D( if (aBitmapEx.IsEmpty() || aBitmapEx.GetSizePixel().IsEmpty()) { + // no pixel data, done return; } if (maBColorModifierStack.count()) { + // need to apply ColorModifier to Bitmap data aBitmapEx = aBitmapEx.ModifyBitmapEx(maBColorModifierStack); if (aBitmapEx.IsEmpty()) @@ -372,183 +852,103 @@ void CairoPixelProcessor2D::processBitmapPrimitive2D( rtl::Reference xTemp( new primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aModifiedColor)); + + // draw as Polygon, done processPolyPolygonColorPrimitive2D(*xTemp); return; } } - // nasty copy of bitmap data - std::vector aPixelData(createBitmapData(aBitmapEx)); - const Size& rSizePixel(aBitmapEx.GetSizePixel()); - cairo_surface_t* pBitmapSurface = cairo_image_surface_create_for_data( - aPixelData.data(), CAIRO_FORMAT_ARGB32, rSizePixel.Width(), rSizePixel.Height(), - cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, rSizePixel.Width())); + // access or create cairo bitmap data + std::shared_ptr aCairoSurfaceHelper( + getOrCreateCairoSurfaceHelper(aBitmapEx)); + if (!aCairoSurfaceHelper) + { + SAL_WARN("drawinglayer", "SDPRCairo: No SurfaceHelper from BitmapEx (!)"); + return; + } + + // work with dimensions in discrete target pixels to use evtl. MipMap pre-scale + const tools::Long nDestWidth((aLocalTransform * basegfx::B2DVector(1.0, 0.0)).getLength()); + const tools::Long nDestHeight((aLocalTransform * basegfx::B2DVector(0.0, 1.0)).getLength()); + + cairo_surface_t* pTarget(aCairoSurfaceHelper->getCairoSurface(nDestWidth, nDestHeight)); + if (nullptr == pTarget) + { + SAL_WARN("drawinglayer", "SDPRCairo: No CairoSurface from BitmapEx SurfaceHelper (!)"); + return; + } cairo_save(mpRT); + // set linear transformation - no fAAOffset for bitmap data cairo_matrix_t aMatrix; - const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 0.5 : 0.0); cairo_matrix_init(&aMatrix, aLocalTransform.a(), aLocalTransform.b(), aLocalTransform.c(), - aLocalTransform.d(), aLocalTransform.e() + fAAOffset, - aLocalTransform.f() + fAAOffset); - - // set linear transformation + aLocalTransform.d(), aLocalTransform.e(), aLocalTransform.f()); cairo_set_matrix(mpRT, &aMatrix); - // destinationRectangle is part of transformation above, so use UnitRange - cairo_rectangle(mpRT, 0, 0, 1, 1); - cairo_clip(mpRT); + static bool bRenderTransformationBounds(false); + if (bRenderTransformationBounds) + { + cairo_set_source_rgba(mpRT, 1, 0, 0, 0.8); + impl_cairo_set_hairline(mpRT, getViewInformation2D()); + cairo_rectangle(mpRT, 0, 0, 1, 1); + cairo_stroke(mpRT); + } - cairo_set_source_surface(mpRT, pBitmapSurface, 0, 0); - // get the pattern created by cairo_set_source_surface + const sal_uInt32 nWidth(cairo_image_surface_get_width(pTarget)); + const sal_uInt32 nHeight(cairo_image_surface_get_height(pTarget)); + + cairo_set_source_surface(mpRT, pTarget, 0, 0); + + // get the pattern created by cairo_set_source_surface and + // it's transformation cairo_pattern_t* sourcepattern = cairo_get_source(mpRT); cairo_pattern_get_matrix(sourcepattern, &aMatrix); - // scale to match the current transformation - cairo_matrix_scale(&aMatrix, rSizePixel.Width(), rSizePixel.Height()); - cairo_pattern_set_matrix(sourcepattern, &aMatrix); - cairo_paint(mpRT); - - cairo_surface_destroy(pBitmapSurface); - - cairo_restore(mpRT); -} - -namespace -{ -// This bit-tweaking looping is unpleasant and unfortunate -void LuminanceToAlpha(cairo_surface_t* pMask) -{ - cairo_surface_flush(pMask); - - int nWidth = cairo_image_surface_get_width(pMask); - int nHeight = cairo_image_surface_get_height(pMask); - int nStride = cairo_image_surface_get_stride(pMask); - unsigned char* mask_surface_data = cairo_image_surface_get_data(pMask); - - // include/basegfx/color/bcolormodifier.hxx - const double nRedMul = 0.2125 / 255.0; - const double nGreenMul = 0.7154 / 255.0; - const double nBlueMul = 0.0721 / 255.0; - for (int y = 0; y < nHeight; ++y) + // RGBA sources overlap the unit geometry range, slightly, + // to see that activate bRenderTransformationBounds and + // insert a ARGB image, zoom to the borders. Seems to be half + // a pixel. Very good to demonstrate: 8x1 pixel, some + // transparent. + // This effect is also visible in the left/right/bottom/top + // page shadows, these DO use 8x1/1x8 images which led me to + // that problem. I see two solutions: + static bool bRenderMasked(true); + if (bRenderMasked) { - unsigned char* pMaskPixelData = mask_surface_data + (nStride * y); - for (int x = 0; x < nWidth; ++x) + // Consequence is that these need clipping. That again is + // simple (we are in unit coordinates). Only do for RGBA, + // for RGB this effect does not happen + if (CAIRO_FORMAT_ARGB32 == cairo_image_surface_get_format(pTarget)) { - double fLuminance = pMaskPixelData[SVP_CAIRO_RED] * nRedMul - + pMaskPixelData[SVP_CAIRO_GREEN] * nGreenMul - + pMaskPixelData[SVP_CAIRO_BLUE] * nBlueMul; - // Only this alpha channel is taken into account by cairo_mask_surface - // so reuse this surface for the alpha result - pMaskPixelData[SVP_CAIRO_ALPHA] = 255.0 * fLuminance; - pMaskPixelData += 4; + cairo_rectangle(mpRT, 0, 0, 1, 1); + cairo_clip(mpRT); + } + + cairo_matrix_scale(&aMatrix, nWidth, nHeight); + } + else + { + // Alternative: for RGBA, resize/scale SLIGHTLY so that + // half pixel overlap is forced to be inside the unit range. + // That makes the error disappear, so no clip needed, but + // SLIGHTLY smaller. + if (CAIRO_FORMAT_ARGB32 == cairo_image_surface_get_format(pTarget)) + { + cairo_matrix_init_scale(&aMatrix, nWidth + 1, nHeight + 1); + cairo_matrix_translate(&aMatrix, -0.5 / (nWidth + 1), -0.5 / (nHeight + 1)); + } + else + { + cairo_matrix_scale(&aMatrix, nWidth, nHeight); } } - cairo_surface_mark_dirty(pMask); -} -} + cairo_pattern_set_matrix(sourcepattern, &aMatrix); -void CairoPixelProcessor2D::processTransparencePrimitive2D( - const primitive2d::TransparencePrimitive2D& rTransCandidate) -{ - if (rTransCandidate.getChildren().empty()) - return; - - if (rTransCandidate.getTransparence().empty()) - return; - - cairo_surface_t* pTarget = cairo_get_target(mpRT); - - double clip_x1, clip_x2, clip_y1, clip_y2; - cairo_clip_extents(mpRT, &clip_x1, &clip_y1, &clip_x2, &clip_y2); - - // calculate visible range, create only for that range - basegfx::B2DRange aDiscreteRange( - rTransCandidate.getChildren().getB2DRange(getViewInformation2D())); - aDiscreteRange.transform(getViewInformation2D().getObjectToViewTransformation()); - const basegfx::B2DRange aViewRange(basegfx::B2DPoint(clip_x1, clip_y1), - basegfx::B2DPoint(clip_x2, clip_y2)); - basegfx::B2DRange aVisibleRange(aDiscreteRange); - aVisibleRange.intersect(aViewRange); - - if (aVisibleRange.isEmpty()) - { - // not visible, done - return; - } - - const basegfx::B2DHomMatrix aEmbedTransform(basegfx::utils::createTranslateB2DHomMatrix( - -aVisibleRange.getMinX(), -aVisibleRange.getMinY())); - geometry::ViewInformation2D aViewInformation2D(getViewInformation2D()); - aViewInformation2D.setViewTransformation(aEmbedTransform - * getViewInformation2D().getViewTransformation()); - // draw mask to temporary surface - cairo_surface_t* pMask = cairo_surface_create_similar_image(pTarget, CAIRO_FORMAT_ARGB32, - ceil(aVisibleRange.getWidth()), - ceil(aVisibleRange.getHeight())); - CairoPixelProcessor2D aMaskRenderer(aViewInformation2D, pMask); - aMaskRenderer.process(rTransCandidate.getTransparence()); - - // convert mask to something cairo can use - LuminanceToAlpha(pMask); - - // draw content to temporary surface - cairo_surface_t* pContent = cairo_surface_create_similar( - pTarget, cairo_surface_get_content(pTarget), ceil(aVisibleRange.getWidth()), - ceil(aVisibleRange.getHeight())); - CairoPixelProcessor2D aContent(aViewInformation2D, pContent); - aContent.process(rTransCandidate.getChildren()); - - // munge the temporary surfaces to our target surface - cairo_set_source_surface(mpRT, pContent, aVisibleRange.getMinX(), aVisibleRange.getMinY()); - cairo_mask_surface(mpRT, pMask, aVisibleRange.getMinX(), aVisibleRange.getMinY()); - - cairo_surface_destroy(pContent); - cairo_surface_destroy(pMask); -} - -void CairoPixelProcessor2D::processMaskPrimitive2DPixel( - const primitive2d::MaskPrimitive2D& rMaskCandidate) -{ - if (rMaskCandidate.getChildren().empty()) - return; - - basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask()); - - if (!aMask.count()) - return; - - double clip_x1, clip_x2, clip_y1, clip_y2; - cairo_clip_extents(mpRT, &clip_x1, &clip_y1, &clip_x2, &clip_y2); - - basegfx::B2DRange aMaskRange(aMask.getB2DRange()); - aMaskRange.transform(getViewInformation2D().getObjectToViewTransformation()); - const basegfx::B2DRange aViewRange(basegfx::B2DPoint(clip_x1, clip_y1), - basegfx::B2DPoint(clip_x2, clip_y2)); - - if (!aViewRange.overlaps(aMaskRange)) - return; - - cairo_save(mpRT); - - cairo_matrix_t aMatrix; - const basegfx::B2DHomMatrix& rObjectToView( - getViewInformation2D().getObjectToViewTransformation()); - cairo_matrix_init(&aMatrix, rObjectToView.a(), rObjectToView.b(), rObjectToView.c(), - rObjectToView.d(), rObjectToView.e(), rObjectToView.f()); - - // set linear transformation - cairo_set_matrix(mpRT, &aMatrix); - - // put mask as path - for (const auto& rPolygon : aMask) - addB2DPolygonToPathGeometry(mpRT, rPolygon, &getViewInformation2D()); - - // clip to this mask - cairo_clip(mpRT); - - process(rMaskCandidate.getChildren()); + // paint bitmap data + cairo_paint(mpRT); cairo_restore(mpRT); } @@ -557,9 +957,16 @@ void CairoPixelProcessor2D::processPointArrayPrimitive2D( const primitive2d::PointArrayPrimitive2D& rPointArrayCandidate) { const std::vector& rPositions(rPointArrayCandidate.getPositions()); - if (rPositions.empty()) - return; + if (rPositions.empty()) + { + // no geometry, done + return; + } + + cairo_save(mpRT); + + // determine & set color const basegfx::BColor aPointColor( maBColorModifierStack.getModifiedColor(rPointArrayCandidate.getRGBColor())); cairo_set_source_rgb(mpRT, aPointColor.getRed(), aPointColor.getGreen(), aPointColor.getBlue()); @@ -581,11 +988,217 @@ void CairoPixelProcessor2D::processPointArrayPrimitive2D( } cairo_set_antialias(mpRT, eOldAAMode); + cairo_restore(mpRT); +} + +void CairoPixelProcessor2D::processPolygonHairlinePrimitive2D( + const primitive2d::PolygonHairlinePrimitive2D& rPolygonHairlinePrimitive2D) +{ + const basegfx::B2DPolygon& rPolygon(rPolygonHairlinePrimitive2D.getB2DPolygon()); + + if (!rPolygon.count()) + { + // no geometry, done + return; + } + + cairo_save(mpRT); + + // set linear transformation + cairo_matrix_t aMatrix; + const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 0.5 : 0.0); + const basegfx::B2DHomMatrix& rObjectToView( + getViewInformation2D().getObjectToViewTransformation()); + cairo_matrix_init(&aMatrix, rObjectToView.a(), rObjectToView.b(), rObjectToView.c(), + rObjectToView.d(), rObjectToView.e() + fAAOffset, + rObjectToView.f() + fAAOffset); + cairo_set_matrix(mpRT, &aMatrix); + + // determine & set color + const basegfx::BColor aHairlineColor( + maBColorModifierStack.getModifiedColor(rPolygonHairlinePrimitive2D.getBColor())); + cairo_set_source_rgb(mpRT, aHairlineColor.getRed(), aHairlineColor.getGreen(), + aHairlineColor.getBlue()); + + // set LineWidth, use cairo special cairo_set_hairline + impl_cairo_set_hairline(mpRT, getViewInformation2D()); + + // get PathGeometry & paint it + cairo_new_path(mpRT); + getOrCreatePathGeometry(mpRT, rPolygon, getViewInformation2D()); + cairo_stroke(mpRT); + + cairo_restore(mpRT); +} + +void CairoPixelProcessor2D::processPolyPolygonColorPrimitive2D( + const primitive2d::PolyPolygonColorPrimitive2D& rPolyPolygonColorPrimitive2D) +{ + const basegfx::B2DPolyPolygon& rPolyPolygon(rPolyPolygonColorPrimitive2D.getB2DPolyPolygon()); + const sal_uInt32 nCount(rPolyPolygon.count()); + + if (!nCount) + { + // no geometry, done + return; + } + + cairo_save(mpRT); + + // set linear transformation + cairo_matrix_t aMatrix; + const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 0.5 : 0.0); + const basegfx::B2DHomMatrix& rObjectToView( + getViewInformation2D().getObjectToViewTransformation()); + cairo_matrix_init(&aMatrix, rObjectToView.a(), rObjectToView.b(), rObjectToView.c(), + rObjectToView.d(), rObjectToView.e() + fAAOffset, + rObjectToView.f() + fAAOffset); + cairo_set_matrix(mpRT, &aMatrix); + + // determine & set color + const basegfx::BColor aFillColor( + maBColorModifierStack.getModifiedColor(rPolyPolygonColorPrimitive2D.getBColor())); + cairo_set_source_rgb(mpRT, aFillColor.getRed(), aFillColor.getGreen(), aFillColor.getBlue()); + + // get PathGeometry & paint it + cairo_new_path(mpRT); + getOrCreateFillGeometry(mpRT, rPolyPolygon); + cairo_fill(mpRT); + + cairo_restore(mpRT); +} + +void CairoPixelProcessor2D::processTransparencePrimitive2D( + const primitive2d::TransparencePrimitive2D& rTransCandidate) +{ + if (rTransCandidate.getChildren().empty()) + { + // no content, done + return; + } + + if (rTransCandidate.getTransparence().empty()) + { + // no mask (so nothing visible), done + return; + } + + // calculate visible range, create only for that range + basegfx::B2DRange aDiscreteRange( + rTransCandidate.getChildren().getB2DRange(getViewInformation2D())); + aDiscreteRange.transform(getViewInformation2D().getObjectToViewTransformation()); + basegfx::B2DRange aVisibleRange(aDiscreteRange); + double clip_x1, clip_x2, clip_y1, clip_y2; + cairo_clip_extents(mpRT, &clip_x1, &clip_y1, &clip_x2, &clip_y2); + const basegfx::B2DRange aViewRange(basegfx::B2DPoint(clip_x1, clip_y1), + basegfx::B2DPoint(clip_x2, clip_y2)); + aVisibleRange.intersect(aViewRange); + + if (aVisibleRange.isEmpty()) + { + // not visible, done + return; + } + + cairo_save(mpRT); + + // create embedding transformation for sub-surface + const basegfx::B2DHomMatrix aEmbedTransform(basegfx::utils::createTranslateB2DHomMatrix( + -aVisibleRange.getMinX(), -aVisibleRange.getMinY())); + geometry::ViewInformation2D aViewInformation2D(getViewInformation2D()); + aViewInformation2D.setViewTransformation(aEmbedTransform + * getViewInformation2D().getViewTransformation()); + + // draw mask to temporary surface + cairo_surface_t* pTarget = cairo_get_target(mpRT); + const double fContainedWidth(ceil(aVisibleRange.getWidth())); + const double fContainedHeight(ceil(aVisibleRange.getHeight())); + cairo_surface_t* pMask = cairo_surface_create_similar_image(pTarget, CAIRO_FORMAT_ARGB32, + fContainedWidth, fContainedHeight); + CairoPixelProcessor2D aMaskRenderer(aViewInformation2D, pMask); + aMaskRenderer.process(rTransCandidate.getTransparence()); + + // convert mask to something cairo can use + LuminanceToAlpha(pMask); + + // draw content to temporary surface + cairo_surface_t* pContent = cairo_surface_create_similar( + pTarget, cairo_surface_get_content(pTarget), fContainedWidth, fContainedHeight); + CairoPixelProcessor2D aContent(aViewInformation2D, pContent); + aContent.process(rTransCandidate.getChildren()); + + // munge the temporary surfaces to our target surface + cairo_set_source_surface(mpRT, pContent, aVisibleRange.getMinX(), aVisibleRange.getMinY()); + cairo_mask_surface(mpRT, pMask, aVisibleRange.getMinX(), aVisibleRange.getMinY()); + + // cleanup temporary surfaces + cairo_surface_destroy(pContent); + cairo_surface_destroy(pMask); + + cairo_restore(mpRT); +} + +void CairoPixelProcessor2D::processMaskPrimitive2DPixel( + const primitive2d::MaskPrimitive2D& rMaskCandidate) +{ + if (rMaskCandidate.getChildren().empty()) + { + // no content, done + return; + } + + basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask()); + + if (!aMask.count()) + { + // no mask (so nothing inside), done + return; + } + + // calculate visible range + double clip_x1, clip_x2, clip_y1, clip_y2; + cairo_clip_extents(mpRT, &clip_x1, &clip_y1, &clip_x2, &clip_y2); + basegfx::B2DRange aMaskRange(aMask.getB2DRange()); + aMaskRange.transform(getViewInformation2D().getObjectToViewTransformation()); + const basegfx::B2DRange aViewRange(basegfx::B2DPoint(clip_x1, clip_y1), + basegfx::B2DPoint(clip_x2, clip_y2)); + + if (!aViewRange.overlaps(aMaskRange)) + { + // not visible, done + return; + } + + cairo_save(mpRT); + + // set linear transformation + cairo_matrix_t aMatrix; + const basegfx::B2DHomMatrix& rObjectToView( + getViewInformation2D().getObjectToViewTransformation()); + const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 0.5 : 0.0); + cairo_matrix_init(&aMatrix, rObjectToView.a(), rObjectToView.b(), rObjectToView.c(), + rObjectToView.d(), rObjectToView.e() + fAAOffset, + rObjectToView.f() + fAAOffset); + cairo_set_matrix(mpRT, &aMatrix); + + // create path geometry and put mask as path + cairo_new_path(mpRT); + getOrCreateFillGeometry(mpRT, aMask); + + // clip to this mask (also reset path, cairo_clip does not consume it) + cairo_clip(mpRT); + cairo_new_path(mpRT); + + // process sub-content (that shall be masked) + process(rMaskCandidate.getChildren()); + + cairo_restore(mpRT); } void CairoPixelProcessor2D::processModifiedColorPrimitive2D( const primitive2d::ModifiedColorPrimitive2D& rModifiedCandidate) { + // standard implementation if (!rModifiedCandidate.getChildren().empty()) { maBColorModifierStack.push(rModifiedCandidate.getColorModifier()); @@ -597,6 +1210,7 @@ void CairoPixelProcessor2D::processModifiedColorPrimitive2D( void CairoPixelProcessor2D::processTransformPrimitive2D( const primitive2d::TransformPrimitive2D& rTransformCandidate) { + // standard implementation // remember current transformation and ViewInformation const geometry::ViewInformation2D aLastViewInformation2D(getViewInformation2D()); @@ -613,6 +1227,154 @@ void CairoPixelProcessor2D::processTransformPrimitive2D( updateViewInformation(aLastViewInformation2D); } +void CairoPixelProcessor2D::processUnifiedTransparencePrimitive2D( + const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate) +{ + if (rTransCandidate.getChildren().empty()) + { + // no content, done + return; + } + + if (0.0 == rTransCandidate.getTransparence()) + { + // not transparent at all, use content + process(rTransCandidate.getChildren()); + return; + } + + if (rTransCandidate.getTransparence() < 0.0 || rTransCandidate.getTransparence() > 1.0) + { + // invalid transparence, done + return; + } + + cairo_save(mpRT); + + // calculate visible range, create only for that range + basegfx::B2DRange aDiscreteRange( + rTransCandidate.getChildren().getB2DRange(getViewInformation2D())); + aDiscreteRange.transform(getViewInformation2D().getObjectToViewTransformation()); + basegfx::B2DRange aVisibleRange(aDiscreteRange); + double clip_x1, clip_x2, clip_y1, clip_y2; + cairo_clip_extents(mpRT, &clip_x1, &clip_y1, &clip_x2, &clip_y2); + const basegfx::B2DRange aViewRange(basegfx::B2DPoint(clip_x1, clip_y1), + basegfx::B2DPoint(clip_x2, clip_y2)); + aVisibleRange.intersect(aViewRange); + + if (aVisibleRange.isEmpty()) + { + // not visible, done + return; + } + + // create embedding transformation for sub-surface + const basegfx::B2DHomMatrix aEmbedTransform(basegfx::utils::createTranslateB2DHomMatrix( + -aVisibleRange.getMinX(), -aVisibleRange.getMinY())); + geometry::ViewInformation2D aViewInformation2D(getViewInformation2D()); + aViewInformation2D.setViewTransformation(aEmbedTransform + * getViewInformation2D().getViewTransformation()); + + // draw content to temporary surface + cairo_surface_t* pTarget = cairo_get_target(mpRT); + const double fContainedWidth(ceil(aVisibleRange.getWidth())); + const double fContainedHeight(ceil(aVisibleRange.getHeight())); + cairo_surface_t* pContent = cairo_surface_create_similar( + pTarget, cairo_surface_get_content(pTarget), fContainedWidth, fContainedHeight); + CairoPixelProcessor2D aContent(aViewInformation2D, pContent); + aContent.process(rTransCandidate.getChildren()); + + // paint temporary surface to target with fixed transparence + cairo_set_source_surface(mpRT, pContent, aVisibleRange.getMinX(), aVisibleRange.getMinY()); + cairo_paint_with_alpha(mpRT, 1.0 - rTransCandidate.getTransparence()); + + // cleanup temporary surface + cairo_surface_destroy(pContent); + + cairo_restore(mpRT); +} + +void CairoPixelProcessor2D::processMarkerArrayPrimitive2D( + const primitive2d::MarkerArrayPrimitive2D& rMarkerArrayCandidate) +{ + const std::vector& rPositions(rMarkerArrayCandidate.getPositions()); + + if (rPositions.empty()) + { + // no geometry, done + return; + } + + const BitmapEx& rMarker(rMarkerArrayCandidate.getMarker()); + + if (rMarker.IsEmpty()) + { + // no marker defined, done + return; + } + + // access or create cairo bitmap data + const BitmapEx& rBitmapEx(rMarkerArrayCandidate.getMarker()); + std::shared_ptr aCairoSurfaceHelper( + getOrCreateCairoSurfaceHelper(rBitmapEx)); + if (!aCairoSurfaceHelper) + { + SAL_WARN("drawinglayer", "SDPRCairo: No SurfaceHelper from BitmapEx (!)"); + return; + } + + // do not use dimensions, these are usually small instances + cairo_surface_t* pTarget(aCairoSurfaceHelper->getCairoSurface()); + if (nullptr == pTarget) + { + SAL_WARN("drawinglayer", "SDPRCairo: No CairoSurface from BitmapEx SurfaceHelper (!)"); + return; + } + + const sal_uInt32 nWidth(cairo_image_surface_get_width(pTarget)); + const sal_uInt32 nHeight(cairo_image_surface_get_height(pTarget)); + const tools::Long nMiX((nWidth / 2) + 1); + const tools::Long nMiY((nHeight / 2) + 1); + + cairo_save(mpRT); + cairo_identity_matrix(mpRT); + const cairo_antialias_t eOldAAMode(cairo_get_antialias(mpRT)); + cairo_set_antialias(mpRT, CAIRO_ANTIALIAS_NONE); + + for (auto const& pos : rPositions) + { + const basegfx::B2DPoint aDiscretePos(getViewInformation2D().getObjectToViewTransformation() + * pos); + const double fX(ceil(aDiscretePos.getX())); + const double fY(ceil(aDiscretePos.getY())); + + cairo_set_source_surface(mpRT, pTarget, fX - nMiX, fY - nMiY); + cairo_paint(mpRT); + } + + cairo_set_antialias(mpRT, eOldAAMode); + cairo_restore(mpRT); +} + +void CairoPixelProcessor2D::processBackgroundColorPrimitive2D( + const primitive2d::BackgroundColorPrimitive2D& rBackgroundColorCandidate) +{ + // check for allowed range [0.0 .. 1.0[ + if (rBackgroundColorCandidate.getTransparency() < 0.0 + || rBackgroundColorCandidate.getTransparency() >= 1.0) + return; + + cairo_save(mpRT); + const basegfx::BColor aFillColor( + maBColorModifierStack.getModifiedColor(rBackgroundColorCandidate.getBColor())); + cairo_set_source_rgba(mpRT, aFillColor.getRed(), aFillColor.getGreen(), aFillColor.getBlue(), + 1.0 - rBackgroundColorCandidate.getTransparency()); + // to also copy alpha part of color, see cairo docu. Will be reset by restore below + cairo_set_operator(mpRT, CAIRO_OPERATOR_SOURCE); + cairo_paint(mpRT); + cairo_restore(mpRT); +} + void CairoPixelProcessor2D::processPolygonStrokePrimitive2D( const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate) { @@ -670,13 +1432,12 @@ void CairoPixelProcessor2D::processPolygonStrokePrimitive2D( cairo_save(mpRT); + // set linear transformation cairo_matrix_t aMatrix; const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 0.5 : 0.0); cairo_matrix_init(&aMatrix, rObjectToView.a(), rObjectToView.b(), rObjectToView.c(), rObjectToView.d(), rObjectToView.e() + fAAOffset, rObjectToView.f() + fAAOffset); - - // set linear transformation cairo_set_matrix(mpRT, &aMatrix); // setup line attributes @@ -694,14 +1455,15 @@ void CairoPixelProcessor2D::processPolygonStrokePrimitive2D( eCairoLineJoin = CAIRO_LINE_JOIN_MITER; break; } + cairo_set_line_join(mpRT, eCairoLineJoin); // convert miter minimum angle to miter limit double fMiterLimit = 1.0 / sin(std::max(rLineAttribute.getMiterMinimumAngle(), 0.01 * M_PI) / 2.0); + cairo_set_miter_limit(mpRT, fMiterLimit); // setup cap attribute cairo_line_cap_t eCairoLineCap(CAIRO_LINE_CAP_BUTT); - switch (rLineAttribute.getLineCap()) { default: // css::drawing::LineCap_BUTT: @@ -720,20 +1482,23 @@ void CairoPixelProcessor2D::processPolygonStrokePrimitive2D( break; } } + cairo_set_line_cap(mpRT, eCairoLineCap); + // determine & set color basegfx::BColor aLineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor())); if (bRenderDecomposeForCompareInRed) aLineColor.setRed(0.5); - cairo_set_source_rgb(mpRT, aLineColor.getRed(), aLineColor.getGreen(), aLineColor.getBlue()); - cairo_set_line_join(mpRT, eCairoLineJoin); - cairo_set_line_cap(mpRT, eCairoLineCap); - - // TODO: Hairline LineWidth, see comment at processPolygonHairlinePrimitive2D - cairo_set_line_width(mpRT, bHairline ? 1.44 : fDiscreteLineWidth); - cairo_set_miter_limit(mpRT, fMiterLimit); + // process/set LineWidth + const double fObjectLineWidth( + bHairline ? (getViewInformation2D().getInverseObjectToViewTransformation() + * basegfx::B2DVector(1.0, 0.0)) + .getLength() + : rLineAttribute.getWidth()); + cairo_set_line_width(mpRT, fObjectLineWidth); + // check stroke const attribute::StrokeAttribute& rStrokeAttribute( rPolygonStrokeCandidate.getStrokeAttribute()); const bool bDashUsed(!rStrokeAttribute.isDefault() @@ -745,8 +1510,11 @@ void CairoPixelProcessor2D::processPolygonStrokePrimitive2D( cairo_set_dash(mpRT, rStroke.data(), rStroke.size(), 0.0); } - addB2DPolygonToPathGeometry(mpRT, rPolygon, &getViewInformation2D()); + // create path geometry and put mask as path + cairo_new_path(mpRT); + getOrCreatePathGeometry(mpRT, rPolygon, getViewInformation2D()); + // render cairo_stroke(mpRT); cairo_restore(mpRT); @@ -780,7 +1548,7 @@ void CairoPixelProcessor2D::processLineRectanglePrimitive2D( aHairlineColor.getBlue()); const double fDiscreteLineWidth((getViewInformation2D().getInverseObjectToViewTransformation() - * basegfx::B2DVector(1.44, 0.0)) + * basegfx::B2DVector(1.0, 0.0)) .getLength()); cairo_set_line_width(mpRT, fDiscreteLineWidth); @@ -841,7 +1609,7 @@ void CairoPixelProcessor2D::processSingleLinePrimitive2D( const basegfx::B2DPoint aStart(rObjectToView * rSingleLinePrimitive2D.getStart()); const basegfx::B2DPoint aEnd(rObjectToView * rSingleLinePrimitive2D.getEnd()); - cairo_set_line_width(mpRT, 1.44f); + cairo_set_line_width(mpRT, 1.0f); cairo_move_to(mpRT, aStart.getX() + fAAOffset, aStart.getY() + fAAOffset); cairo_line_to(mpRT, aEnd.getX() + fAAOffset, aEnd.getY() + fAAOffset); @@ -850,6 +1618,801 @@ void CairoPixelProcessor2D::processSingleLinePrimitive2D( cairo_restore(mpRT); } +void CairoPixelProcessor2D::processFillGraphicPrimitive2D( + const primitive2d::FillGraphicPrimitive2D& rFillGraphicPrimitive2D) +{ + BitmapEx aPreparedBitmap; + basegfx::B2DRange aFillUnitRange(rFillGraphicPrimitive2D.getFillGraphic().getGraphicRange()); + constexpr double fBigDiscreteArea(300.0 * 300.0); + + // use tooling to do various checks and prepare tiled rendering, see + // description of method, parameters and return value there + if (!prepareBitmapForDirectRender(rFillGraphicPrimitive2D, getViewInformation2D(), + aPreparedBitmap, aFillUnitRange, fBigDiscreteArea)) + { + // no output needed, done + return; + } + + if (aPreparedBitmap.IsEmpty()) + { + // output needed and Bitmap data empty, so no bitmap data based + // tiled rendering is suggested. Use fallback for paint (decomposition) + process(rFillGraphicPrimitive2D); + return; + } + + // render tiled using the prepared Bitmap data + if (maBColorModifierStack.count()) + { + // need to apply ColorModifier to Bitmap data + aPreparedBitmap = aPreparedBitmap.ModifyBitmapEx(maBColorModifierStack); + + if (aPreparedBitmap.IsEmpty()) + { + // color gets completely replaced, get it (any input works) + const basegfx::BColor aModifiedColor( + maBColorModifierStack.getModifiedColor(basegfx::BColor())); + + // use unit geometry as fallback object geometry. Do *not* + // transform, the below used method will use the already + // correctly initialized local ViewInformation + basegfx::B2DPolygon aPolygon(basegfx::utils::createUnitPolygon()); + + // what we still need to apply is the object transform from the + // local primitive, that is not part of DisplayInfo yet + aPolygon.transform(rFillGraphicPrimitive2D.getTransformation()); + + rtl::Reference aTemp( + new primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), + aModifiedColor)); + + // draw as colored Polygon, done + processPolyPolygonColorPrimitive2D(*aTemp); + return; + } + } + + // access or create cairo bitmap data + std::shared_ptr aCairoSurfaceHelper( + getOrCreateCairoSurfaceHelper(aPreparedBitmap)); + if (!aCairoSurfaceHelper) + { + SAL_WARN("drawinglayer", "SDPRCairo: No SurfaceHelper from BitmapEx (!)"); + return; + } + + // work with dimensions in discrete target pixels to use evtl. MipMap pre-scale + const basegfx::B2DHomMatrix aLocalTransform( + getViewInformation2D().getObjectToViewTransformation() + * rFillGraphicPrimitive2D.getTransformation()); + const tools::Long nDestWidth( + (aLocalTransform * basegfx::B2DVector(aFillUnitRange.getWidth(), 0.0)).getLength()); + const tools::Long nDestHeight( + (aLocalTransform * basegfx::B2DVector(0.0, aFillUnitRange.getHeight())).getLength()); + + cairo_surface_t* pTarget(aCairoSurfaceHelper->getCairoSurface(nDestWidth, nDestHeight)); + if (nullptr == pTarget) + { + SAL_WARN("drawinglayer", "SDPRCairo: No CairoSurface from BitmapEx SurfaceHelper (!)"); + return; + } + + cairo_save(mpRT); + + // set linear transformation - no fAAOffset for bitmap data + cairo_matrix_t aMatrix; + cairo_matrix_init(&aMatrix, aLocalTransform.a(), aLocalTransform.b(), aLocalTransform.c(), + aLocalTransform.d(), aLocalTransform.e(), aLocalTransform.f()); + cairo_set_matrix(mpRT, &aMatrix); + + const sal_uInt32 nWidth(cairo_image_surface_get_width(pTarget)); + const sal_uInt32 nHeight(cairo_image_surface_get_height(pTarget)); + + cairo_set_source_surface(mpRT, pTarget, 0, 0); + + // get the pattern created by cairo_set_source_surface and + // it's transformation + cairo_pattern_t* sourcepattern = cairo_get_source(mpRT); + cairo_pattern_get_matrix(sourcepattern, &aMatrix); + + // clip for RGBA (see other places) + if (CAIRO_FORMAT_ARGB32 == cairo_image_surface_get_format(pTarget)) + { + cairo_rectangle(mpRT, 0, 0, 1, 1); + cairo_clip(mpRT); + } + + // create transformation for source pattern (inverse, see + // cairo docu: uses user space to pattern space transformation) + cairo_matrix_init_scale(&aMatrix, nWidth / aFillUnitRange.getWidth(), + nHeight / aFillUnitRange.getHeight()); + cairo_matrix_translate(&aMatrix, -aFillUnitRange.getMinX(), -aFillUnitRange.getMinY()); + + // set source pattern transform & activate pattern repeat + cairo_pattern_set_matrix(sourcepattern, &aMatrix); + cairo_pattern_set_extend(sourcepattern, CAIRO_EXTEND_REPEAT); + + // paint + cairo_paint(mpRT); + + static bool bRenderTransformationBounds(false); + if (bRenderTransformationBounds) + { + cairo_set_source_rgba(mpRT, 0, 1, 0, 0.8); + impl_cairo_set_hairline(mpRT, getViewInformation2D()); + // full object + cairo_rectangle(mpRT, 0, 0, 1, 1); + // outline of pattern root image + cairo_rectangle(mpRT, aFillUnitRange.getMinX(), aFillUnitRange.getMinY(), + aFillUnitRange.getWidth(), aFillUnitRange.getHeight()); + cairo_stroke(mpRT); + } + + cairo_restore(mpRT); +} + +void CairoPixelProcessor2D::processFillGradientPrimitive2D_drawOutputRange( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D) +{ + cairo_save(mpRT); + + // fill simple rect with outer color + const basegfx::BColor aColor( + maBColorModifierStack.getModifiedColor(rFillGradientPrimitive2D.getOuterColor())); + cairo_set_source_rgb(mpRT, aColor.getRed(), aColor.getGreen(), aColor.getBlue()); + + const basegfx::B2DHomMatrix aTrans(getViewInformation2D().getObjectToViewTransformation()); + cairo_matrix_t aMatrix; + cairo_matrix_init(&aMatrix, aTrans.a(), aTrans.b(), aTrans.c(), aTrans.d(), aTrans.e(), + aTrans.f()); + cairo_set_matrix(mpRT, &aMatrix); + + const basegfx::B2DRange& rRange(rFillGradientPrimitive2D.getOutputRange()); + cairo_rectangle(mpRT, rRange.getMinX(), rRange.getMinY(), rRange.getWidth(), + rRange.getHeight()); + cairo_fill(mpRT); + + cairo_restore(mpRT); +} + +bool CairoPixelProcessor2D::processFillGradientPrimitive2D_isCompletelyBordered( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D) +{ + const attribute::FillGradientAttribute& rFillGradient( + rFillGradientPrimitive2D.getFillGradient()); + const double fBorder(rFillGradient.getBorder()); + + // check if completely 'bordered out'. This can be the case for all + // types of gradients + if (basegfx::fTools::less(fBorder, 1.0) && basegfx::fTools::moreOrEqual(fBorder, 0.0)) + { + // no, we have visible content besides border + return false; + } + + // draw all-covering polygon using getOuterColor and getOutputRange + processFillGradientPrimitive2D_drawOutputRange(rFillGradientPrimitive2D); + return true; +} + +void CairoPixelProcessor2D::processFillGradientPrimitive2D_linear_axial( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D) +{ + assert( + (css::awt::GradientStyle_LINEAR == rFillGradientPrimitive2D.getFillGradient().getStyle() + || css::awt::GradientStyle_AXIAL == rFillGradientPrimitive2D.getFillGradient().getStyle()) + && "SDPRCairo: Helper allows only SPECIFIED types (!)"); + cairo_save(mpRT); + + // need to do 'antique' stuff adaptions for rotate/transitionStart in object coordinates + // (DefinitionRange) to have the right 'bending' on rotation + const attribute::FillGradientAttribute& rFillGradient( + rFillGradientPrimitive2D.getFillGradient()); + basegfx::B2DRange aAdaptedRange(rFillGradientPrimitive2D.getDefinitionRange()); + const double fAngle(basegfx::normalizeToRange((2 * M_PI) - rFillGradient.getAngle(), 2 * M_PI)); + const bool bAngle(!basegfx::fTools::equalZero(fAngle)); + const basegfx::B2DPoint aCenter(aAdaptedRange.getCenter()); + + // pack rotation and offset into a transformation that coverts that part + basegfx::B2DHomMatrix aRotation(basegfx::utils::createRotateAroundPoint(aCenter, fAngle)); + + // create local transform to work in object coordinates based on OutputRange, + // combine with rotation - that way we can then just draw into AdaptedRange + basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectToViewTransformation() + * aRotation); + cairo_matrix_t aMatrix; + cairo_matrix_init(&aMatrix, aLocalTransform.a(), aLocalTransform.b(), aLocalTransform.c(), + aLocalTransform.d(), aLocalTransform.e(), aLocalTransform.f()); + cairo_set_matrix(mpRT, &aMatrix); + + if (bAngle) + { + // expand Range by rotating + aAdaptedRange.transform(aRotation); + } + + // create linear pattern in unit coordinates in y-direction + cairo_pattern_t* pPattern( + cairo_pattern_create_linear(aAdaptedRange.getCenterX(), aAdaptedRange.getMinY(), + aAdaptedRange.getCenterX(), aAdaptedRange.getMaxY())); + + // get color stops (make copy, might have to be changed) + basegfx::BColorStops aBColorStops(rFillGradient.getColorStops()); + const bool bAxial(css::awt::GradientStyle_AXIAL == rFillGradient.getStyle()); + + // get and apply border - create soace at start in gradient + const double fBorder(std::max(std::min(rFillGradient.getBorder(), 1.0), 0.0)); + if (!basegfx::fTools::equalZero(fBorder)) + { + if (bAxial) + aBColorStops.reverseColorStops(); + aBColorStops.createSpaceAtStart(fBorder); + if (bAxial) + aBColorStops.reverseColorStops(); + } + + if (bAxial) + { + // expand with mirrored ColorStops to create axial + aBColorStops.doApplyAxial(); + } + + // Apply steps if used to 'emulate' LO's 'discrete step' feature + if (rFillGradient.getSteps()) + { + aBColorStops.doApplySteps(rFillGradient.getSteps()); + } + + // add color stops + for (const auto& aStop : aBColorStops) + { + const basegfx::BColor aColor(maBColorModifierStack.getModifiedColor(aStop.getStopColor())); + cairo_pattern_add_color_stop_rgb(pPattern, aStop.getStopOffset(), aColor.getRed(), + aColor.getGreen(), aColor.getBlue()); + } + + // draw OutRange + basegfx::B2DRange aOutRange(rFillGradientPrimitive2D.getOutputRange()); + if (bAngle) + { + // expand backwards to cover all area needed for OutputRange + aRotation.invert(); + aOutRange.transform(aRotation); + } + cairo_rectangle(mpRT, aOutRange.getMinX(), aOutRange.getMinY(), aOutRange.getWidth(), + aOutRange.getHeight()); + cairo_set_source(mpRT, pPattern); + cairo_fill(mpRT); + + // cleanup + cairo_pattern_destroy(pPattern); + cairo_restore(mpRT); +} + +void CairoPixelProcessor2D::processFillGradientPrimitive2D_square_rect( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D) +{ + assert( + (css::awt::GradientStyle_SQUARE == rFillGradientPrimitive2D.getFillGradient().getStyle() + || css::awt::GradientStyle_RECT == rFillGradientPrimitive2D.getFillGradient().getStyle()) + && "SDPRCairo: Helper allows only SPECIFIED types (!)"); + cairo_save(mpRT); + + // draw all-covering polygon using getOuterColor and getOutputRange, + // the partial paints below will not fill areas outside automatically + // as happens in the other gradient paints + processFillGradientPrimitive2D_drawOutputRange(rFillGradientPrimitive2D); + + // get DefinitionRange and adapt if needed + basegfx::B2DRange aAdaptedRange(rFillGradientPrimitive2D.getDefinitionRange()); + const bool bSquare(css::awt::GradientStyle_SQUARE + == rFillGradientPrimitive2D.getFillGradient().getStyle()); + const basegfx::B2DPoint aCenter(aAdaptedRange.getCenter()); + bool bLandscape(false); + double fSmallRadius(1.0); + + // get rotation and offset values + const attribute::FillGradientAttribute& rFillGradient( + rFillGradientPrimitive2D.getFillGradient()); + const double fAngle(basegfx::normalizeToRange((2 * M_PI) - rFillGradient.getAngle(), 2 * M_PI)); + const bool bAngle(!basegfx::fTools::equalZero(fAngle)); + const double fOffxsetX(std::max(std::min(rFillGradient.getOffsetX(), 1.0), 0.0)); + const double fOffxsetY(std::max(std::min(rFillGradient.getOffsetY(), 1.0), 0.0)); + + if (bSquare) + { + // expand to make width == height + const basegfx::B2DRange& rDefRange(rFillGradientPrimitive2D.getDefinitionRange()); + + if (rDefRange.getWidth() > rDefRange.getHeight()) + { + // landscape -> square + const double fRadius(0.5 * rDefRange.getWidth()); + aAdaptedRange.expand(basegfx::B2DPoint(rDefRange.getMinX(), aCenter.getY() - fRadius)); + aAdaptedRange.expand(basegfx::B2DPoint(rDefRange.getMaxX(), aCenter.getY() + fRadius)); + } + else + { + // portrait -> square + const double fRadius(0.5 * rDefRange.getHeight()); + aAdaptedRange.expand(basegfx::B2DPoint(aCenter.getX() - fRadius, rDefRange.getMinY())); + aAdaptedRange.expand(basegfx::B2DPoint(aCenter.getX() + fRadius, rDefRange.getMaxY())); + } + + bLandscape = true; + fSmallRadius = 0.5 * aAdaptedRange.getWidth(); + } + else + { + if (bAngle) + { + // expand range using applied rotation + aAdaptedRange.transform(basegfx::utils::createRotateAroundPoint(aCenter, fAngle)); + } + + // set local params as needed for non-square + bLandscape = aAdaptedRange.getWidth() > aAdaptedRange.getHeight(); + fSmallRadius = 0.5 * (bLandscape ? aAdaptedRange.getHeight() : aAdaptedRange.getWidth()); + } + + // pack rotation and offset into a combined transformation that covers that parts + basegfx::B2DHomMatrix aRotAndTranslate; + aRotAndTranslate.translate(-aCenter.getX(), -aCenter.getY()); + if (bAngle) + aRotAndTranslate.rotate(fAngle); + aRotAndTranslate.translate(aAdaptedRange.getMinX() + (fOffxsetX * aAdaptedRange.getWidth()), + aAdaptedRange.getMinY() + (fOffxsetY * aAdaptedRange.getHeight())); + + // create local transform to work in object coordinates based on OutputRange, + // combine with rotation and offset - that way we can then just draw into + // AdaptedRange + basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectToViewTransformation() + * aRotAndTranslate); + cairo_matrix_t aMatrix; + cairo_matrix_init(&aMatrix, aLocalTransform.a(), aLocalTransform.b(), aLocalTransform.c(), + aLocalTransform.d(), aLocalTransform.e(), aLocalTransform.f()); + cairo_set_matrix(mpRT, &aMatrix); + + // get color stops (make copy, might have to be changed) + basegfx::BColorStops aBColorStops(rFillGradient.getColorStops()); + + // apply BColorModifierStack early - the BColorStops are used multiple + // times below, so do this only once + if (0 != maBColorModifierStack.count()) + { + aBColorStops.tryToApplyBColorModifierStack(maBColorModifierStack); + } + + // get and apply border - create soace at start in gradient + const double fBorder(std::max(std::min(rFillGradient.getBorder(), 1.0), 0.0)); + if (!basegfx::fTools::equalZero(fBorder)) + { + aBColorStops.createSpaceAtStart(fBorder); + } + + // Apply steps if used to 'emulate' LO's 'discrete step' feature + if (rFillGradient.getSteps()) + { + aBColorStops.doApplySteps(rFillGradient.getSteps()); + } + + // get half single pixel size to fill touching 'gaps' + // NOTE: I formally used cairo_device_to_user_distance, but that + // can indeed create negative sizes if the transformation e.g. + // contains rotation(s). could use fabs(), but just rely on + // linear algebra and use the (always positive) length of a vector + const double fHalfPx((getViewInformation2D().getInverseObjectToViewTransformation() + * basegfx::B2DVector(1.0, 0.0)) + .getLength()); + + // draw top part trapez/triangle + { + cairo_move_to(mpRT, aAdaptedRange.getMinX(), aAdaptedRange.getMinY()); + cairo_line_to(mpRT, aAdaptedRange.getMaxX(), aAdaptedRange.getMinY()); + cairo_line_to(mpRT, aAdaptedRange.getMaxX(), aAdaptedRange.getMinY() + fHalfPx); + if (!bSquare && bLandscape) + { + cairo_line_to(mpRT, aAdaptedRange.getMaxX() - fSmallRadius, aCenter.getY() + fHalfPx); + cairo_line_to(mpRT, aAdaptedRange.getMinX() + fSmallRadius, aCenter.getY() + fHalfPx); + } + else + { + cairo_line_to(mpRT, aCenter.getX(), aAdaptedRange.getMinY() + fSmallRadius + fHalfPx); + } + cairo_line_to(mpRT, aAdaptedRange.getMinX(), aAdaptedRange.getMinY() + fHalfPx); + cairo_close_path(mpRT); + + // create linear pattern in needed coordinates directly + // NOTE: I *tried* to create in unit coordinates and adapt modifying and re-using + // cairo_pattern_set_matrix - that *seems* to work but sometimes runs into + // numerical problems -> probably cairo implementation. So stay safe and do + // it the easy way, for the cost of re-creating gradient definitions (still cheap) + cairo_pattern_t* pPattern(cairo_pattern_create_linear( + aCenter.getX(), aAdaptedRange.getMinY(), aCenter.getX(), + aAdaptedRange.getMinY() + + (bLandscape ? aAdaptedRange.getHeight() * 0.5 : fSmallRadius))); + for (const auto& aStop : aBColorStops) + { + const basegfx::BColor& rColor(aStop.getStopColor()); + cairo_pattern_add_color_stop_rgb(pPattern, aStop.getStopOffset(), rColor.getRed(), + rColor.getGreen(), rColor.getBlue()); + } + + cairo_set_source(mpRT, pPattern); + cairo_fill(mpRT); + cairo_pattern_destroy(pPattern); + } + + { + // draw right part trapez/triangle + cairo_move_to(mpRT, aAdaptedRange.getMaxX(), aAdaptedRange.getMinY()); + cairo_line_to(mpRT, aAdaptedRange.getMaxX(), aAdaptedRange.getMaxY()); + if (bSquare || bLandscape) + { + cairo_line_to(mpRT, aAdaptedRange.getMaxX() - fSmallRadius - fHalfPx, aCenter.getY()); + } + else + { + cairo_line_to(mpRT, aCenter.getX() - fHalfPx, aAdaptedRange.getMaxY() - fSmallRadius); + cairo_line_to(mpRT, aCenter.getX() - fHalfPx, aAdaptedRange.getMinY() + fSmallRadius); + } + cairo_close_path(mpRT); + + // create linear pattern in needed coordinates directly + cairo_pattern_t* pPattern(cairo_pattern_create_linear( + aAdaptedRange.getMaxX(), aCenter.getY(), + aAdaptedRange.getMaxX() - (bLandscape ? fSmallRadius : aAdaptedRange.getWidth() * 0.5), + aCenter.getY())); + for (const auto& aStop : aBColorStops) + { + const basegfx::BColor& rColor(aStop.getStopColor()); + cairo_pattern_add_color_stop_rgb(pPattern, aStop.getStopOffset(), rColor.getRed(), + rColor.getGreen(), rColor.getBlue()); + } + + cairo_set_source(mpRT, pPattern); + cairo_fill(mpRT); + cairo_pattern_destroy(pPattern); + } + + { + // draw bottom part trapez/triangle + cairo_move_to(mpRT, aAdaptedRange.getMaxX(), aAdaptedRange.getMaxY()); + cairo_line_to(mpRT, aAdaptedRange.getMinX(), aAdaptedRange.getMaxY()); + cairo_line_to(mpRT, aAdaptedRange.getMinX(), aAdaptedRange.getMaxY() - fHalfPx); + if (!bSquare && bLandscape) + { + cairo_line_to(mpRT, aAdaptedRange.getMinX() + fSmallRadius, aCenter.getY() - fHalfPx); + cairo_line_to(mpRT, aAdaptedRange.getMaxX() - fSmallRadius, aCenter.getY() - fHalfPx); + } + else + { + cairo_line_to(mpRT, aCenter.getX(), aAdaptedRange.getMaxY() - fSmallRadius - fHalfPx); + } + cairo_line_to(mpRT, aAdaptedRange.getMaxX(), aAdaptedRange.getMaxY() - fHalfPx); + cairo_close_path(mpRT); + + // create linear pattern in needed coordinates directly + cairo_pattern_t* pPattern(cairo_pattern_create_linear( + aCenter.getX(), aAdaptedRange.getMaxY(), aCenter.getX(), + aAdaptedRange.getMaxY() + - (bLandscape ? aAdaptedRange.getHeight() * 0.5 : fSmallRadius))); + for (const auto& aStop : aBColorStops) + { + const basegfx::BColor& rColor(aStop.getStopColor()); + cairo_pattern_add_color_stop_rgb(pPattern, aStop.getStopOffset(), rColor.getRed(), + rColor.getGreen(), rColor.getBlue()); + } + + cairo_set_source(mpRT, pPattern); + cairo_fill(mpRT); + cairo_pattern_destroy(pPattern); + } + + { + // draw left part trapez/triangle + cairo_move_to(mpRT, aAdaptedRange.getMinX(), aAdaptedRange.getMaxY()); + cairo_line_to(mpRT, aAdaptedRange.getMinX(), aAdaptedRange.getMinY()); + if (bSquare || bLandscape) + { + cairo_line_to(mpRT, aAdaptedRange.getMinX() + fSmallRadius + fHalfPx, aCenter.getY()); + } + else + { + cairo_line_to(mpRT, aCenter.getX() + fHalfPx, aAdaptedRange.getMinY() + fSmallRadius); + cairo_line_to(mpRT, aCenter.getX() + fHalfPx, aAdaptedRange.getMaxY() - fSmallRadius); + } + cairo_close_path(mpRT); + + // create linear pattern in needed coordinates directly + cairo_pattern_t* pPattern(cairo_pattern_create_linear( + aAdaptedRange.getMinX(), aCenter.getY(), + aAdaptedRange.getMinX() + (bLandscape ? fSmallRadius : aAdaptedRange.getWidth() * 0.5), + aCenter.getY())); + for (const auto& aStop : aBColorStops) + { + const basegfx::BColor& rColor(aStop.getStopColor()); + cairo_pattern_add_color_stop_rgb(pPattern, aStop.getStopOffset(), rColor.getRed(), + rColor.getGreen(), rColor.getBlue()); + } + + cairo_set_source(mpRT, pPattern); + cairo_fill(mpRT); + cairo_pattern_destroy(pPattern); + } + + // cleanup + // cairo_pattern_destroy(pPattern); + cairo_restore(mpRT); +} + +void CairoPixelProcessor2D::processFillGradientPrimitive2D_radial_elliptical( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D) +{ + assert((css::awt::GradientStyle_RADIAL == rFillGradientPrimitive2D.getFillGradient().getStyle() + || css::awt::GradientStyle_ELLIPTICAL + == rFillGradientPrimitive2D.getFillGradient().getStyle()) + && "SDPRCairo: Helper allows only SPECIFIED types (!)"); + cairo_save(mpRT); + + // need to do 'antique' stuff adaptions for rotate/transitionStart in object coordinates + // (DefinitionRange) to have the right 'bending' on rotation + const attribute::FillGradientAttribute& rFillGradient( + rFillGradientPrimitive2D.getFillGradient()); + const basegfx::B2DRange rDefRange(rFillGradientPrimitive2D.getDefinitionRange()); + const basegfx::B2DPoint aCenter(rDefRange.getCenter()); + double fRadius(1.0); + double fRatioElliptical(1.0); + const bool bRadial(css::awt::GradientStyle_RADIAL == rFillGradient.getStyle()); + + // use what is done in initEllipticalGradientInfo method to get as close as + // possible to former stuff, expand AdaptedRange as needed + if (bRadial) + { + const double fHalfOriginalDiag(std::hypot(rDefRange.getWidth(), rDefRange.getHeight()) + * 0.5); + fRadius = fHalfOriginalDiag; + } + else + { + double fTargetSizeX(M_SQRT2 * rDefRange.getWidth()); + double fTargetSizeY(M_SQRT2 * rDefRange.getHeight()); + fRatioElliptical = fTargetSizeX / fTargetSizeY; + fRadius = std::max(fTargetSizeX, fTargetSizeY) * 0.5; + } + + // get rotation and offset values + const double fAngle(basegfx::normalizeToRange((2 * M_PI) - rFillGradient.getAngle(), 2 * M_PI)); + const bool bAngle(!basegfx::fTools::equalZero(fAngle)); + const double fOffxsetX(std::max(std::min(rFillGradient.getOffsetX(), 1.0), 0.0)); + const double fOffxsetY(std::max(std::min(rFillGradient.getOffsetY(), 1.0), 0.0)); + + // pack rotation and offset into a combined transformation that coverts that parts + basegfx::B2DHomMatrix aRotAndTranslate; + aRotAndTranslate.translate(-aCenter.getX(), -aCenter.getY()); + if (bAngle) + aRotAndTranslate.rotate(fAngle); + aRotAndTranslate.translate(rDefRange.getMinX() + (fOffxsetX * rDefRange.getWidth()), + rDefRange.getMinY() + (fOffxsetY * rDefRange.getHeight())); + + // create local transform to work in object coordinates based on OutputRange, + // combine with rotation and offset - that way we can then just draw into + // AdaptedRange + basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectToViewTransformation() + * aRotAndTranslate); + cairo_matrix_t aMatrix; + cairo_matrix_init(&aMatrix, aLocalTransform.a(), aLocalTransform.b(), aLocalTransform.c(), + aLocalTransform.d(), aLocalTransform.e(), aLocalTransform.f()); + cairo_set_matrix(mpRT, &aMatrix); + + // create linear pattern in unit coordinates in y-direction + cairo_pattern_t* pPattern(cairo_pattern_create_radial(aCenter.getX(), aCenter.getY(), fRadius, + aCenter.getX(), aCenter.getY(), 0.0)); + + // get color stops (make copy, might have to be changed) + basegfx::BColorStops aBColorStops(rFillGradient.getColorStops()); + + // get and apply border - create soace at start in gradient + const double fBorder(std::max(std::min(rFillGradient.getBorder(), 1.0), 0.0)); + if (!basegfx::fTools::equalZero(fBorder)) + { + aBColorStops.createSpaceAtStart(fBorder); + } + + // Apply steps if used to 'emulate' LO's 'discrete step' feature + if (rFillGradient.getSteps()) + { + aBColorStops.doApplySteps(rFillGradient.getSteps()); + } + + // add color stops + for (const auto& aStop : aBColorStops) + { + const basegfx::BColor aColor(maBColorModifierStack.getModifiedColor(aStop.getStopColor())); + cairo_pattern_add_color_stop_rgb(pPattern, aStop.getStopOffset(), aColor.getRed(), + aColor.getGreen(), aColor.getBlue()); + } + + cairo_set_source(mpRT, pPattern); + + if (!bRadial) // css::awt::GradientStyle_ELLIPTICAL + { + // set cairo matrix at cairo_pattern_t to get needed ratio scale done. + // this is necessary since cairo_pattern_create_radial does *not* + // support ellipse resp. radial gradient with non-equidistant + // ratio directly + // this uses the transformation 'from user space to pattern space' as + // cairo docu states. That is the inverse of the intuitive thought + // model: describe from coordinates in texture, so use B2DHomMatrix + // and invert at the end to have better control about what has to happen + basegfx::B2DHomMatrix aTrans; + + // move center to origin to prepare scale/rotate + aTrans.translate(-aCenter.getX(), -aCenter.getY()); + + // get scale factor and apply as needed + if (fRatioElliptical > 1.0) + aTrans.scale(1.0, 1.0 / fRatioElliptical); + else + aTrans.scale(fRatioElliptical, 1.0); + + // move transformed stuff back to center + aTrans.translate(aCenter.getX(), aCenter.getY()); + + // invert and set at cairo_pattern_t + aTrans.invert(); + cairo_matrix_init(&aMatrix, aTrans.a(), aTrans.b(), aTrans.c(), aTrans.d(), aTrans.e(), + aTrans.f()); + cairo_pattern_set_matrix(pPattern, &aMatrix); + } + + // draw OutRange. Due to rot and translate being part of the + // set transform in cairo we need to back-transform (and expand + // as needed) the OutputRange to paint at the right place and + // get all OutputRange covered + basegfx::B2DRange aOutRange(rFillGradientPrimitive2D.getOutputRange()); + aRotAndTranslate.invert(); + aOutRange.transform(aRotAndTranslate); + cairo_rectangle(mpRT, aOutRange.getMinX(), aOutRange.getMinY(), aOutRange.getWidth(), + aOutRange.getHeight()); + cairo_fill(mpRT); + + // cleanup + cairo_pattern_destroy(pPattern); + cairo_restore(mpRT); +} + +void CairoPixelProcessor2D::processFillGradientPrimitive2D_fallback_decompose( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D) +{ + // this helper draws the given gradient using the decompose fallback, + // maybe needed in some cases an can/will be handy + cairo_save(mpRT); + + // draw all-covering initial BG polygon 1st using getOuterColor and getOutputRange + processFillGradientPrimitive2D_drawOutputRange(rFillGradientPrimitive2D); + + // bet basic form in unit coordinates + CairoPathHelper aForm(rFillGradientPrimitive2D.getUnitPolygon()); + + // paint solid fill steps by providing callback as lambda + auto aCallback([this, &aForm](const basegfx::B2DHomMatrix& rMatrix, + const basegfx::BColor& rColor) { + const basegfx::B2DHomMatrix aTrans(getViewInformation2D().getObjectToViewTransformation() + * rMatrix); + cairo_matrix_t aMatrix; + cairo_matrix_init(&aMatrix, aTrans.a(), aTrans.b(), aTrans.c(), aTrans.d(), aTrans.e(), + aTrans.f()); + cairo_set_matrix(mpRT, &aMatrix); + + const basegfx::BColor aColor(maBColorModifierStack.getModifiedColor(rColor)); + cairo_set_source_rgb(mpRT, aColor.getRed(), aColor.getGreen(), aColor.getBlue()); + + cairo_append_path(mpRT, aForm.getCairoPath()); + + cairo_fill(mpRT); + }); + + // call value generator to trigger callbacks + rFillGradientPrimitive2D.generateMatricesAndColors(aCallback); + + cairo_restore(mpRT); +} + +void CairoPixelProcessor2D::processFillGradientPrimitive2D( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D) +{ + if (rFillGradientPrimitive2D.getDefinitionRange().isEmpty()) + { + // no definition area, done + return; + } + + if (rFillGradientPrimitive2D.getOutputRange().isEmpty()) + { + // no output area, done + return; + } + + const attribute::FillGradientAttribute& rFillGradient( + rFillGradientPrimitive2D.getFillGradient()); + + if (rFillGradient.isDefault()) + { + // no gradient definition, done + return; + } + + // check if completely 'bordered out' + if (processFillGradientPrimitive2D_isCompletelyBordered(rFillGradientPrimitive2D)) + { + // yes, done, was processed as single filled rectangle (using getOuterColor()) + return; + } + + // evtl. prefer fallback: cairo does *not* render hard color transitions + // in gradients anti-aliased which is most visible in 'step'ed gradients, + // but may also happen in normal ones -> may need to be checked in + // basegfx::BColorStops (as tooling, like isSymmetrical() or similar). + // due to the nature of 'step'ing this also means a low number of + // filled polygons to be drawn (no 'smooth' parts to be replicated), + // so this is not runtime burner by definition. + // Making this configurable using static bool, may be moved to settings + // somewhere later. Do not forget to deactivate when working on 'step'ping + // stuff in the other helpers (!) + static bool bPreferAntiAliasedHardColorTransitions(true); + + if (bPreferAntiAliasedHardColorTransitions && rFillGradient.getSteps()) + { + processFillGradientPrimitive2D_fallback_decompose(rFillGradientPrimitive2D); + return; + } + + switch (rFillGradient.getStyle()) + { + case css::awt::GradientStyle_LINEAR: + case css::awt::GradientStyle_AXIAL: + { + // use specialized renderer for this cases - linear, axial + processFillGradientPrimitive2D_linear_axial(rFillGradientPrimitive2D); + return; + } + case css::awt::GradientStyle_RADIAL: + case css::awt::GradientStyle_ELLIPTICAL: + { + // use specialized renderer for this cases - radial, elliptical + + // NOTE for css::awt::GradientStyle_ELLIPTICAL: + // The first time ever I will accept slight deviations for the + // elliptical case here due to it's old chaotic move-two-pixels inside + // rendering method that cannot be patched into a lineartransformation + // and is hard/difficult to support in more modern systems. Differences + // are small and mostly would be visible *if* in steps-mode what is + // also rare. IF that should make problems reactivation of that case + // for the default case below is possible. main reason is that speed + // for direct rendering in cairo is much better. + processFillGradientPrimitive2D_radial_elliptical(rFillGradientPrimitive2D); + return; + } + case css::awt::GradientStyle_SQUARE: + case css::awt::GradientStyle_RECT: + { + // use specialized renderer for this cases - square, rect + processFillGradientPrimitive2D_square_rect(rFillGradientPrimitive2D); + return; + } + default: + { + // NOTE: All cases are covered above, but keep this as fallback, + // so it is possible anytime to exclude one of the cases above again + // and go back to decomposed version - just in case... + processFillGradientPrimitive2D_fallback_decompose(rFillGradientPrimitive2D); + break; + } + } +} + void CairoPixelProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) { switch (rCandidate.getPrimitive2DID()) @@ -911,7 +2474,6 @@ void CairoPixelProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimit static_cast(rCandidate)); break; } -#if 0 // geometry that *may* be processed due to being able to do it better // then using the decomposition case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D: @@ -932,7 +2494,6 @@ void CairoPixelProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimit static_cast(rCandidate)); break; } -#endif case PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D: { processPolygonStrokePrimitive2D( @@ -957,6 +2518,18 @@ void CairoPixelProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimit static_cast(rCandidate)); break; } + case PRIMITIVE2D_ID_FILLGRAPHICPRIMITIVE2D: + { + processFillGraphicPrimitive2D( + static_cast(rCandidate)); + break; + } + case PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D: + { + processFillGradientPrimitive2D( + static_cast(rCandidate)); + break; + } // continue with decompose default: diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx index 6bfc95878332..74a902727387 100644 --- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx @@ -1803,7 +1803,7 @@ void D2DPixelProcessor2D::processFillGraphicPrimitive2D( { BitmapEx aPreparedBitmap; basegfx::B2DRange aFillUnitRange(rFillGraphicPrimitive2D.getFillGraphic().getGraphicRange()); - static double fBigDiscreteArea(300.0 * 300.0); + constexpr double fBigDiscreteArea(300.0 * 300.0); // use tooling to do various checks and prepare tiled rendering, see // description of method, parameters and return value there diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 7c21e4ea1f1c..b21348cf6635 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -315,6 +315,8 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( // set parameters and paint text snippet const basegfx::BColor aRGBFontColor( maBColorModifierStack.getModifiedColor(rTextCandidate.getFontColor())); + + // Store previous complex text layout state, to be restored after drawing const vcl::text::ComplexTextLayoutFlags nOldLayoutMode(mpOutputDevice->GetLayoutMode()); if (rTextCandidate.getFontAttribute().getRTL()) @@ -325,6 +327,14 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( | vcl::text::ComplexTextLayoutFlags::TextOriginLeft; mpOutputDevice->SetLayoutMode(nRTLLayoutMode); } + else + { + // tdf#101686: This is LTR text, but the output device may have RTL state. + vcl::text::ComplexTextLayoutFlags nLTRLayoutMode(nOldLayoutMode); + nLTRLayoutMode = nLTRLayoutMode & ~vcl::text::ComplexTextLayoutFlags::BiDiRtl; + nLTRLayoutMode = nLTRLayoutMode & ~vcl::text::ComplexTextLayoutFlags::BiDiStrong; + mpOutputDevice->SetLayoutMode(nLTRLayoutMode); + } OUString aText(rTextCandidate.getText()); sal_Int32 nPos = rTextCandidate.getTextPosition(); @@ -460,10 +470,8 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( } } - if (rTextCandidate.getFontAttribute().getRTL()) - { - mpOutputDevice->SetLayoutMode(nOldLayoutMode); - } + // Restore previous layout mode + mpOutputDevice->SetLayoutMode(nOldLayoutMode); if (bChangeMapMode) mpOutputDevice->Pop(); diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 1dd5149fd102..9657fb4f0c41 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -1705,7 +1705,7 @@ namespace emfplushelper stringLength, std::move(emptyVector), // EMF-PLUS has no DX-array {}, - fontAttribute, + std::move(fontAttribute), locale, color.getBColor(), // Font Color COL_TRANSPARENT, // Fill Color @@ -1725,7 +1725,7 @@ namespace emfplushelper stringLength, std::move(emptyVector), // EMF-PLUS has no DX-array {}, - fontAttribute, + std::move(fontAttribute), locale, color.getBColor()); } diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 0d39a8c4d9ad..fb52f89c055b 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -138,9 +138,9 @@ bool SvxPaperBinItem::GetPresentation } -SvxSizeItem::SvxSizeItem( const sal_uInt16 nId, const Size& rSize ) : +SvxSizeItem::SvxSizeItem( const sal_uInt16 nId, const Size& rSize, SfxItemType eItemType ) : - SfxPoolItem( nId, SfxItemType::SvxSizeItemType ), + SfxPoolItem( nId, eItemType ), m_aSize( rSize ) { @@ -173,6 +173,7 @@ bool SvxSizeItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -228,6 +229,19 @@ SvxSizeItem::SvxSizeItem( const sal_uInt16 nId ) : } +bool SvxSizeItem::isHashable() const +{ + return true; +} + +size_t SvxSizeItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_aSize.Width()); + o3tl::hash_combine(seed, m_aSize.Height()); + return seed; +} + bool SvxSizeItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -607,6 +621,7 @@ bool SvxLeftMarginItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) const bool SvxLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -643,6 +658,19 @@ bool SvxLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) return true; } +bool SvxLeftMarginItem::isHashable() const +{ + return true; +} + +size_t SvxLeftMarginItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nLeftMargin); + o3tl::hash_combine(seed, m_nPropLeftMargin); + return seed; +} + bool SvxLeftMarginItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -784,6 +812,7 @@ bool SvxTextLeftMarginItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) cons bool SvxTextLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -820,6 +849,19 @@ bool SvxTextLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) return true; } +bool SvxTextLeftMarginItem::isHashable() const +{ + return true; +} + +size_t SvxTextLeftMarginItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nTextLeftMargin); + o3tl::hash_combine(seed, m_nPropLeftMargin); + return seed; +} + bool SvxTextLeftMarginItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -955,6 +997,7 @@ bool SvxFirstLineIndentItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) con bool SvxFirstLineIndentItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -995,6 +1038,20 @@ bool SvxFirstLineIndentItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) return true; } +bool SvxFirstLineIndentItem::isHashable() const +{ + return true; +} + +size_t SvxFirstLineIndentItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nFirstLineOffset); + o3tl::hash_combine(seed, m_nPropFirstLineOffset); + o3tl::hash_combine(seed, m_bAutoFirst); + return seed; +} + bool SvxFirstLineIndentItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1139,6 +1196,7 @@ bool SvxRightMarginItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) const bool SvxRightMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1175,6 +1233,19 @@ bool SvxRightMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) return true; } +bool SvxRightMarginItem::isHashable() const +{ + return true; +} + +size_t SvxRightMarginItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nRightMargin); + o3tl::hash_combine(seed, m_nPropRightMargin); + return seed; +} + bool SvxRightMarginItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1300,6 +1371,7 @@ bool SvxGutterLeftMarginItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) co bool SvxGutterLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1323,6 +1395,18 @@ bool SvxGutterLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId return true; } +bool SvxGutterLeftMarginItem::isHashable() const +{ + return true; +} + +size_t SvxGutterLeftMarginItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nGutterMargin); + return seed; +} + bool SvxGutterLeftMarginItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1410,6 +1494,7 @@ bool SvxGutterRightMarginItem::QueryValue(uno::Any& /*rVal*/, sal_uInt8 nMemberI bool SvxGutterRightMarginItem::PutValue(const uno::Any& /*rVal*/, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; //bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1429,6 +1514,18 @@ bool SvxGutterRightMarginItem::PutValue(const uno::Any& /*rVal*/, sal_uInt8 nMem } +bool SvxGutterRightMarginItem::isHashable() const +{ + return true; +} + +size_t SvxGutterRightMarginItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nRightGutterMargin); + return seed; +} + bool SvxGutterRightMarginItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1489,6 +1586,28 @@ boost::property_tree::ptree SvxGutterRightMarginItem::dumpAsJSON() const } +bool SvxLRSpaceItem::isHashable() const +{ + return true; +} + +size_t SvxLRSpaceItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, nFirstLineOffset); + o3tl::hash_combine(seed, m_nGutterMargin); + o3tl::hash_combine(seed, m_nRightGutterMargin); + o3tl::hash_combine(seed, nLeftMargin); + o3tl::hash_combine(seed, nRightMargin); + o3tl::hash_combine(seed, nPropFirstLineOffset); + o3tl::hash_combine(seed, nPropLeftMargin); + o3tl::hash_combine(seed, nPropRightMargin); + o3tl::hash_combine(seed, bAutoFirst); + o3tl::hash_combine(seed, bExplicitZeroMarginValRight); + o3tl::hash_combine(seed, bExplicitZeroMarginValLeft); + return seed; +} + bool SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1713,6 +1832,7 @@ bool SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Int32 nVal = 0; @@ -1773,6 +1893,22 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } +bool SvxULSpaceItem::isHashable() const +{ + return true; +} + +size_t SvxULSpaceItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, nUpper); + o3tl::hash_combine(seed, nLower); + o3tl::hash_combine(seed, bContext); + o3tl::hash_combine(seed, nPropUpper); + o3tl::hash_combine(seed, nPropLower); + return seed; +} + bool SvxULSpaceItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1943,6 +2079,20 @@ bool SvxOpaqueItem::GetPresentation } +bool SvxProtectItem::isHashable() const +{ + return true; +} + +size_t SvxProtectItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, bCntnt); + o3tl::hash_combine(seed, bSize); + o3tl::hash_combine(seed, bPos); + return seed; +} + bool SvxProtectItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1975,6 +2125,7 @@ bool SvxProtectItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxProtectItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; bool bVal( Any2Bool(rVal) ); switch(nMemberId) @@ -2143,6 +2294,20 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } +bool SvxShadowItem::isHashable() const +{ + return true; +} + +size_t SvxShadowItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, static_cast(aShadowColor)); + o3tl::hash_combine(seed, nWidth); + o3tl::hash_combine(seed, eLocation); + return seed; +} + bool SvxShadowItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -2358,7 +2523,6 @@ static bool CompareBorderLine(const std::unique_ptr & pBrd1, cons return *pBrd1 == *pBrd2; } - bool SvxBoxItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -3263,12 +3427,6 @@ SvxBoxInfoItem::SvxBoxInfoItem(const sal_uInt16 nId) ResetFlags(); } -ItemInstanceManager* SvxBoxItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxBoxItem).hash_code()); - return &aInstanceManager; -} - SvxBoxInfoItem::SvxBoxInfoItem( const SvxBoxInfoItem& rCopy ) : SfxPoolItem(rCopy) , mpHorizontalLine(rCopy.mpHorizontalLine ? new SvxBorderLine(*rCopy.mpHorizontalLine) : nullptr) @@ -3983,12 +4141,6 @@ void SvxLineItem::SetLine( const SvxBorderLine* pNew ) pLine.reset( pNew ? new SvxBorderLine( *pNew ) : nullptr ); } -ItemInstanceManager* SvxBrushItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxBrushItem).hash_code()); - return &aInstanceManager; -} - SvxBrushItem::SvxBrushItem(sal_uInt16 _nWhich) : SfxPoolItem(_nWhich, SfxItemType::SvxBrushItemType) , aColor(COL_TRANSPARENT) @@ -4600,12 +4752,6 @@ void SvxBrushItem::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterEndElement(pWriter); } -ItemInstanceManager* SvxFrameDirectionItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxFrameDirectionItem).hash_code()); - return &aInstanceManager; -} - SvxFrameDirectionItem::SvxFrameDirectionItem( SvxFrameDirection nValue , sal_uInt16 _nWhich ) : SfxEnumItem( _nWhich, SfxItemType::SvxFrameDirectionItemType, nValue ) diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index a63f73c25335..c75f236f8246 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -50,6 +50,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -339,12 +340,6 @@ void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal ) // class SvxAdjustItem --------------------------------------------------- -ItemInstanceManager* SvxAdjustItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxAdjustItem).hash_code()); - return &aInstanceManager; -} - SvxAdjustItem::SvxAdjustItem(const SvxAdjust eAdjst, const sal_uInt16 nId ) : SfxEnumItemInterface( nId, SfxItemType::SvxAdjustItemType ), bOneBlock( false ), bLastCenter( false ), bLastBlock( false ) @@ -352,6 +347,17 @@ SvxAdjustItem::SvxAdjustItem(const SvxAdjust eAdjst, const sal_uInt16 nId ) SetAdjust( eAdjst ); } +bool SvxAdjustItem::isHashable() const { return true; } + +size_t SvxAdjustItem::hashCode() const +{ + std::size_t seed(0); + o3tl::hash_combine(seed, GetAdjust()); + o3tl::hash_combine(seed, bOneBlock); + o3tl::hash_combine(seed, bLastCenter); + o3tl::hash_combine(seed, bLastBlock); + return seed; +} bool SvxAdjustItem::operator==( const SfxPoolItem& rAttr ) const { @@ -383,6 +389,7 @@ bool SvxAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -559,7 +566,7 @@ bool SvxOrphansItem::GetPresentation // class SvxHyphenZoneItem ----------------------------------------------- SvxHyphenZoneItem::SvxHyphenZoneItem( const bool bHyph, const sal_uInt16 nId ) : - SfxPoolItem( nId, SfxItemType::SvxHyphenZoneItem ), + SfxPoolItem( nId, SfxItemType::SvxHyphenZoneItemType ), bHyphen(bHyph), bKeep(false), bNoCapsHyphenation(false), diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 638948e747de..e0082b0a4968 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -159,30 +159,21 @@ bool SvxFontListItem::GetPresentation // class SvxFontItem ----------------------------------------------------- -namespace +bool SvxFontItem::isHashable() const { - class SvxFontItemInstanceManager : public TypeSpecificItemInstanceManager - { - protected: - virtual size_t hashCode(const SfxPoolItem& rItem) const override - { - const SvxFontItem& rFontItem(static_cast(rItem)); - std::size_t seed(0); - o3tl::hash_combine(seed, rItem.Which()); - o3tl::hash_combine(seed, rFontItem.GetFamilyName().hashCode()); - o3tl::hash_combine(seed, rFontItem.GetStyleName().hashCode()); - o3tl::hash_combine(seed, rFontItem.GetFamily()); - o3tl::hash_combine(seed, rFontItem.GetPitch()); - o3tl::hash_combine(seed, rFontItem.GetCharSet()); - return seed; - } - }; + return true; } -ItemInstanceManager* SvxFontItem::getItemInstanceManager() const +size_t SvxFontItem::hashCode() const { - static SvxFontItemInstanceManager aInstanceManager; - return &aInstanceManager; + std::size_t seed(0); + o3tl::hash_combine(seed, Which()); + o3tl::hash_combine(seed, GetFamilyName().hashCode()); + o3tl::hash_combine(seed, GetStyleName().hashCode()); + o3tl::hash_combine(seed, GetFamily()); + o3tl::hash_combine(seed, GetPitch()); + o3tl::hash_combine(seed, GetCharSet()); + return seed; } SvxFontItem::SvxFontItem( @@ -243,6 +234,7 @@ bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxFontItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -409,28 +401,6 @@ void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxPostureItem -------------------------------------------------- -namespace -{ - class SvxPostureItemInstanceManager : public TypeSpecificItemInstanceManager - { - protected: - virtual size_t hashCode(const SfxPoolItem& rItem) const override - { - auto const & rPostureItem = static_cast(rItem); - std::size_t seed(0); - o3tl::hash_combine(seed, rPostureItem.Which()); - o3tl::hash_combine(seed, rPostureItem. GetEnumValue()); - return seed; - } - }; -} - -ItemInstanceManager* SvxPostureItem::getItemInstanceManager() const -{ - static SvxPostureItemInstanceManager aInstanceManager; - return &aInstanceManager; -} - SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const sal_uInt16 nId ) : SfxEnumItem( nId, SfxItemType::SvxPostureItemType, ePosture ) { @@ -495,6 +465,7 @@ bool SvxPostureItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -547,12 +518,6 @@ void SvxPostureItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxWeightItem --------------------------------------------------- -ItemInstanceManager* SvxWeightItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxWeightItem).hash_code()); - return &aInstanceManager; -} - SvxWeightItem::SvxWeightItem( const FontWeight eWght, const sal_uInt16 nId ) : SfxEnumItem( nId, SfxItemType::SvxWeightItemType, eWght ) { @@ -677,28 +642,18 @@ void SvxWeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxFontHeightItem ----------------------------------------------- -namespace +bool SvxFontHeightItem::isHashable() const { - class SvxFontHeightItemInstanceManager : public TypeSpecificItemInstanceManager - { - protected: - virtual size_t hashCode(const SfxPoolItem& rItem) const override - { - auto const & rFontHeightItem = static_cast(rItem); - std::size_t seed(0); - o3tl::hash_combine(seed, rFontHeightItem.Which()); - o3tl::hash_combine(seed, rFontHeightItem.GetHeight()); - o3tl::hash_combine(seed, rFontHeightItem.GetProp()); - o3tl::hash_combine(seed, rFontHeightItem.GetPropUnit()); - return seed; - } - }; + return true; } -ItemInstanceManager* SvxFontHeightItem::getItemInstanceManager() const +size_t SvxFontHeightItem::hashCode() const { - static SvxFontHeightItemInstanceManager aInstanceManager; - return &aInstanceManager; + std::size_t seed(0); + o3tl::hash_combine(seed, GetHeight()); + o3tl::hash_combine(seed, GetProp()); + o3tl::hash_combine(seed, GetPropUnit()); + return seed; } SvxFontHeightItem::SvxFontHeightItem( const sal_uInt32 nSz, @@ -862,6 +817,7 @@ static sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, M bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) @@ -1042,8 +998,8 @@ void SvxFontHeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxTextLineItem ------------------------------------------------ -SvxTextLineItem::SvxTextLineItem( const FontLineStyle eSt, const sal_uInt16 nId ) - : SfxEnumItem(nId, SfxItemType::SvxTextLineItemType,eSt) +SvxTextLineItem::SvxTextLineItem( const FontLineStyle eSt, const sal_uInt16 nId, SfxItemType eItemType ) + : SfxEnumItem(nId, eItemType, eSt) , maColor(COL_TRANSPARENT) { } @@ -1194,14 +1150,8 @@ bool SvxTextLineItem::operator==( const SfxPoolItem& rItem ) const // class SvxUnderlineItem ------------------------------------------------ -ItemInstanceManager* SvxUnderlineItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxUnderlineItem).hash_code()); - return &aInstanceManager; -} - SvxUnderlineItem::SvxUnderlineItem( const FontLineStyle eSt, const sal_uInt16 nId ) - : SvxTextLineItem( eSt, nId ) + : SvxTextLineItem( eSt, nId, SfxItemType::SvxUnderlineItemType ) { } @@ -1241,14 +1191,8 @@ OUString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 nPos ) const // class SvxOverlineItem ------------------------------------------------ -ItemInstanceManager* SvxOverlineItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxOverlineItem).hash_code()); - return &aInstanceManager; -} - SvxOverlineItem::SvxOverlineItem( const FontLineStyle eSt, const sal_uInt16 nId ) - : SvxTextLineItem( eSt, nId ) + : SvxTextLineItem( eSt, nId, SfxItemType::SvxOverlineItemType ) { } @@ -1288,12 +1232,6 @@ OUString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const // class SvxCrossedOutItem ----------------------------------------------- -ItemInstanceManager* SvxCrossedOutItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxCrossedOutItem).hash_code()); - return &aInstanceManager; -} - SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const sal_uInt16 nId ) : SfxEnumItem( nId, SfxItemType::SvxCrossedOutItemType, eSt ) { @@ -1530,6 +1468,16 @@ SvxColorItem::~SvxColorItem() { } +bool SvxColorItem::isHashable() const { return true; } + +size_t SvxColorItem::hashCode() const +{ + std::size_t seed(0); + o3tl::hash_combine(seed, static_cast(mColor)); + o3tl::hash_combine(seed, maComplexColor); + return seed; +} + bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1618,6 +1566,7 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -1957,6 +1906,15 @@ SvxEscapementItem::SvxEscapementItem( const short _nEsc, { } +bool SvxEscapementItem::isHashable() const { return true; } + +size_t SvxEscapementItem::hashCode() const +{ + std::size_t seed(0); + o3tl::hash_combine(seed, nEsc); + o3tl::hash_combine(seed, nProp); + return seed; +} bool SvxEscapementItem::operator==( const SfxPoolItem& rAttr ) const { @@ -2046,6 +2004,7 @@ bool SvxEscapementItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -2090,12 +2049,6 @@ bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) // class SvxLanguageItem ------------------------------------------------- -ItemInstanceManager* SvxLanguageItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxLanguageItem).hash_code()); - return &aInstanceManager; -} - SvxLanguageItem::SvxLanguageItem( const LanguageType eLang, const sal_uInt16 nId ) : SvxLanguageItem_Base( nId , SfxItemType::SvxLanguageItemType, eLang ) { @@ -2238,12 +2191,6 @@ bool SvxBlinkItem::GetPresentation // class SvxEmphaisMarkItem --------------------------------------------------- -ItemInstanceManager* SvxEmphasisMarkItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxEmphasisMarkItem).hash_code()); - return &aInstanceManager; -} - SvxEmphasisMarkItem::SvxEmphasisMarkItem( const FontEmphasisMark nValue, TypedWhichId nId ) : SfxUInt16Item( nId, static_cast(nValue), SfxItemType::SvxEmphasisMarkItemType ) @@ -2457,8 +2404,8 @@ bool SvxTwoLinesItem::GetPresentation( SfxItemPresentation /*ePres*/, |* class SvxTextRotateItem *************************************************************************/ -SvxTextRotateItem::SvxTextRotateItem(Degree10 nValue, TypedWhichId nW) - : SfxUInt16Item(nW, nValue.get(), SfxItemType::SvxTextRotateItemType) +SvxTextRotateItem::SvxTextRotateItem(Degree10 nValue, TypedWhichId nW, SfxItemType eItemType) + : SfxUInt16Item(nW, nValue.get(), eItemType) { } @@ -2537,7 +2484,8 @@ void SvxTextRotateItem::dumpAsXml(xmlTextWriterPtr pWriter) const SvxCharRotateItem::SvxCharRotateItem( Degree10 nValue, bool bFitIntoLine, TypedWhichId nW ) - : SvxTextRotateItem(nValue, nW), bFitToLine( bFitIntoLine ) + : SvxTextRotateItem(nValue, nW, SfxItemType::SvxCharRotateItemType), + bFitToLine( bFitIntoLine ) { } @@ -2626,7 +2574,7 @@ void SvxCharRotateItem::dumpAsXml(xmlTextWriterPtr pWriter) const SvxCharScaleWidthItem::SvxCharScaleWidthItem( sal_uInt16 nValue, TypedWhichId nW ) - : SfxUInt16Item( nW, nValue, SfxItemType::SvxCharScaleWidthItem ) + : SfxUInt16Item( nW, nValue, SfxItemType::SvxCharScaleWidthItemType ) { } @@ -2678,12 +2626,6 @@ bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ |* class SvxCharReliefItem *************************************************************************/ -ItemInstanceManager* SvxCharReliefItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxCharReliefItem).hash_code()); - return &aInstanceManager; -} - SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue, const sal_uInt16 nId ) : SfxEnumItem( nId, SfxItemType::SvxCharReliefItemType, eValue ) @@ -2967,28 +2909,6 @@ void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rCo // class SvxRsidItem ----------------------------------------------------- -namespace -{ - class SvxRsidItemInstanceManager : public TypeSpecificItemInstanceManager - { - protected: - virtual size_t hashCode(const SfxPoolItem& rItem) const override - { - auto const & rRsidItem = static_cast(rItem); - std::size_t seed(0); - o3tl::hash_combine(seed, rRsidItem.Which()); - o3tl::hash_combine(seed, rRsidItem.GetValue()); - return seed; - } - }; -} - -ItemInstanceManager* SvxRsidItem::getItemInstanceManager() const -{ - static SvxRsidItemInstanceManager aInstanceManager; - return &aInstanceManager; -} - bool SvxRsidItem::QueryValue( uno::Any& rVal, sal_uInt8 ) const { rVal <<= GetValue(); @@ -2997,6 +2917,7 @@ bool SvxRsidItem::QueryValue( uno::Any& rVal, sal_uInt8 ) const bool SvxRsidItem::PutValue( const uno::Any& rVal, sal_uInt8 ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; sal_uInt32 nRsid = 0; if( !( rVal >>= nRsid ) ) return false; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 677919211c88..fb69464d2110 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2072,7 +2072,9 @@ SvxAutoCorrect::SearchWordsInList( CreateLanguageFile(aLanguageTag, false))) { //the language is available - so bring it on - SvxAutoCorrectLanguageLists& rList = m_aLangTable.find(aLanguageTag)->second; + const auto iter = m_aLangTable.find(aLanguageTag); + assert(iter != m_aLangTable.end()); + SvxAutoCorrectLanguageLists& rList = iter->second; auto pRet = lcl_SearchWordsInList( &rList, rTxt, rStt, nEndPos ); if( pRet ) { diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx index d3626e7de8e3..7d708d0d75d8 100644 --- a/editeng/source/xml/xmltxtimp.cxx +++ b/editeng/source/xml/xmltxtimp.cxx @@ -164,7 +164,8 @@ EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection { uno::Reference xContext( ::comphelper::getProcessComponentContext() ); - uno::Reference xInputStream = new utl::OInputStreamWrapper( rStream ); + xml::sax::InputSource aParserInput; + aParserInput.aInputStream = new utl::OInputStreamWrapper(rStream); /* testcode static constexpr OUStringLiteral aURL( u"file:///e:/test.xml" ); @@ -201,8 +202,6 @@ EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection // uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTextImportComponent( xText ) ); rtl::Reference< SvxXMLXTextImportComponent > xImport( new SvxXMLXTextImportComponent( xContext, pUnoText ) ); - xml::sax::InputSource aParserInput; - aParserInput.aInputStream = xInputStream; // aParserInput.sSystemId = aMedium.GetName(); xImport->parseStream( aParserInput ); } diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 0abb340f4d32..c72d788e3d04 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -375,7 +375,7 @@ bool OCommonEmbeddedObject::getAllowLinkUpdate() const uno::Reference xGrandParent(xParent->getParent(), uno::UNO_QUERY); if (!xGrandParent) break; - xParent = xGrandParent; + xParent = std::move(xGrandParent); } uno::Reference xPropSet(xParent, uno::UNO_QUERY); diff --git a/extensions/qa/bibliography/bibliography.cxx b/extensions/qa/bibliography/bibliography.cxx index 1657fec35db9..6c716269ad9b 100644 --- a/extensions/qa/bibliography/bibliography.cxx +++ b/extensions/qa/bibliography/bibliography.cxx @@ -26,8 +26,7 @@ class Test : public test::BootstrapFixture, public unotest::MacrosTest CPPUNIT_TEST_FIXTURE(Test, testBibliographyLoader) { // Given a bibliography provider: - uno::Reference xBibAccess - = frame::Bibliography::create(mxComponentContext); + uno::Reference xBibAccess = frame::Bibliography::create(m_xContext); uno::Reference xPropSet(xBibAccess, uno::UNO_QUERY); uno::Sequence aSeq; diff --git a/external/libxml2/ExternalPackage_libxml2.mk b/external/libxml2/ExternalPackage_libxml2.mk index 17190c77fd18..799044575f9a 100644 --- a/external/libxml2/ExternalPackage_libxml2.mk +++ b/external/libxml2/ExternalPackage_libxml2.mk @@ -21,7 +21,7 @@ else # COM=MSC $(eval $(call gb_ExternalPackage_add_file,libxml2,$(LIBO_URE_LIB_FOLDER)/libxml2.dll,win32/bin.msvc/libxml2.dll)) endif else # OS!=WNT -$(eval $(call gb_ExternalPackage_add_file,libxml2,$(LIBO_URE_LIB_FOLDER)/libxml2.so.2,.libs/libxml2.so.2.13.$(LIBXML_VERSION_MICRO))) +$(eval $(call gb_ExternalPackage_add_file,libxml2,$(LIBO_URE_LIB_FOLDER)/libxml2.so.2,.libs/libxml2.so.2.12.$(LIBXML_VERSION_MICRO))) endif endif # DISABLE_DYNLOADING diff --git a/external/libxml2/libxml2-XMLCALL-redefine.patch.0 b/external/libxml2/libxml2-XMLCALL-redefine.patch.0 index 57d23d885943..d9ca23be7ce4 100644 --- a/external/libxml2/libxml2-XMLCALL-redefine.patch.0 +++ b/external/libxml2/libxml2-XMLCALL-redefine.patch.0 @@ -1,11 +1,11 @@ --- include/libxml/xmlexports.h 2023-05-24 12:48:46.179570708 +0100 +++ include/libxml/xmlexports.h 2023-05-24 12:48:56.563577488 +0100 -@@ -31,8 +31,6 @@ - #define XMLPUBVAR XMLPUBLIC extern +@@ -38,8 +38,6 @@ + /** DOC_DISABLE */ /* Compatibility */ -#define XMLCALL -#define XMLCDECL - #ifndef LIBXML_DLL_IMPORT - #define LIBXML_DLL_IMPORT XMLPUBVAR + #if !defined(LIBXML_DLL_IMPORT) + #define LIBXML_DLL_IMPORT XMLPUBVAR #endif diff --git a/external/libxml2/libxml2-icu-sym.patch.0 b/external/libxml2/libxml2-icu-sym.patch.0 index d89a1c4c544b..07676228da19 100644 --- a/external/libxml2/libxml2-icu-sym.patch.0 +++ b/external/libxml2/libxml2-icu-sym.patch.0 @@ -3,14 +3,14 @@ Find bundled ICU in workdir and use debug .libs when needed diff -up win32/Makefile.msvc.dt win32/Makefile.msvc --- win32/Makefile.msvc.dt 2014-07-18 19:00:23.372103963 +0200 +++ win32/Makefile.msvc 2014-07-18 19:01:39.347982929 +0200 -@@ -42,6 +42,7 @@ +@@ -46,6 +46,7 @@ CPPFLAGS = $(CPPFLAGS) /D "_REENTRANT" CC = cl.exe CFLAGS = /nologo /D "_WINDOWS" /D "_MBCS" /D "NOLIBTOOL" /W3 /wd4244 /wd4267 $(CRUNTIME) CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX) +CFLAGS = $(CFLAGS) /I$(WORKDIR)/UnpackedTarball/icu/source/i18n /I$(WORKDIR)/UnpackedTarball/icu/source/common - !if "$(WITH_THREADS)" == "ctls" - CFLAGS = $(CFLAGS) /D "XML_THREAD_LOCAL=__declspec(thread)" - !else if "$(WITH_THREADS)" == "posix" + !if "$(WITH_THREADS)" != "no" + CFLAGS = $(CFLAGS) /D "_REENTRANT" + !endif @@ -62,7 +63,9 @@ # The linker and its options. LD = link.exe diff --git a/external/libxml2/libxml2-icu.patch.0 b/external/libxml2/libxml2-icu.patch.0 index 85ce8b3aba2b..84197763f878 100644 --- a/external/libxml2/libxml2-icu.patch.0 +++ b/external/libxml2/libxml2-icu.patch.0 @@ -3,14 +3,14 @@ Find bundled ICU in workdir and use debug .libs when needed diff -up win32/Makefile.msvc.dt win32/Makefile.msvc --- win32/Makefile.msvc.dt 2014-07-18 19:00:23.372103963 +0200 +++ win32/Makefile.msvc 2014-07-18 19:01:39.347982929 +0200 -@@ -42,6 +42,7 @@ +@@ -45,6 +45,7 @@ CPPFLAGS = $(CPPFLAGS) /D "_REENTRANT" CC = cl.exe CFLAGS = /nologo /D "_WINDOWS" /D "_MBCS" /D "NOLIBTOOL" /W3 /wd4244 /wd4267 $(CRUNTIME) CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX) +CFLAGS = $(CFLAGS) /I$(WORKDIR)/UnpackedTarball/icu/source/i18n /I$(WORKDIR)/UnpackedTarball/icu/source/common - !if "$(WITH_THREADS)" == "ctls" - CFLAGS = $(CFLAGS) /D "XML_THREAD_LOCAL=__declspec(thread)" - !else if "$(WITH_THREADS)" == "posix" + !if "$(WITH_THREADS)" != "no" + CFLAGS = $(CFLAGS) /D "_REENTRANT" + !endif @@ -67,6 +68,7 @@ CFLAGS = $(CFLAGS) $(SOLARINC) # The linker and its options. LD = link.exe diff --git a/external/libxslt/ExternalPackage_libxslt.mk b/external/libxslt/ExternalPackage_libxslt.mk index 42b2004728e5..b11ee72bfe1a 100644 --- a/external/libxslt/ExternalPackage_libxslt.mk +++ b/external/libxslt/ExternalPackage_libxslt.mk @@ -25,7 +25,7 @@ $(eval $(call gb_ExternalPackage_add_file,libxslt,$(LIBO_LIB_FOLDER)/libexslt.dl endif else # OS!=WNT $(eval $(call gb_ExternalPackage_add_file,libxslt,$(LIBO_LIB_FOLDER)/libxslt.so.1,libxslt/.libs/libxslt.so.1.1.$(LIBXSLT_VERSION_MICRO))) -$(eval $(call gb_ExternalPackage_add_file,libxslt,$(LIBO_LIB_FOLDER)/libexslt.so.0,libexslt/.libs/libexslt.so.0.8.22)) +$(eval $(call gb_ExternalPackage_add_file,libxslt,$(LIBO_LIB_FOLDER)/libexslt.so.0,libexslt/.libs/libexslt.so.0.8.23)) endif endif # DISABLE_DYNLOADING diff --git a/external/more_fonts/ExternalPackage_agdasima.mk b/external/more_fonts/ExternalPackage_agdasima.mk new file mode 100644 index 000000000000..25867d9ec3e5 --- /dev/null +++ b/external/more_fonts/ExternalPackage_agdasima.mk @@ -0,0 +1,17 @@ +# -*- 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_ExternalPackage_ExternalPackage,fonts_agdasima,font_agdasima)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,fonts_agdasima,$(LIBO_SHARE_FOLDER)/fonts/truetype,\ + Agdasima-Regular.ttf \ + Agdasima-Bold.ttf \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/ExternalPackage_bacasime_antique.mk b/external/more_fonts/ExternalPackage_bacasime_antique.mk new file mode 100644 index 000000000000..892260df7a98 --- /dev/null +++ b/external/more_fonts/ExternalPackage_bacasime_antique.mk @@ -0,0 +1,16 @@ +# -*- 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_ExternalPackage_ExternalPackage,fonts_bacasime_antique,font_bacasime_antique)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,fonts_bacasime_antique,$(LIBO_SHARE_FOLDER)/fonts/truetype,\ + BacasimeAntique-Regular.ttf \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/ExternalPackage_belanosima.mk b/external/more_fonts/ExternalPackage_belanosima.mk new file mode 100644 index 000000000000..71c7a080b394 --- /dev/null +++ b/external/more_fonts/ExternalPackage_belanosima.mk @@ -0,0 +1,18 @@ +# -*- 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_ExternalPackage_ExternalPackage,fonts_belanosima,font_belanosima)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,fonts_belanosima,$(LIBO_SHARE_FOLDER)/fonts/truetype,\ + Belanosima-Regular.ttf \ + Belanosima-SemiBold.ttf \ + Belanosima-Bold.ttf \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/ExternalPackage_caprasimo.mk b/external/more_fonts/ExternalPackage_caprasimo.mk new file mode 100644 index 000000000000..9e347449cb34 --- /dev/null +++ b/external/more_fonts/ExternalPackage_caprasimo.mk @@ -0,0 +1,16 @@ +# -*- 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_ExternalPackage_ExternalPackage,fonts_caprasimo,font_caprasimo)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,fonts_caprasimo,$(LIBO_SHARE_FOLDER)/fonts/truetype,\ + Caprasimo-Regular.ttf \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/ExternalPackage_lugrasimo.mk b/external/more_fonts/ExternalPackage_lugrasimo.mk new file mode 100644 index 000000000000..69084ca701ea --- /dev/null +++ b/external/more_fonts/ExternalPackage_lugrasimo.mk @@ -0,0 +1,16 @@ +# -*- 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_ExternalPackage_ExternalPackage,fonts_lugrasimo,font_lugrasimo)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,fonts_lugrasimo,$(LIBO_SHARE_FOLDER)/fonts/truetype,\ + Lugrasimo-Regular.ttf \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/ExternalPackage_lumanosimo.mk b/external/more_fonts/ExternalPackage_lumanosimo.mk new file mode 100644 index 000000000000..b60ecc8a471c --- /dev/null +++ b/external/more_fonts/ExternalPackage_lumanosimo.mk @@ -0,0 +1,16 @@ +# -*- 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_ExternalPackage_ExternalPackage,fonts_lumanosimo,font_lumanosimo)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,fonts_lumanosimo,$(LIBO_SHARE_FOLDER)/fonts/truetype,\ + Lumanosimo-Regular.ttf \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/ExternalPackage_lunasima.mk b/external/more_fonts/ExternalPackage_lunasima.mk new file mode 100644 index 000000000000..475568f8406b --- /dev/null +++ b/external/more_fonts/ExternalPackage_lunasima.mk @@ -0,0 +1,17 @@ +# -*- 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_ExternalPackage_ExternalPackage,fonts_lunasima,font_lunasima)) + +$(eval $(call gb_ExternalPackage_add_unpacked_files,fonts_lunasima,$(LIBO_SHARE_FOLDER)/fonts/truetype,\ + Lunasima-Regular.ttf \ + Lunasima-Bold.ttf \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/Module_more_fonts.mk b/external/more_fonts/Module_more_fonts.mk index b85f7468528f..b06ac963b379 100644 --- a/external/more_fonts/Module_more_fonts.mk +++ b/external/more_fonts/Module_more_fonts.mk @@ -38,6 +38,13 @@ $(eval $(call gb_Module_add_targets,more_fonts,\ ExternalPackage_noto_serif_lao \ ExternalPackage_reem \ ExternalPackage_scheherazade \ + ExternalPackage_agdasima \ + ExternalPackage_bacasime_antique \ + ExternalPackage_belanosima \ + ExternalPackage_caprasimo \ + ExternalPackage_lugrasimo \ + ExternalPackage_lumanosimo \ + ExternalPackage_lunasima \ UnpackedTarball_alef \ UnpackedTarball_amiri \ UnpackedTarball_gmx \ @@ -66,6 +73,13 @@ $(eval $(call gb_Module_add_targets,more_fonts,\ UnpackedTarball_noto_serif_lao \ UnpackedTarball_reem \ UnpackedTarball_scheherazade \ + UnpackedTarball_agdasima \ + UnpackedTarball_bacasime_antique \ + UnpackedTarball_belanosima \ + UnpackedTarball_caprasimo \ + UnpackedTarball_lugrasimo \ + UnpackedTarball_lumanosimo \ + UnpackedTarball_lunasima \ )) # vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/UnpackedTarball_agdasima.mk b/external/more_fonts/UnpackedTarball_agdasima.mk new file mode 100644 index 000000000000..5c003c18cbfd --- /dev/null +++ b/external/more_fonts/UnpackedTarball_agdasima.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 gb_UnpackedTarball_UnpackedTarball,font_agdasima)) + +$(eval $(call gb_UnpackedTarball_set_tarball,font_agdasima,$(FONT_AGDASIMA_TARBALL),0)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/UnpackedTarball_bacasime_antique.mk b/external/more_fonts/UnpackedTarball_bacasime_antique.mk new file mode 100644 index 000000000000..7533fb16e9a9 --- /dev/null +++ b/external/more_fonts/UnpackedTarball_bacasime_antique.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 gb_UnpackedTarball_UnpackedTarball,font_bacasime_antique)) + +$(eval $(call gb_UnpackedTarball_set_tarball,font_bacasime_antique,$(FONT_BACASIME_ANTIQUE_TARBALL),0)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/UnpackedTarball_belanosima.mk b/external/more_fonts/UnpackedTarball_belanosima.mk new file mode 100644 index 000000000000..e752c46f31c0 --- /dev/null +++ b/external/more_fonts/UnpackedTarball_belanosima.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 gb_UnpackedTarball_UnpackedTarball,font_belanosima)) + +$(eval $(call gb_UnpackedTarball_set_tarball,font_belanosima,$(FONT_BELANOSIMA_TARBALL),0)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/UnpackedTarball_caprasimo.mk b/external/more_fonts/UnpackedTarball_caprasimo.mk new file mode 100644 index 000000000000..41d6d796ced9 --- /dev/null +++ b/external/more_fonts/UnpackedTarball_caprasimo.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 gb_UnpackedTarball_UnpackedTarball,font_caprasimo)) + +$(eval $(call gb_UnpackedTarball_set_tarball,font_caprasimo,$(FONT_CAPRASIMO_TARBALL),0)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/UnpackedTarball_lugrasimo.mk b/external/more_fonts/UnpackedTarball_lugrasimo.mk new file mode 100644 index 000000000000..f3632a0f6ec7 --- /dev/null +++ b/external/more_fonts/UnpackedTarball_lugrasimo.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 gb_UnpackedTarball_UnpackedTarball,font_lugrasimo)) + +$(eval $(call gb_UnpackedTarball_set_tarball,font_lugrasimo,$(FONT_LUGRASIMO_TARBALL),0)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/UnpackedTarball_lumanosimo.mk b/external/more_fonts/UnpackedTarball_lumanosimo.mk new file mode 100644 index 000000000000..350d7ed6cda7 --- /dev/null +++ b/external/more_fonts/UnpackedTarball_lumanosimo.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 gb_UnpackedTarball_UnpackedTarball,font_lumanosimo)) + +$(eval $(call gb_UnpackedTarball_set_tarball,font_lumanosimo,$(FONT_LUMANOSIMO_TARBALL),0)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/UnpackedTarball_lunasima.mk b/external/more_fonts/UnpackedTarball_lunasima.mk new file mode 100644 index 000000000000..0b75460a740e --- /dev/null +++ b/external/more_fonts/UnpackedTarball_lunasima.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 gb_UnpackedTarball_UnpackedTarball,font_lunasima)) + +$(eval $(call gb_UnpackedTarball_set_tarball,font_lunasima,$(FONT_LUNASIMA_TARBALL),0)) + +# vim: set noet sw=4 ts=4: diff --git a/external/more_fonts/fc_local.snippet b/external/more_fonts/fc_local.snippet index cb49929b0a4a..fdc0a627a042 100644 --- a/external/more_fonts/fc_local.snippet +++ b/external/more_fonts/fc_local.snippet @@ -27,3 +27,52 @@ Caladea + + + Agency FB + + Agdasima + + + + + Baskerville Old Face + + Bacasime Antique + + + + + Berlin Sans FB + + Belanosima + + + + + Cooper Black + + Caprasimo + + + + + Lucida Grande + + Lunasima + + + + + Lucida Handwriting + + Lumanosimo + + + + + Lucida Calligraphy + + Lugrasimo + + diff --git a/external/python3/ExternalPackage_python3.mk b/external/python3/ExternalPackage_python3.mk index 775056db220c..2227e4d6246f 100644 --- a/external/python3/ExternalPackage_python3.mk +++ b/external/python3/ExternalPackage_python3.mk @@ -96,7 +96,6 @@ python3_EXTENSION_MODULES= \ LO_lib/_multiprocessing.$(python3_EXTENSION_MODULE_SUFFIX).so \ LO_lib/_opcode.$(python3_EXTENSION_MODULE_SUFFIX).so \ LO_lib/ossaudiodev.$(python3_EXTENSION_MODULE_SUFFIX).so \ - LO_lib/parser.$(python3_EXTENSION_MODULE_SUFFIX).so \ LO_lib/_pickle.$(python3_EXTENSION_MODULE_SUFFIX).so \ LO_lib/_posixshmem.$(python3_EXTENSION_MODULE_SUFFIX).so \ LO_lib/_posixsubprocess.$(python3_EXTENSION_MODULE_SUFFIX).so \ @@ -186,7 +185,6 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p Lib/__future__.py \ Lib/__phello__.foo.py \ Lib/_aix_support.py \ - Lib/_bootlocale.py \ Lib/_bootsubprocess.py \ Lib/_collections_abc.py \ Lib/_compat_pickle.py \ @@ -240,7 +238,6 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p Lib/filecmp.py \ Lib/fileinput.py \ Lib/fnmatch.py \ - Lib/formatter.py \ Lib/fractions.py \ Lib/ftplib.py \ Lib/functools.py \ @@ -325,7 +322,6 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p Lib/struct.py \ Lib/subprocess.py \ Lib/sunau.py \ - Lib/symbol.py \ Lib/symtable.py \ Lib/sysconfig.py \ Lib/tabnanny.py \ @@ -372,6 +368,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p Lib/asyncio/futures.py \ Lib/asyncio/locks.py \ Lib/asyncio/log.py \ + Lib/asyncio/mixins.py \ Lib/asyncio/proactor_events.py \ Lib/asyncio/protocols.py \ Lib/asyncio/queues.py \ @@ -462,7 +459,6 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p Lib/distutils/command/bdist_dumb.py \ Lib/distutils/command/bdist_msi.py \ Lib/distutils/command/bdist_rpm.py \ - Lib/distutils/command/bdist_wininst.py \ Lib/distutils/command/build.py \ Lib/distutils/command/build_clib.py \ Lib/distutils/command/build_ext.py \ @@ -481,15 +477,6 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p Lib/distutils/command/register.py \ Lib/distutils/command/sdist.py \ Lib/distutils/command/upload.py \ - Lib/distutils/command/wininst-10.0.exe \ - Lib/distutils/command/wininst-10.0-amd64.exe \ - Lib/distutils/command/wininst-14.0.exe \ - Lib/distutils/command/wininst-14.0-amd64.exe \ - Lib/distutils/command/wininst-6.0.exe \ - Lib/distutils/command/wininst-7.1.exe \ - Lib/distutils/command/wininst-8.0.exe \ - Lib/distutils/command/wininst-9.0.exe \ - Lib/distutils/command/wininst-9.0-amd64.exe \ )) $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/email,\ @@ -669,16 +656,27 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/importlib,\ Lib/importlib/__init__.py \ + Lib/importlib/_abc.py \ + Lib/importlib/_adapters.py \ Lib/importlib/_bootstrap.py \ Lib/importlib/_bootstrap_external.py \ Lib/importlib/_common.py \ Lib/importlib/abc.py \ Lib/importlib/machinery.py \ - Lib/importlib/metadata.py \ Lib/importlib/resources.py \ Lib/importlib/util.py \ )) +$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/importlib/metadata,\ + Lib/importlib/metadata/__init__.py \ + Lib/importlib/metadata/_adapters.py \ + Lib/importlib/metadata/_collections.py \ + Lib/importlib/metadata/_functools.py \ + Lib/importlib/metadata/_itertools.py \ + Lib/importlib/metadata/_meta.py \ + Lib/importlib/metadata/_text.py \ +)) + $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/json,\ Lib/json/__init__.py \ Lib/json/decoder.py \ diff --git a/external/python3/UnpackedTarball_python3.mk b/external/python3/UnpackedTarball_python3.mk index 5822940e9924..9c766c26dda4 100644 --- a/external/python3/UnpackedTarball_python3.mk +++ b/external/python3/UnpackedTarball_python3.mk @@ -22,16 +22,15 @@ $(eval $(call gb_UnpackedTarball_set_patchflags,python3,--binary)) endif $(eval $(call gb_UnpackedTarball_add_patches,python3,\ + external/python3/distutils_deprecated.patch.0 \ external/python3/i100492-freebsd.patch.1 \ external/python3/python-3.3.0-darwin.patch.1 \ external/python3/python-3.8-msvc-libffi.patch.1 \ external/python3/python-3.7.6-msvc-ssl.patch.1 \ external/python3/python-3.5.4-msvc-disable.patch.1 \ external/python3/ubsan.patch.0 \ - external/python3/py_deprecated_warning.patch.0 \ external/python3/python-3.5.tweak.strip.soabi.patch \ external/python3/darwin.patch.0 \ - external/python3/macos-11.patch.0 \ external/python3/tsan.patch.0 \ external/python3/init-sys-streams-cant-initialize-stdin.patch.0 \ )) diff --git a/external/python3/distutils_deprecated.patch.0 b/external/python3/distutils_deprecated.patch.0 new file mode 100644 index 000000000000..2e9666245ff1 --- /dev/null +++ b/external/python3/distutils_deprecated.patch.0 @@ -0,0 +1,33 @@ +--- Lib/distutils/__init__.py 2024-07-06 14:41:11.881840873 +0200 ++++ Lib/distutils/__init__.py 2024-07-06 14:41:31.725586707 +0200 +@@ -7,14 +7,3 @@ + + setup (...) + """ +- +-import sys +-import warnings +- +-__version__ = sys.version[:sys.version.index(' ')] +- +-_DEPRECATION_MESSAGE = ("The distutils package is deprecated and slated for " +- "removal in Python 3.12. Use setuptools or check " +- "PEP 632 for potential alternatives") +-warnings.warn(_DEPRECATION_MESSAGE, +- DeprecationWarning, 2) +--- Lib/distutils/sysconfig.py 2024-07-06 18:03:30.397986006 +0200 ++++ Lib/distutils/sysconfig.py 2024-07-06 18:03:58.637312653 +0200 +@@ -55,13 +55,6 @@ + if os.name == "nt": + from sysconfig import _fix_pcbuild + +-warnings.warn( +- 'The distutils.sysconfig module is deprecated, use sysconfig instead', +- DeprecationWarning, +- stacklevel=2 +-) +- +- + # Following functions are the same as in sysconfig but with different API + def parse_config_h(fp, g=None): + return sysconfig_parse_config_h(fp, vars=g) diff --git a/external/python3/init-sys-streams-cant-initialize-stdin.patch.0 b/external/python3/init-sys-streams-cant-initialize-stdin.patch.0 index 1a3ae8969479..fa23b27fae84 100644 --- a/external/python3/init-sys-streams-cant-initialize-stdin.patch.0 +++ b/external/python3/init-sys-streams-cant-initialize-stdin.patch.0 @@ -21,7 +21,7 @@ /* stdin is always opened in buffered mode, first because it shouldn't make a difference in common use cases, second because TextIOWrapper depends on the presence of a read1() method which only exists on -@@ -1971,19 +1971,6 @@ +@@ -2335,19 +2335,6 @@ PyStatus res = _PyStatus_OK(); const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp); @@ -38,6 +38,6 @@ - } -#endif - - /* Hack to avoid a nasty recursion issue when Python is invoked - in verbose mode: pre-import the Latin-1 and UTF-8 codecs */ - if ((m = PyImport_ImportModule("encodings.utf_8")) == NULL) { + if (!(iomod = PyImport_ImportModule("io"))) { + goto error; + } diff --git a/external/python3/macos-11.patch.0 b/external/python3/macos-11.patch.0 deleted file mode 100644 index 2c8b419bbdb9..000000000000 --- a/external/python3/macos-11.patch.0 +++ /dev/null @@ -1,34 +0,0 @@ ---- setup.py -+++ setup.py -@@ -655,7 +655,10 @@ - add_dir_to_list(self.compiler.include_dirs, - sysconfig.get_config_var("INCLUDEDIR")) - -- system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib'] -+ if MACOS: -+ system_lib_dirs = ['/usr/lib', macosx_sdk_root()+'/usr/lib'] -+ else: -+ system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib'] - system_include_dirs = ['/usr/include'] - # lib_dirs and inc_dirs are used to search for files; - # if a file is found in one of those directories, it can ---- Modules/_posixsubprocess.c -+++ Modules/_posixsubprocess.c -@@ -30,6 +30,8 @@ - # define SYS_getdents64 __NR_getdents64 - #endif - -+#include -+ - #if defined(__sun) && defined(__SVR4) - /* readdir64 is used to work around Solaris 9 bug 6395699. */ - # define readdir readdir64 -@@ -201,7 +203,7 @@ - #endif - #ifdef _SC_OPEN_MAX - local_max_fd = sysconf(_SC_OPEN_MAX); -- if (local_max_fd == -1) -+ if (local_max_fd == -1 || local_max_fd == LONG_MAX) - #endif - local_max_fd = 256; /* Matches legacy Lib/subprocess.py behavior. */ - return local_max_fd; diff --git a/external/python3/py_deprecated_warning.patch.0 b/external/python3/py_deprecated_warning.patch.0 deleted file mode 100644 index 2deefa6e531f..000000000000 --- a/external/python3/py_deprecated_warning.patch.0 +++ /dev/null @@ -1,20 +0,0 @@ ---- Include/cpython/unicodeobject.h 2024-06-10 10:53:20.049824821 +0200 -+++ Include/cpython/unicodeobject.h 2024-06-10 10:54:50.776970835 +0200 -@@ -548,7 +548,7 @@ - only allowed if u was set to NULL. - - The buffer is copied into the new object. */ --Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( -+/*Py_DEPRECATED(3.3)*/ PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( - const Py_UNICODE *u, /* Unicode buffer */ - Py_ssize_t size /* size of buffer */ - ); -@@ -577,7 +577,7 @@ - Py_UNICODE buffer. - If the wchar_t/Py_UNICODE representation is not yet available, this - function will calculate it. */ --Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( -+/*Py_DEPRECATED(3.3)*/ PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( - PyObject *unicode /* Unicode object */ - ); - diff --git a/external/python3/python-3.3.3-elf-rpath.patch.1 b/external/python3/python-3.3.3-elf-rpath.patch.1 index b248db33ef17..b2e443659cf9 100644 --- a/external/python3/python-3.3.3-elf-rpath.patch.1 +++ b/external/python3/python-3.3.3-elf-rpath.patch.1 @@ -5,10 +5,10 @@ set RPATH (only to be used on ELF platforms) diff -ru python3.orig/Makefile.pre.in python3/Makefile.pre.in --- python3.orig/Makefile.pre.in 2015-07-26 20:29:07.126194320 +0200 +++ python3/Makefile.pre.in 2015-07-26 20:37:21.814227530 +0200 -@@ -589,7 +589,7 @@ +@@ -586,7 +586,7 @@ # Build the interpreter - $(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS) + $(BUILDPYTHON): Programs/python.o $(LIBRARY_DEPS) - $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) + $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) -Wl,-rpath,\$$ORIGIN diff --git a/external/python3/python-3.5.4-msvc-disable.patch.1 b/external/python3/python-3.5.4-msvc-disable.patch.1 index 880e4a9cfb5b..5ba33a7f8ab3 100644 --- a/external/python3/python-3.5.4-msvc-disable.patch.1 +++ b/external/python3/python-3.5.4-msvc-disable.patch.1 @@ -21,7 +21,7 @@ diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ssl", "_ssl.vcxproj", "{C6E20F84-3247-4AD6-B051-B073268F73BA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", "_testcapi.vcxproj", "{6901D91C-6E48-4BB7-9FEC-700C8131DF1D}" -@@ -41,24 +37,14 @@ +@@ -41,22 +37,14 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testimportmultiple", "_testimportmultiple.vcxproj", "{36D0C52C-DF4E-45D0-8BC7-E294C3ABC781}" EndProject @@ -37,8 +37,6 @@ diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyexpat", "pyexpat.vcxproj", "{D06B6426-4762-44CC-8BAD-D79052507F2F}" EndProject --Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bdist_wininst", "..\PC\bdist_wininst\bdist_wininst.vcxproj", "{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}" --EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_hashlib", "_hashlib.vcxproj", "{447F05A8-F581-4CAC-A466-5AC7936E207E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcxproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}" @@ -46,7 +44,7 @@ diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcxproj", "{9E48B300-37D1-11DD-8C41-005056C00008}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python3dll", "python3dll.vcxproj", "{885D4898-D08D-4091-9C40-C700CFE3FC5A}" -@@ -93,8 +79,6 @@ +@@ -93,8 +81,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_queue", "_queue.vcxproj", "{78D80A15-BD8C-44E2-B49E-1F05B0A0A687}" EndProject diff --git a/external/redland/ExternalProject_raptor.mk b/external/redland/ExternalProject_raptor.mk index 5bfab78deba8..192bbade94e7 100644 --- a/external/redland/ExternalProject_raptor.mk +++ b/external/redland/ExternalProject_raptor.mk @@ -29,7 +29,7 @@ $(call gb_ExternalProject_get_state_target,raptor,build): $(if $(SYSBASE),$(if $(filter LINUX SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl))" \ CPPFLAGS="$(if $(SYSBASE),-I$(SYSBASE)/usr/include) $(gb_EMSCRIPTEN_CPPFLAGS)" \ $(gb_RUN_CONFIGURE) ./configure --disable-gtk-doc \ - --enable-parsers="rdfxml ntriples turtle trig guess rss-tag-soup" \ + --enable-parsers="rdfxml ntriples turtle trig guess rss-tag-soup" \ --without-www \ --without-xslt-config \ $(gb_CONFIGURE_PLATFORMS) \ diff --git a/extras/source/autotext/lang/pl/standard/PODDOK/PODDOK.xml b/extras/source/autotext/lang/pl/standard/PODDOK/PODDOK.xml index bdf815bddfa0..e1ebe73869f4 100644 --- a/extras/source/autotext/lang/pl/standard/PODDOK/PODDOK.xml +++ b/extras/source/autotext/lang/pl/standard/PODDOK/PODDOK.xml @@ -1,2 +1,2 @@ -sedecznie dziękujemy za ofertę podjęcia pracy w <field:company>.Niestety nie dysponujemy w tej chwili stanowiskiem pracy odpowiadającym Pańskim życzeniom i kwalifikacjom. Ta sytuacja może się oczywiście w każdej chwili zmienić.Jeśli wyrazi Pani/Pan zgodę, to zatrzymamy Pański list motywacyjny do naszej dyspozycji. W tej sytuacji skontaktujemy się ewentualnie z Panią/z Panem w późniejszym terminie. \ No newline at end of file +serdecznie dziękujemy za ofertę podjęcia pracy w <field:company>.Niestety nie dysponujemy w tej chwili stanowiskiem pracy odpowiadającym Pańskim życzeniom i kwalifikacjom. Ta sytuacja może się oczywiście w każdej chwili zmienić.Jeśli wyrazi Pani/Pan zgodę, to zatrzymamy Pański list motywacyjny do naszej dyspozycji. W tej sytuacji skontaktujemy się ewentualnie z Panią/z Panem w późniejszym terminie. diff --git a/filter/qa/pdf.cxx b/filter/qa/pdf.cxx index 01a77ff56ff3..d9dfc4ef17dd 100644 --- a/filter/qa/pdf.cxx +++ b/filter/qa/pdf.cxx @@ -53,7 +53,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSignCertificateSubjectName) return; uno::Reference xSEInitializer - = xml::crypto::SEInitializer::create(mxComponentContext); + = xml::crypto::SEInitializer::create(m_xContext); uno::Reference xSecurityContext = xSEInitializer->createSecurityContext(OUString()); uno::Reference xSecurityEnvironment diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 17543714ca29..3387c9bb2fd0 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -4531,7 +4531,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) *pType >>= sShapeType; MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType ); - uno::Any* pGluePointType = const_cast(rGeometryItem).GetPropertyValueByName( u"Path"_ustr, u"GluePointType"_ustr ); + const uno::Any* pGluePointType = rGeometryItem.GetPropertyValueByName( u"Path"_ustr, u"GluePointType"_ustr ); sal_Int16 nGluePointType = sal_Int16(); if ( !( pGluePointType && diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx index 38ecf00f5fb8..4af3f7224b3e 100644 --- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx +++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx @@ -98,9 +98,8 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >& if (It != aMediaMap.end() && (It->second >>= aFilterName) && aFilterName == "OpenDocument Text Flat XML") { - PropertyValue EmptyDbFieldHidesPara(u"EmptyDbFieldHidesPara"_ustr, 0, Any(false), - PropertyState::PropertyState_DIRECT_VALUE); - Sequence aSettings{ EmptyDbFieldHidesPara }; + Sequence aSettings{ PropertyValue(u"EmptyDbFieldHidesPara"_ustr, 0, + Any(false), PropertyState::PropertyState_DIRECT_VALUE) }; xInfoSet->setPropertyValue(u"DefaultDocumentSettings"_ustr, Any(aSettings)); } Sequence< Any > aAnys{ Any(xInfoSet) }; diff --git a/framework/qa/cppunit/CheckXTitle.cxx b/framework/qa/cppunit/CheckXTitle.cxx index 175e473fdd91..ce66c7379f02 100644 --- a/framework/qa/cppunit/CheckXTitle.cxx +++ b/framework/qa/cppunit/CheckXTitle.cxx @@ -51,7 +51,7 @@ CPPUNIT_TEST_FIXTURE(Test, checkDefaultTitle) uno::Reference xTitle(xFrame, css::uno::UNO_QUERY); OUString defaultTitle = xTitle->getTitle(); - uno::Reference xParser(util::URLTransformer::create(mxComponentContext)); + uno::Reference xParser(util::URLTransformer::create(m_xContext)); // Open print preview window and get title. util::URL printPreviewURL; @@ -113,7 +113,7 @@ CPPUNIT_TEST_FIXTURE(Test, setTitleAndCheck) uno::Reference xDispatchProvider(xModel->getCurrentController(), uno::UNO_QUERY); - uno::Reference xParser(util::URLTransformer::create(mxComponentContext)); + uno::Reference xParser(util::URLTransformer::create(m_xContext)); util::URL printPreviewURL; printPreviewURL.Complete = u".uno::PrintPreview"_ustr; diff --git a/framework/qa/cppunit/dispatchtest.cxx b/framework/qa/cppunit/dispatchtest.cxx index 42cf7ceed0a4..a6c7ccd20a69 100644 --- a/framework/qa/cppunit/dispatchtest.cxx +++ b/framework/qa/cppunit/dispatchtest.cxx @@ -182,7 +182,7 @@ CPPUNIT_TEST_FIXTURE(DispatchTest, testSfxOfficeDispatchDispose) uno::Reference xFrame(xController->getFrame(), uno::UNO_QUERY); CPPUNIT_ASSERT(xFrame.is()); - uno::Reference xParser(util::URLTransformer::create(mxComponentContext)); + uno::Reference xParser(util::URLTransformer::create(m_xContext)); util::URL url; url.Complete = xModel->getURL() + "#dummy"; xParser->parseStrict(url); diff --git a/framework/qa/cppunit/services.cxx b/framework/qa/cppunit/services.cxx index baf39ffa6a3f..ccc8ae255267 100644 --- a/framework/qa/cppunit/services.cxx +++ b/framework/qa/cppunit/services.cxx @@ -118,7 +118,7 @@ CPPUNIT_TEST_FIXTURE(Test, testURLTransformer_parseSmart) css::util::URL aURL; aURL.Complete = "www.example.com:8080/foo/bar?q=baz#F"; - css::uno::Reference xParser(css::util::URLTransformer::create(mxComponentContext)); + css::uno::Reference xParser(css::util::URLTransformer::create(m_xContext)); CPPUNIT_ASSERT(xParser->parseSmart(aURL, u"http:"_ustr)); CPPUNIT_ASSERT_EQUAL(u"http://www.example.com:8080/foo/bar?q=baz#F"_ustr, aURL.Complete); CPPUNIT_ASSERT_EQUAL(u"http://www.example.com:8080/foo/bar"_ustr, aURL.Main); diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 9e5055ccfd37..309b590dd642 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -279,11 +279,10 @@ Sequence< Sequence< css::beans::PropertyValue > > ToolbarsMenuController::getLay const sal_uInt32 nCount = aToolBarArray.size(); for ( sal_uInt32 i = 0; i < nCount; i++ ) { - Sequence< css::beans::PropertyValue > aTbSeq{ + pSeq[i] = Sequence{ comphelper::makePropertyValue(g_aPropUIName, aToolBarArray[i].aToolBarUIName), comphelper::makePropertyValue(g_aPropResourceURL, aToolBarArray[i].aToolBarResName) }; - pSeq[i] = aTbSeq; } return aSeq; diff --git a/helpcontent2 b/helpcontent2 index 5e39c70b9355..f2bf7ec5f119 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit 5e39c70b93559a266ba9f68344fe8c4c3f2feacf +Subproject commit f2bf7ec5f1192052bc00bdb113885a41e6fb901b diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index 209fb47684f6..d18bd4984814 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -32,7 +32,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testNumberingIdentifi std::vector aFail; uno::Reference xFormatter( - text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); + text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY); // Do not use getSupportedNumberingTypes() because it depends on // configuration whether CTL and CJK numberings are included or not. @@ -83,7 +83,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero) { // 1 -> "01" uno::Reference xFormatter( - text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); + text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY); uno::Sequence aProperties = { comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast(style::NumberingType::ARABIC_ZERO)), @@ -109,7 +109,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero3) { // 10 -> "010" uno::Reference xFormatter( - text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); + text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY); uno::Sequence aProperties = { comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast(style::NumberingType::ARABIC_ZERO3)), @@ -135,7 +135,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero4) { // 100 -> "0100" uno::Reference xFormatter( - text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); + text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY); uno::Sequence aProperties = { comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast(style::NumberingType::ARABIC_ZERO4)), @@ -161,7 +161,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero5) { // 1000 -> "01000" uno::Reference xFormatter( - text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); + text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY); uno::Sequence aProperties = { comphelper::makePropertyValue(u"NumberingType"_ustr, static_cast(style::NumberingType::ARABIC_ZERO5)), @@ -187,7 +187,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanCounting) { // 1 -> "일" uno::Reference xFormatter( - text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); + text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY); uno::Sequence aProperties = { comphelper::makePropertyValue( u"NumberingType"_ustr, static_cast(style::NumberingType::NUMBER_HANGUL_KO)), @@ -222,7 +222,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) { // 1 -> "하나" uno::Reference xFormatter( - text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); + text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY); uno::Sequence aProperties = { comphelper::makePropertyValue( u"NumberingType"_ustr, static_cast(style::NumberingType::NUMBER_LEGAL_KO)), @@ -399,7 +399,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital) { // 1 -> "일" uno::Reference xFormatter( - text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); + text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY); uno::Sequence aProperties = { comphelper::makePropertyValue( u"NumberingType"_ustr, @@ -437,7 +437,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital2) { // 1 -> "一" uno::Reference xFormatter( - text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); + text::DefaultNumberingProvider::create(m_xContext), uno::UNO_QUERY); uno::Sequence aProperties = { comphelper::makePropertyValue( u"NumberingType"_ustr, diff --git a/icon-themes/colibre/res/donate.png b/icon-themes/colibre/res/donate.png index 6c93e5eeb788..570309eb85c8 100644 Binary files a/icon-themes/colibre/res/donate.png and b/icon-themes/colibre/res/donate.png differ diff --git a/include/basegfx/utils/bgradient.hxx b/include/basegfx/utils/bgradient.hxx index 7d360beee429..f54b8763d87f 100644 --- a/include/basegfx/utils/bgradient.hxx +++ b/include/basegfx/utils/bgradient.hxx @@ -16,6 +16,11 @@ #include #include +namespace basegfx +{ +class BColorModifierStack; +} + namespace basegfx { /* MCGR: Provide ColorStop definition @@ -256,6 +261,9 @@ public: // apply Steps as 'hard' color stops void doApplySteps(sal_uInt16 nStepCount); + + // Apply BColorModifierStack changes + void tryToApplyBColorModifierStack(const BColorModifierStack& rBColorModifierStack); }; class BASEGFX_DLLPUBLIC BGradient final diff --git a/include/drawinglayer/processor2d/cairopixelprocessor2d.hxx b/include/drawinglayer/processor2d/cairopixelprocessor2d.hxx index f10ac22fa461..04fd6c7e2d2c 100644 --- a/include/drawinglayer/processor2d/cairopixelprocessor2d.hxx +++ b/include/drawinglayer/processor2d/cairopixelprocessor2d.hxx @@ -33,6 +33,8 @@ class PolygonStrokePrimitive2D; class LineRectanglePrimitive2D; class FilledRectanglePrimitive2D; class SingleLinePrimitive2D; +class FillGradientPrimitive2D; +class FillGraphicPrimitive2D; } namespace drawinglayer::processor2d @@ -73,16 +75,31 @@ class UNLESS_MERGELIBS(DRAWINGLAYER_DLLPUBLIC) CairoPixelProcessor2D final : pub const primitive2d::FilledRectanglePrimitive2D& rFilledRectanglePrimitive2D); void processSingleLinePrimitive2D(const primitive2d::SingleLinePrimitive2D& rSingleLinePrimitive2D); + void processFillGradientPrimitive2D( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D); + void processFillGraphicPrimitive2D( + const primitive2d::FillGraphicPrimitive2D& rFillGraphicPrimitive2D); /* the local processor for BasePrimitive2D-Implementation based primitives, called from the common process()-implementation */ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) override; -protected: - // local protected minimal constructor for usage in derivates, e.g. helpers - CairoPixelProcessor2D(const geometry::ViewInformation2D& rViewInformation); + // helpers for gradients + void processFillGradientPrimitive2D_fallback_decompose( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D); + void processFillGradientPrimitive2D_drawOutputRange( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D); + bool processFillGradientPrimitive2D_isCompletelyBordered( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D); + void processFillGradientPrimitive2D_linear_axial( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D); + void processFillGradientPrimitive2D_radial_elliptical( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D); + void processFillGradientPrimitive2D_square_rect( + const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D); +protected: bool hasError() const { return cairo_status(mpRT) != CAIRO_STATUS_SUCCESS; } void setRenderTarget(cairo_t* mpNewRT) { mpRT = mpNewRT; } bool hasRenderTarget() const { return nullptr != mpRT; } diff --git a/include/editeng/adjustitem.hxx b/include/editeng/adjustitem.hxx index c660598abfc7..006bede075d7 100644 --- a/include/editeng/adjustitem.hxx +++ b/include/editeng/adjustitem.hxx @@ -44,9 +44,6 @@ class EDITENG_DLLPUBLIC SvxAdjustItem final : public SfxEnumItemInterface bool bLastCenter : 1; bool bLastBlock : 1; -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); @@ -54,6 +51,8 @@ public: const sal_uInt16 nId ); // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx index 49f18d6de4b4..0d9ee80281ef 100644 --- a/include/editeng/boxitem.hxx +++ b/include/editeng/boxitem.hxx @@ -73,9 +73,6 @@ class EDITENG_DLLPUBLIC SvxBoxItem final : public SfxPoolItem void tryMigrateComplexColor(SvxBoxItemLine eLine); -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx index 6897e319a3b6..8412634a1157 100644 --- a/include/editeng/brushitem.hxx +++ b/include/editeng/brushitem.hxx @@ -54,9 +54,6 @@ class EDITENG_DLLPUBLIC SvxBrushItem final : public SfxPoolItem void ApplyGraphicTransparency_Impl(); -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); diff --git a/include/editeng/charreliefitem.hxx b/include/editeng/charreliefitem.hxx index 910adcf11e24..78b57fa7df00 100644 --- a/include/editeng/charreliefitem.hxx +++ b/include/editeng/charreliefitem.hxx @@ -33,9 +33,6 @@ class EDITENG_DLLPUBLIC SvxCharReliefItem final : public SfxEnumItem { -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); diff --git a/include/editeng/charrotateitem.hxx b/include/editeng/charrotateitem.hxx index d8a773065575..42e4d5f16467 100644 --- a/include/editeng/charrotateitem.hxx +++ b/include/editeng/charrotateitem.hxx @@ -35,7 +35,7 @@ class EDITENG_DLLPUBLIC SvxTextRotateItem : public SfxUInt16Item { public: - SvxTextRotateItem(Degree10 nValue, TypedWhichId nId); + SvxTextRotateItem(Degree10 nValue, TypedWhichId nId, SfxItemType eItemType = SfxItemType::SvxTextRotateItemType); virtual SvxTextRotateItem* Clone(SfxItemPool *pPool = nullptr) const override; diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index e70b27b577e5..220d7964ad2c 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -43,6 +43,8 @@ public: virtual ~SvxColorItem() override; // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==(const SfxPoolItem& rPoolItem) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; @@ -60,6 +62,7 @@ public: } void SetValue(const Color& rNewColor) { + ASSERT_CHANGE_REFCOUNTED_ITEM; mColor = rNewColor; } @@ -69,11 +72,12 @@ public: } void setColor(const Color& rNewColor) { + ASSERT_CHANGE_REFCOUNTED_ITEM; mColor = rNewColor; } model::ComplexColor const& getComplexColor() const { return maComplexColor; } - void setComplexColor(model::ComplexColor const& rComplexColor) { maComplexColor = rComplexColor; } + void setComplexColor(model::ComplexColor const& rComplexColor) { ASSERT_CHANGE_REFCOUNTED_ITEM; maComplexColor = rComplexColor; } void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/include/editeng/crossedoutitem.hxx b/include/editeng/crossedoutitem.hxx index 259eb412e1e1..5d8b18fe2650 100644 --- a/include/editeng/crossedoutitem.hxx +++ b/include/editeng/crossedoutitem.hxx @@ -31,9 +31,6 @@ class EDITENG_DLLPUBLIC SvxCrossedOutItem final : public SfxEnumItem { -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); diff --git a/include/editeng/emphasismarkitem.hxx b/include/editeng/emphasismarkitem.hxx index 94d48e4b8d9c..e0fd74cf4400 100644 --- a/include/editeng/emphasismarkitem.hxx +++ b/include/editeng/emphasismarkitem.hxx @@ -32,9 +32,6 @@ class EDITENG_DLLPUBLIC SvxEmphasisMarkItem final : public SfxUInt16Item { -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); diff --git a/include/editeng/escapementitem.hxx b/include/editeng/escapementitem.hxx index d9d4f7d3006f..87afbcdd9e88 100644 --- a/include/editeng/escapementitem.hxx +++ b/include/editeng/escapementitem.hxx @@ -51,6 +51,8 @@ public: const sal_uInt16 nId ); // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, @@ -64,6 +66,7 @@ public: void SetEscapement( const SvxEscapement eNew ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; if( SvxEscapement::Off == eNew ) { nEsc = 0; @@ -80,11 +83,11 @@ public: } SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); } - short &GetEsc() { return nEsc; } short GetEsc() const { return nEsc; } + void SetEsc(short nNewEsc) { ASSERT_CHANGE_REFCOUNTED_ITEM; nEsc = nNewEsc; } - sal_uInt8 &GetProportionalHeight() { return nProp; } - sal_uInt8 GetProportionalHeight() const { return nProp; } + sal_uInt8 GetProportionalHeight() const { return nProp; } + void SetProportionalHeight(sal_uInt8 n) { ASSERT_CHANGE_REFCOUNTED_ITEM; nProp = n; } virtual sal_uInt16 GetValueCount() const override; static OUString GetValueTextByPos( sal_uInt16 nPos ); diff --git a/include/editeng/fhgtitem.hxx b/include/editeng/fhgtitem.hxx index bdde8c6f0afd..342419e4e359 100644 --- a/include/editeng/fhgtitem.hxx +++ b/include/editeng/fhgtitem.hxx @@ -44,9 +44,6 @@ class EDITENG_DLLPUBLIC SvxFontHeightItem final : public SfxPoolItem friend void Create_legacy_direct_set(SvxFontHeightItem& rItem, sal_uInt32 nH, sal_uInt16 nP, MapUnit eP); void legacy_direct_set(sal_uInt32 nH, sal_uInt16 nP, MapUnit eP) { nHeight = nH; nProp = nP; ePropUnit = eP; } -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); @@ -54,6 +51,8 @@ public: const sal_uInt16 nId ); // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/editeng/fontitem.hxx b/include/editeng/fontitem.hxx index f892178c521e..82d19ca40490 100644 --- a/include/editeng/fontitem.hxx +++ b/include/editeng/fontitem.hxx @@ -34,9 +34,6 @@ class EDITENG_DLLPUBLIC SvxFontItem final : public SfxPoolItem FontPitch ePitch; rtl_TextEncoding eTextEncoding; -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); @@ -48,6 +45,8 @@ public: const sal_uInt16 nId); // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==(const SfxPoolItem& rItem) const override; virtual SvxFontItem* Clone(SfxItemPool *pPool = nullptr) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; diff --git a/include/editeng/frmdiritem.hxx b/include/editeng/frmdiritem.hxx index e2bba96b8974..7bb6dc09950d 100644 --- a/include/editeng/frmdiritem.hxx +++ b/include/editeng/frmdiritem.hxx @@ -30,9 +30,6 @@ class EDITENG_DLLPUBLIC SvxFrameDirectionItem final : public SfxEnumItem { -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: SvxFrameDirectionItem( SvxFrameDirection nValue, sal_uInt16 nWhich ); virtual ~SvxFrameDirectionItem() override; diff --git a/include/editeng/langitem.hxx b/include/editeng/langitem.hxx index 4ebef0837a6c..c84aebf3b33c 100644 --- a/include/editeng/langitem.hxx +++ b/include/editeng/langitem.hxx @@ -40,9 +40,6 @@ protected: class EDITENG_DLLPUBLIC SvxLanguageItem final : public SvxLanguageItem_Base { -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx index edab3ef23d73..998ea71fbb84 100644 --- a/include/editeng/lrspitem.hxx +++ b/include/editeng/lrspitem.hxx @@ -68,6 +68,8 @@ public: SvxLeftMarginItem(SvxLeftMarginItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==(const SfxPoolItem&) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; @@ -110,6 +112,8 @@ public: SvxTextLeftMarginItem(SvxTextLeftMarginItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==(const SfxPoolItem&) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; @@ -145,17 +149,19 @@ public: void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp = 100); short GetTextFirstLineOffset() const { return m_nFirstLineOffset; } void SetPropTextFirstLineOffset(const sal_uInt16 nProp) - { m_nPropFirstLineOffset = nProp; } + { ASSERT_CHANGE_REFCOUNTED_ITEM; m_nPropFirstLineOffset = nProp; } sal_uInt16 GetPropTextFirstLineOffset() const { return m_nPropFirstLineOffset; } void SetTextFirstLineOffsetValue(const short nValue) - { m_nFirstLineOffset = nValue; } + { ASSERT_CHANGE_REFCOUNTED_ITEM; m_nFirstLineOffset = nValue; } explicit SvxFirstLineIndentItem(const sal_uInt16 nId); SvxFirstLineIndentItem(const short nOffset, const sal_uInt16 nId); SvxFirstLineIndentItem(SvxFirstLineIndentItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==(const SfxPoolItem&) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; @@ -195,6 +201,8 @@ public: SvxRightMarginItem(SvxRightMarginItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==(const SfxPoolItem&) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; @@ -221,13 +229,15 @@ private: tools::Long m_nGutterMargin = 0; public: - void SetGutterMargin(const tools::Long nGutterMargin) { m_nGutterMargin = nGutterMargin; } + void SetGutterMargin(const tools::Long nGutterMargin) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_nGutterMargin = nGutterMargin; } tools::Long GetGutterMargin() const { return m_nGutterMargin; } explicit SvxGutterLeftMarginItem(const sal_uInt16 nId); SvxGutterLeftMarginItem(SvxGutterLeftMarginItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==(const SfxPoolItem&) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; @@ -260,6 +270,8 @@ public: SvxGutterRightMarginItem(SvxGutterRightMarginItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==(const SfxPoolItem&) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; @@ -305,6 +317,8 @@ public: SvxLRSpaceItem(SvxLRSpaceItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; @@ -326,15 +340,15 @@ public: // Query/direct setting of the absolute values tools::Long GetLeft() const { return nLeftMargin; } tools::Long GetRight() const { return nRightMargin;} - void SetLeftValue( const tools::Long nL ) { assert(nFirstLineOffset == 0); nLeftMargin = nL; } - void SetRightValue( const tools::Long nR ) { nRightMargin = nR; } + void SetLeftValue( const tools::Long nL ) { ASSERT_CHANGE_REFCOUNTED_ITEM; assert(nFirstLineOffset == 0); nLeftMargin = nL; } + void SetRightValue( const tools::Long nR ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nRightMargin = nR; } bool IsAutoFirst() const { return bAutoFirst; } - void SetAutoFirst( const bool bNew ) { bAutoFirst = bNew; } + void SetAutoFirst( const bool bNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; bAutoFirst = bNew; } bool IsExplicitZeroMarginValRight() const { return bExplicitZeroMarginValRight; } bool IsExplicitZeroMarginValLeft() const { return bExplicitZeroMarginValLeft; } - void SetExplicitZeroMarginValRight( const bool eR ) { bExplicitZeroMarginValRight = eR; } - void SetExplicitZeroMarginValLeft( const bool eL ) { bExplicitZeroMarginValLeft = eL; } + void SetExplicitZeroMarginValRight( const bool eR ) { ASSERT_CHANGE_REFCOUNTED_ITEM; bExplicitZeroMarginValRight = eR; } + void SetExplicitZeroMarginValLeft( const bool eL ) { ASSERT_CHANGE_REFCOUNTED_ITEM; bExplicitZeroMarginValLeft = eL; } sal_uInt16 GetPropLeft() const { return nPropLeftMargin; } sal_uInt16 GetPropRight() const { return nPropRightMargin;} @@ -345,14 +359,14 @@ public: void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp = 100); short GetTextFirstLineOffset() const { return nFirstLineOffset; } void SetPropTextFirstLineOffset( const sal_uInt16 nProp ) - { nPropFirstLineOffset = nProp; } + { ASSERT_CHANGE_REFCOUNTED_ITEM; nPropFirstLineOffset = nProp; } sal_uInt16 GetPropTextFirstLineOffset() const { return nPropFirstLineOffset; } void SetTextFirstLineOffsetValue( const short nValue ) - { nFirstLineOffset = nValue; } - void SetGutterMargin(const tools::Long nGutterMargin) { m_nGutterMargin = nGutterMargin; } + { ASSERT_CHANGE_REFCOUNTED_ITEM; nFirstLineOffset = nValue; } + void SetGutterMargin(const tools::Long nGutterMargin) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_nGutterMargin = nGutterMargin; } tools::Long GetGutterMargin() const { return m_nGutterMargin; } - void SetRightGutterMargin(const tools::Long nRightGutterMargin) { m_nRightGutterMargin = nRightGutterMargin; } + void SetRightGutterMargin(const tools::Long nRightGutterMargin) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_nRightGutterMargin = nRightGutterMargin; } tools::Long GetRightGutterMargin() const { return m_nRightGutterMargin; } void dumpAsXml(xmlTextWriterPtr pWriter) const override; diff --git a/include/editeng/opaqitem.hxx b/include/editeng/opaqitem.hxx index d38747747c55..112a62e6aaef 100644 --- a/include/editeng/opaqitem.hxx +++ b/include/editeng/opaqitem.hxx @@ -45,7 +45,7 @@ public: }; inline SvxOpaqueItem::SvxOpaqueItem( const sal_uInt16 nId, const bool bOpa ) - : SfxBoolItem( nId, bOpa ) + : SfxBoolItem( nId, bOpa, SfxItemType::SvxOpaqueItemType ) {} #endif diff --git a/include/editeng/pbinitem.hxx b/include/editeng/pbinitem.hxx index d6bf7229b676..a4fadccb7ef3 100644 --- a/include/editeng/pbinitem.hxx +++ b/include/editeng/pbinitem.hxx @@ -50,7 +50,7 @@ public: }; inline SvxPaperBinItem::SvxPaperBinItem( const sal_uInt16 nId, const sal_uInt8 nT ) - : SfxByteItem( nId, nT ) + : SfxByteItem( nId, nT, SfxItemType::SvxPaperBinItemType ) {} #endif diff --git a/include/editeng/postitem.hxx b/include/editeng/postitem.hxx index 392a9627feb6..93ed44b6b794 100644 --- a/include/editeng/postitem.hxx +++ b/include/editeng/postitem.hxx @@ -32,9 +32,6 @@ class EDITENG_DLLPUBLIC SvxPostureItem final : public SfxEnumItem { -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); diff --git a/include/editeng/prntitem.hxx b/include/editeng/prntitem.hxx index 8f0e6a8fc855..34f490b46084 100644 --- a/include/editeng/prntitem.hxx +++ b/include/editeng/prntitem.hxx @@ -47,7 +47,7 @@ public: }; inline SvxPrintItem::SvxPrintItem( const sal_uInt16 nId, const bool bPrt ) - : SfxBoolItem( nId, bPrt ) + : SfxBoolItem( nId, bPrt, SfxItemType::SvxPrintItemType ) {} #endif diff --git a/include/editeng/protitem.hxx b/include/editeng/protitem.hxx index 0c3b473700d1..18ad76fcf3ac 100644 --- a/include/editeng/protitem.hxx +++ b/include/editeng/protitem.hxx @@ -43,6 +43,8 @@ public: SvxProtectItem(SvxProtectItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, @@ -56,9 +58,9 @@ public: bool IsContentProtected() const { return bCntnt; } bool IsSizeProtected() const { return bSize; } bool IsPosProtected() const { return bPos; } - void SetContentProtect( bool bNew ) { bCntnt = bNew; } - void SetSizeProtect ( bool bNew ) { bSize = bNew; } - void SetPosProtect ( bool bNew ) { bPos = bNew; } + void SetContentProtect( bool bNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; bCntnt = bNew; } + void SetSizeProtect ( bool bNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; bSize = bNew; } + void SetPosProtect ( bool bNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; bPos = bNew; } virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/editeng/rsiditem.hxx b/include/editeng/rsiditem.hxx index 64b4c1cc2b1f..5c91006dcb9b 100644 --- a/include/editeng/rsiditem.hxx +++ b/include/editeng/rsiditem.hxx @@ -19,7 +19,7 @@ class EDITENG_DLLPUBLIC SvxRsidItem final : public SfxUInt32Item { public: - SvxRsidItem( sal_uInt32 nRsid, sal_uInt16 nId ) : SfxUInt32Item( nId, nRsid ) {} + SvxRsidItem( sal_uInt32 nRsid, sal_uInt16 nId ) : SfxUInt32Item( nId, nRsid, SfxItemType::SvxRsidItemType ) {} virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, @@ -33,8 +33,6 @@ public: void dumpAsXml(xmlTextWriterPtr pWriter) const override; -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; }; #endif // INCLUDED_EDITENG_RSIDITEM_HXX diff --git a/include/editeng/shaditem.hxx b/include/editeng/shaditem.hxx index bed848215985..9d15e5ea56e5 100644 --- a/include/editeng/shaditem.hxx +++ b/include/editeng/shaditem.hxx @@ -48,6 +48,8 @@ public: const SvxShadowLocation eLoc = SvxShadowLocation::NONE ); // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; @@ -62,13 +64,13 @@ public: virtual bool HasMetrics() const override; const Color& GetColor() const { return aShadowColor;} - void SetColor( const Color &rNew ) { aShadowColor = rNew; } + void SetColor( const Color &rNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; aShadowColor = rNew; } sal_uInt16 GetWidth() const { return nWidth; } SvxShadowLocation GetLocation() const { return eLocation; } - void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; } - void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; } + void SetWidth( sal_uInt16 nNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nWidth = nNew; } + void SetLocation( SvxShadowLocation eNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; eLocation = eNew; } // Calculate width of the shadow on the page. sal_uInt16 CalcShadowSpace( SvxShadowItemSide nShadow ) const; diff --git a/include/editeng/sizeitem.hxx b/include/editeng/sizeitem.hxx index 4e20699f1cef..7e10873496f3 100644 --- a/include/editeng/sizeitem.hxx +++ b/include/editeng/sizeitem.hxx @@ -39,9 +39,11 @@ public: static SfxPoolItem* CreateDefault(); explicit SvxSizeItem( const sal_uInt16 nId ); - SvxSizeItem( const sal_uInt16 nId, const Size& rSize); + SvxSizeItem( const sal_uInt16 nId, const Size& rSize, SfxItemType eItemType = SfxItemType::SvxSizeItemType); // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/editeng/udlnitem.hxx b/include/editeng/udlnitem.hxx index b140c47b8bc5..47c8fea73ca7 100644 --- a/include/editeng/udlnitem.hxx +++ b/include/editeng/udlnitem.hxx @@ -35,7 +35,8 @@ class EDITENG_DLLPUBLIC SvxTextLineItem : public SfxEnumItem public: SvxTextLineItem( const FontLineStyle eSt, - const sal_uInt16 nId ); + const sal_uInt16 nId, + SfxItemType eItemType = SfxItemType::SvxTextLineItemType); // "pure virtual Methods" from SfxPoolItem virtual bool GetPresentation( SfxItemPresentation ePres, @@ -87,9 +88,6 @@ public: class EDITENG_DLLPUBLIC SvxUnderlineItem final : public SvxTextLineItem { -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); @@ -106,9 +104,6 @@ public: class EDITENG_DLLPUBLIC SvxOverlineItem final : public SvxTextLineItem { -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx index b0131ab9904d..5c26ce2eb6a8 100644 --- a/include/editeng/ulspitem.hxx +++ b/include/editeng/ulspitem.hxx @@ -46,6 +46,8 @@ public: const sal_uInt16 nId ); // "pure virtual Methods" from SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; @@ -63,11 +65,11 @@ public: inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 ); inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 ); - void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; } - void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; } - void SetContextValue( const bool bC ) { bContext = bC; } - void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; } - void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; } + void SetUpperValue( const sal_uInt16 nU ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nUpper = nU; } + void SetLowerValue( const sal_uInt16 nL ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nLower = nL; } + void SetContextValue( const bool bC ) { ASSERT_CHANGE_REFCOUNTED_ITEM; bContext = bC; } + void SetPropUpper( const sal_uInt16 nU ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nPropUpper = nU; } + void SetPropLower( const sal_uInt16 nL ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nPropLower = nL; } sal_uInt16 GetUpper() const { return nUpper; } sal_uInt16 GetLower() const { return nLower; } diff --git a/include/editeng/wghtitem.hxx b/include/editeng/wghtitem.hxx index f8beb7c7a62f..121cfcf318a6 100644 --- a/include/editeng/wghtitem.hxx +++ b/include/editeng/wghtitem.hxx @@ -32,9 +32,6 @@ class EDITENG_DLLPUBLIC SvxWeightItem final : public SfxEnumItem { -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 894d42ca89c3..dbde9abd4bc7 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -209,7 +209,7 @@ public: const basegfx::B2DHomMatrix& aTransformation, const FillProperties& rShapeOrParentShapeFillProps, ShapeIdMap* pShapeMap = nullptr, - oox::drawingml::ShapePtr pParentGroupShape = nullptr); + const oox::drawingml::ShapePtr& pParentGroupShape = nullptr); const css::uno::Reference< css::drawing::XShape > & getXShape() const { return mxShape; } @@ -296,7 +296,7 @@ protected: bool bDoNotInsertEmptyTextBody, basegfx::B2DHomMatrix& aTransformation, const FillProperties& rShapeOrParentShapeFillProps, - oox::drawingml::ShapePtr pParentGroupShape = nullptr + const oox::drawingml::ShapePtr& pParentGroupShape = nullptr ); SAL_DLLPRIVATE void addChildren( diff --git a/include/oox/ppt/comments.hxx b/include/oox/ppt/comments.hxx index 10cad1270a1c..fb858e83d021 100644 --- a/include/oox/ppt/comments.hxx +++ b/include/oox/ppt/comments.hxx @@ -97,6 +97,7 @@ class Comment return y.toInt32(); } OUString getAuthor ( const CommentAuthorList& list ); + OUString getInitials ( const CommentAuthorList& list ); }; class CommentList diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx index 0112a67913e7..88d73d0da3ba 100644 --- a/include/oox/ppt/slidepersist.hxx +++ b/include/oox/ppt/slidepersist.hxx @@ -125,7 +125,7 @@ public: CommentList& getCommentsList() { return maCommentsList; } CommentAuthorList& getCommentAuthors() { return maCommentAuthors; } - void createConnectorShapeConnection(); + void createConnectorShapeConnection(oox::drawingml::ShapePtr& pConnector); private: OUString maPath; @@ -158,8 +158,6 @@ private: // slide comments CommentList maCommentsList; CommentAuthorList maCommentAuthors; - - std::vector maConnectorShapeId; }; } diff --git a/include/svl/cintitem.hxx b/include/svl/cintitem.hxx index d9c0f273f260..c10be9ccb8f9 100644 --- a/include/svl/cintitem.hxx +++ b/include/svl/cintitem.hxx @@ -33,6 +33,8 @@ public: CntByteItem(sal_uInt16 which, sal_uInt8 nTheValue, SfxItemType eItemType = SfxItemType::CntByteItemType): SfxPoolItem(which, eItemType), m_nValue(nTheValue) {} + virtual bool isHashable() const override final { return true; } + virtual size_t hashCode() const override final { return m_nValue; } virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, @@ -64,6 +66,8 @@ public: SfxPoolItem(which, eItemType), m_nValue(nTheValue) {} + virtual bool isHashable() const override final { return true; } + virtual size_t hashCode() const override final { return m_nValue; } virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, @@ -96,6 +100,8 @@ public: SfxPoolItem(which, eItemType), m_nValue(nTheValue) {} + virtual bool isHashable() const override final { return true; } + virtual size_t hashCode() const override final { return m_nValue; } virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, @@ -128,6 +134,8 @@ public: SfxPoolItem(which, eItemType), m_nValue(nTheValue) {} + virtual bool isHashable() const override final { return true; } + virtual size_t hashCode() const override final { return m_nValue; } virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, diff --git a/include/svl/custritm.hxx b/include/svl/custritm.hxx index 118fd0963f15..309c0ebfe48a 100644 --- a/include/svl/custritm.hxx +++ b/include/svl/custritm.hxx @@ -39,6 +39,8 @@ public: SfxPoolItem(which, eItemType), m_aValue(std::move(aTheValue)) {} + // not all of the subclasses of this are hashable, so we only define the shared hashCode function here + virtual size_t hashCode() const override; virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx index f6fb22bfeb7d..141e292ceaad 100644 --- a/include/svl/eitem.hxx +++ b/include/svl/eitem.hxx @@ -62,6 +62,16 @@ public: return SfxEnumItemInterface::operator==(other) && m_nValue == static_cast &>(other).m_nValue; } + + virtual bool isHashable() const override final + { + return true; + } + + virtual size_t hashCode() const override final + { + return GetEnumValue(); + } }; class SVL_DLLPUBLIC SfxBoolItem @@ -69,9 +79,6 @@ class SVL_DLLPUBLIC SfxBoolItem { bool m_bValue; -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; - public: static SfxPoolItem* CreateDefault(); @@ -81,6 +88,9 @@ public: , m_bValue(bValue) { } + virtual bool isHashable() const override; + virtual size_t hashCode() const override; + bool GetValue() const { return m_bValue; } void SetValue(bool const bTheValue); diff --git a/include/svl/flagitem.hxx b/include/svl/flagitem.hxx index ac32bab18ca9..f9967af78b9c 100644 --- a/include/svl/flagitem.hxx +++ b/include/svl/flagitem.hxx @@ -36,6 +36,8 @@ public: virtual sal_uInt8 GetFlagCount() const; + virtual bool isHashable() const override { return true; } + virtual size_t hashCode() const override final { return nVal; } virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxFlagItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/include/svl/globalnameitem.hxx b/include/svl/globalnameitem.hxx index edbb56273232..36824d3a39e4 100644 --- a/include/svl/globalnameitem.hxx +++ b/include/svl/globalnameitem.hxx @@ -39,6 +39,8 @@ public: SfxGlobalNameItem & operator =(SfxGlobalNameItem const &) = delete; // due to SfxPoolItem SfxGlobalNameItem & operator =(SfxGlobalNameItem &&) = delete; // due to SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxGlobalNameItem* Clone( SfxItemPool *pPool = nullptr ) const override; const SvGlobalName& GetValue() const { return m_aName; } diff --git a/include/svl/grabbagitem.hxx b/include/svl/grabbagitem.hxx index 77a619aec4c1..d14bde539620 100644 --- a/include/svl/grabbagitem.hxx +++ b/include/svl/grabbagitem.hxx @@ -33,8 +33,14 @@ public: const std::map& GetGrabBag() const { return m_aMap; } - std::map& GetGrabBag() { return m_aMap; } + std::map& GetGrabBag() + { + ASSERT_CHANGE_REFCOUNTED_ITEM; + return m_aMap; + } + virtual bool isHashable() const override; + virtual size_t hashCode() const override; bool operator==(const SfxPoolItem& rItem) const override; SfxGrabBagItem* Clone(SfxItemPool* pPool = nullptr) const override; diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index 3dd3db1763ea..fe636a89ec55 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -166,6 +166,7 @@ enum class SfxHintId { SwRedlineDelText, SwRedlineUnDelText, SwMoveText, + SwRedlineContentAtPos, ThisIsAnSdrHint, ThisIsAnSfxEventHint diff --git a/include/svl/ilstitem.hxx b/include/svl/ilstitem.hxx index bb49d18c9dbb..53f2a6204b64 100644 --- a/include/svl/ilstitem.hxx +++ b/include/svl/ilstitem.hxx @@ -44,6 +44,8 @@ public: const std::vector< sal_Int32 >& GetList() const { return m_aList; } + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxIntegerListItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual bool PutValue ( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/svl/imageitm.hxx b/include/svl/imageitm.hxx index f06eb7fd6902..d5c871ed8c4c 100644 --- a/include/svl/imageitm.hxx +++ b/include/svl/imageitm.hxx @@ -34,13 +34,15 @@ public: virtual ~SfxImageItem() override; virtual SfxImageItem* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; - void SetRotation( Degree10 nValue ) { mnAngle = nValue; } + void SetRotation( Degree10 nValue ) { ASSERT_CHANGE_REFCOUNTED_ITEM; mnAngle = nValue; } Degree10 GetRotation() const { return mnAngle; } - void SetMirrored( bool bSet ) { mbMirrored = bSet; } + void SetMirrored( bool bSet ) { ASSERT_CHANGE_REFCOUNTED_ITEM; mbMirrored = bSet; } bool IsMirrored() const { return mbMirrored; } private: diff --git a/include/svl/int64item.hxx b/include/svl/int64item.hxx index 70a502c645a8..0dd33e0a735c 100644 --- a/include/svl/int64item.hxx +++ b/include/svl/int64item.hxx @@ -27,6 +27,8 @@ public: SfxInt64Item & operator =(SfxInt64Item const &) = delete; // due to SfxPoolItem; SfxInt64Item & operator =(SfxInt64Item &&) = delete; // due to SfxPoolItem + virtual bool isHashable() const override { return true; } + virtual size_t hashCode() const override { return mnValue; } virtual bool operator== ( const SfxPoolItem& rItem ) const override; virtual bool GetPresentation( diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx index 0fff3142cdc6..82fa80f12d09 100644 --- a/include/svl/intitem.hxx +++ b/include/svl/intitem.hxx @@ -50,6 +50,8 @@ public: SfxPoolItem(which, eItemType), m_nValue(nTheValue) {} + virtual bool isHashable() const override { return true; } + virtual size_t hashCode() const override { return m_nValue; } virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, @@ -113,8 +115,8 @@ class SVL_DLLPUBLIC SfxUInt32Item: public CntUInt32Item public: static SfxPoolItem* CreateDefault(); - explicit SfxUInt32Item(sal_uInt16 which = 0, sal_uInt32 nValue = 0): - CntUInt32Item(which, nValue) {} + explicit SfxUInt32Item(sal_uInt16 which = 0, sal_uInt32 nValue = 0, SfxItemType eItemType = SfxItemType::SfxUInt32ItemType): + CntUInt32Item(which, nValue, eItemType) {} virtual SfxUInt32Item* Clone(SfxItemPool * = nullptr) const override { return new SfxUInt32Item(*this); } diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx index b1fc8280736c..197199689d54 100644 --- a/include/svl/poolitem.hxx +++ b/include/svl/poolitem.hxx @@ -127,13 +127,18 @@ enum class SfxItemType : sal_uInt16 { SbxItemType, ScCondFormatItemType, ScConsolidateItemType, + ScHyphenateCellType, + ScIndentItemType, ScInputStatusItemType, + ScLineBreakCellType, ScMergeAttrType, ScPageHFItemType, ScPageScaleToItemType, ScPivotItemType, ScProtectionAttrType, ScQueryItemType, + ScRotateValueItemType, + ScShrinkToFitCellType, ScSolveItemType, ScSortItemType, ScSubTotalItemType, @@ -144,39 +149,103 @@ enum class SfxItemType : sal_uInt16 { ScTpPrintItemType, ScTpViewItemType, ScUserListItemType, + ScVerticalStackCellType, ScViewObjectModeItemType, SdOptionsMiscItemType, SdOptionsPrintItemType, SdOptionsSnapItemType, + SdrAllPositionXItemType, + SdrAllPositionYItemType, + SdrAllSizeHeightItemType, + SdrAllSizeWidthItemType, SdrAngleItemType, + SdrCaptionAngleItemType, + SdrCaptionGapItemType, + SdrCaptionEscAbsItemType, SdrCaptionEscDirItemType, - SdrCaptionTypeItem, + SdrCaptionEscRelItemType, + SdrCaptionEscIsRelItemType, + SdrCaptionFitLineLenItemType, + SdrCaptionLineLenItemType, SdrCaptionTypeItemType, SdrCircKindItemType, SdrCustomShapeGeometryItemType, SdrEdgeKindItemType, + SdrEdgeLineDeltaCountItemType, + SdrEdgeNode1GlueDistItemType, + SdrEdgeNode1HorzDistItemType, + SdrEdgeNode1VertDistItemType, + SdrEdgeNode2GlueDistItemType, + SdrEdgeNode2HorzDistItemType, + SdrEdgeNode2VertDistItemType, SdrFractionItemType, + SdrGrafBlueItemType, + SdrGrafContrastItemType, + SdrGrafGamma100ItemType, + SdrGrafGreenItemType, + SdrGrafLuminanceItemType, + SdrGrafRedItemType, + SdrGrafInvertItemType, SdrGrafModeItem_Base, + SdrGrafTransparenceItemType, SdrLayerIdItemType, SdrLayerNameItemType, + SdrLogicSizeHeightItemType, + SdrLogicSizeWidthItemType, + SdrMeasureBelowRefEdgeItemType, + SdrMeasureDecimalPlacesItemType, SdrMeasureFormatStringItemType, SdrMeasureKindItemType, + SdrMeasureOverhangItemType, SdrMeasureScaleItemType, SdrMeasureTextAutoAngleItemType, SdrMeasureTextAutoAngleViewItemType, + SdrMeasureTextFixedAngleItemType, SdrMeasureTextHPosItemType, + SdrMeasureTextIsFixedAngleItemType, + SdrMeasureTextRota90ItemType, + SdrMeasureTextUpsideDownItemType, SdrMeasureTextVPosItemType, SdrMeasureUnitItemType, + SdrMetricItemType, + SdrMoveXItemType, + SdrMoveYItemType, + SdrObjPrintableItemType, + SdrObjVisibleItemType, + SdrOnePositionXItemType, + SdrOnePositionYItemType, + SdrOneSizeHeightItemType, + SdrOneSizeWidthItemType, + SdrOnOffItemType, + SdrPercentItemType, SdrResizeXAllItemType, SdrResizeXOneItemType, SdrResizeYAllItemType, SdrResizeYOneItemType, + SdrRotateAllItemType, + SdrRotateOneItemType, SdrScaleItemType, + SdrShearAngleItemType, + SdrSignedPercentItemType, + SdrTextAniAmountItemType, + SdrTextAniCountItemType, + SdrTextAniDelayItemType, SdrTextAniDirectionItemType, + SdrTextAniStartInsideItemType, + SdrTextAniStopInsideItemType, SdrTextAniKindItemType, SdrTextFitToSizeTypeItemType, + SdrTextFixedCellHeightItemType, SdrTextHorzAdjustType, SdrTextVertAdjustType, + SdrTransformRef1XItemType, + SdrTransformRef1YItemType, + SdrTransformRef2XItemType, + SdrTransformRef2YItemType, + SdrHorzShearAllItemType, + SdrVertShearAllItemType, + SdrHorzShearOneItemType, + SdrVertShearOneItemType, SdrYesNoItemType, SfxBoolItemType, SfxByteItemType, @@ -206,8 +275,10 @@ enum class SfxItemType : sal_uInt16 { SfxSetItemType, SfxStringItemType, SfxStringListItemType, + SfxTabDialogItemType, SfxTemplateItemType, SfxUInt16ItemType, + SfxUInt32ItemType, SfxUnoAnyItemType, SfxUnoFrameItemType, SfxViewFrameItemType, @@ -215,6 +286,19 @@ enum class SfxItemType : sal_uInt16 { SfxVoidItemType, SfxWatermarkItemType, SfxZoomItemType, + Svx3DCharacterModeItemType, + Svx3DCloseBackItemType, + Svx3DCloseFrontItemType, + Svx3DNormalsKindItemType, + Svx3DPerspectiveItemType, + Svx3DReducedLineGeometryItemType, + Svx3DShadeModeItemType, + Svx3DSmoothLidsItemType, + Svx3DSmoothNormalsItemType, + Svx3DTextureKindItemType, + Svx3DTextureModeItemType, + Svx3DTextureProjectionXItemType, + Svx3DTextureProjectionYItemType, SvXMLAttrContainerItemType, SvxAdjustItemType, SvxAutoKernItemType, @@ -228,7 +312,8 @@ enum class SfxItemType : sal_uInt16 { SvxCaseMapItemType, SvxCharHiddenItemType, SvxCharReliefItemType, - SvxCharScaleWidthItem, + SvxCharRotateItemType, + SvxCharScaleWidthItemType, SvxChartColorTableItemType, SvxChartIndicateItemType, SvxChartKindErrorItemType, @@ -255,9 +340,7 @@ enum class SfxItemType : sal_uInt16 { SvxGalleryItemType, SvxGradientListItemType, SvxGraphicItemType, - SvxGrfCrop, SvxGrfCropType, - SvxGridItem, SvxGridItemType, SvxGutterLeftMarginItemType, SvxGutterRightMarginItemType, @@ -265,7 +348,6 @@ enum class SfxItemType : sal_uInt16 { SvxHatchListItemType, SvxHorJustifyItemType, SvxHyperlinkItemType, - SvxHyphenZoneItem, SvxHyphenZoneItemType, SvxJustifyMethodItemType, SvxKerningItemType, @@ -283,38 +365,49 @@ enum class SfxItemType : sal_uInt16 { SvxNumBulletItemType, SvxNumberInfoItemType, SvxObjectItemType, + SvxOpaqueItemType, SvxOrientationItemType, SvxOrphansItemType, + SvxOverlineItemType, SvxPageItemType, SvxPagePosSizeItemType, + SvxPaperBinItemType, SvxParaGridItemType, SvxParaVertAlignItemType, SvxPatternListItemType, + SvxPostItDateItemType, SvxPostureItemType, + SvxPrintItemType, SvxProtectItemType, SvxRightMarginItemType, SvxRotateModeItemType, + SvxRsidItemType, SvxScriptSetItemType, SvxScriptSpaceItemType, SvxSearchItemType, SvxShadowItemType, SvxShadowedItemType, - SvxSizeItem , SvxSizeItemType, SvxSmartTagItemType, + SvxStatusItemType, SvxTabStopItemType, SvxTextLeftMarginItemType, SvxTextLineItemType, SvxTextRotateItemType, SvxTwoLinesItemType, + SvxUnderlineItemType, SvxULSpaceItemType, SvxVerJustifyItemType, + SvxViewLayoutItemType, SvxWeightItemType, SvxWidowsItemType, SvxWordLineItemType, SvxWritingModeItemType, + SvxZoomSliderItemType, SwAddPrinterItemType, + SwChannelGrfType, SwCondCollItemType, + SwContrastGrfType, SwCropGrfType, SwDocDisplayItemType, SwDrawModeGrf_BaseType, @@ -334,36 +427,48 @@ enum class SfxItemType : sal_uInt16 { SwFormatContentControlType, SwFormatContentType, SwFormatDropType, + SwFormatEditInReadonly, SwFormatFieldType, + SwFormatFrameSizeType, SwFormatFillOrderType, SwFormatFlyCntType, + SwFormatFlySplitType, + SwFormatFollowTextFlowType, SwFormatFooterType, SwFormatFootnoteEndAtTextEndType, SwFormatFootnoteType, SwFormatHeaderType, SwFormatHoriOrientType, SwFormatINetFormatType, + SwFormatLayoutSplitType, SwFormatLineNumberType, SwFormatLinebreakType, SwFormatMetaType, + SwFormatNoBalancedColumnsType, SwFormatPageDescType, SwFormatRefMarkType, + SwFormatRowSplitType, SwFormatRubyType, SwFormatSurroundType, SwFormatURLType, SwFormatVertOrientType, SwFormatWrapInfluenceOnOjPosType, + SwFormatWrapTextAtFlyStartType, SwGammaGrfType, + SwHeaderAndFooterEatSpacingItemType, SwInvertGrfType, SwLabItemType, + SwLuminanceGrfType, SwMirrorGrfType, SwMsgPoolItemType, + SwNumRuleItemType, SwPaMItemType, SwPageFootnoteInfoItemType, SwPtrItemType, SwRotationGrfType, SwShadowCursorItemType, SwTOXMarkType, + SwTableBoxNumFormatType, SwTableBoxValueType, SwTableFormulaType, SwTextGridItemType, @@ -388,7 +493,7 @@ enum class SfxItemType : sal_uInt16 { XFormTextAdjustItemType, XFormTextDistanceItemType, XFormTextHideFormItemType, - XFormTextMirrorItem, + XFormTextMirrorItemType, XFormTextOutlineItemType, XFormTextShadowItemType, XFormTextShadowTranspItemType, @@ -422,7 +527,6 @@ SVL_DLLPUBLIC void listAllocatedSfxPoolItems(); class SfxItemPool; class SfxItemSet; typedef struct _xmlTextWriter* xmlTextWriterPtr; -class ItemInstanceManager; class SVL_DLLPUBLIC SfxPoolItem { @@ -479,15 +583,6 @@ protected: void setIsSetItem() { m_bIsSetItem = true; } void setNonShareable() { m_bShareable = false; } - // access ItemInstanceManager for this Item, default - // is nullptr. If you overload this it is expected that - // you return a ptr to a static, Item-local managed - // instance that exists the whole office lifetime. This - // usually means to have a static instance directly in the - // implementation of the overloaded function (just grep - // for examples) - virtual ItemInstanceManager* getItemInstanceManager() const; - public: inline void AddRef(sal_uInt32 n = 1) const { @@ -600,100 +695,14 @@ public: virtual void dumpAsXml(xmlTextWriterPtr pWriter) const; virtual boost::property_tree::ptree dumpAsJSON() const; + // Only return true from isHashable() if hashCode is implemented. + virtual bool isHashable() const; + virtual size_t hashCode() const; + private: SfxPoolItem& operator=( const SfxPoolItem& ) = delete; }; -// basic Interface definition -class SVL_DLLPUBLIC ItemInstanceManager -{ - // allow *only* ItemSetTooling to access - friend SfxPoolItem const* implCreateItemEntry(SfxItemPool&, SfxPoolItem const*, bool); - friend void implCleanupItemEntry(SfxPoolItem const*); - - // Define for which class to register (usually typeid().hash_code()). - std::size_t m_aClassHash; - -public: - ItemInstanceManager(const std::size_t aClassHash) - : m_aClassHash(aClassHash) - { - } - virtual ~ItemInstanceManager() = default; - - std::size_t getClassHash() const { return m_aClassHash; } - -private: - // standard interface, accessed exclusively - // by implCreateItemEntry/implCleanupItemEntry - virtual const SfxPoolItem* find(const SfxPoolItem&) const = 0; - virtual void add(const SfxPoolItem&) = 0; - virtual void remove(const SfxPoolItem&) = 0; -}; - -// offering a default implementation that can be use for -// each SfxPoolItem (except when !isShareable()). It just -// uses an unordered_set holding ptrs to SfxPoolItems added -// and SfxPoolItem::operator== to linearly search for one. -// Thus this is not the fastest, but as fast as old 'poooled' -// stuff - better use an intelligent, pro-Item implementation -// that does e.g. hashing or whatever might be feasible for -// that specific Item (see other derivations) -class SVL_DLLPUBLIC DefaultItemInstanceManager : public ItemInstanceManager -{ - std::unordered_map> maRegistered; - -public: - DefaultItemInstanceManager(const std::size_t aClassHash) - : ItemInstanceManager(aClassHash) - { - } - -private: - virtual const SfxPoolItem* find(const SfxPoolItem&) const override; - virtual void add(const SfxPoolItem&) override; - virtual void remove(const SfxPoolItem&) override; -}; - -/** - Utility template to reduce boilerplate code when creating item instance managers - for specific PoolItem subclasses. -*/ -template -class TypeSpecificItemInstanceManager : public ItemInstanceManager -{ -public: - TypeSpecificItemInstanceManager() - : ItemInstanceManager(typeid(T).hash_code()) - { - } - - // standard interface, accessed exclusively - // by implCreateItemEntry/implCleanupItemEntry - virtual const SfxPoolItem* find(const SfxPoolItem& rItem) const override final - { - auto aHit(maRegistered.find(hashCode(rItem))); - if (aHit != maRegistered.end()) - return aHit->second; - return nullptr; - } - virtual void add(const SfxPoolItem& rItem) override final - { - maRegistered.insert({hashCode(rItem), &rItem}); - } - virtual void remove(const SfxPoolItem& rItem) override final - { - maRegistered.erase(hashCode(rItem)); - } - -protected: - virtual size_t hashCode(const SfxPoolItem&) const = 0; - -private: - std::unordered_map maRegistered; -}; - - inline bool IsStaticDefaultItem(const SfxPoolItem *pItem ) { return pItem && pItem->isStaticDefault(); diff --git a/include/svl/ptitem.hxx b/include/svl/ptitem.hxx index 90db98bbc869..66a47fd992e1 100644 --- a/include/svl/ptitem.hxx +++ b/include/svl/ptitem.hxx @@ -41,6 +41,8 @@ public: OUString &rText, const IntlWrapper& ) const override; + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxPointItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/include/svl/rectitem.hxx b/include/svl/rectitem.hxx index 26c2acd37b65..ff7dce5fb3aa 100644 --- a/include/svl/rectitem.hxx +++ b/include/svl/rectitem.hxx @@ -40,6 +40,8 @@ public: OUString &rText, const IntlWrapper& ) const override; + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxRectangleItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/include/svl/rngitem.hxx b/include/svl/rngitem.hxx index 8e41184749b1..bb606b7149af 100644 --- a/include/svl/rngitem.hxx +++ b/include/svl/rngitem.hxx @@ -34,6 +34,8 @@ private: sal_uInt16 nTo; public: SfxRangeItem( sal_uInt16 nWID, sal_uInt16 nFrom, sal_uInt16 nTo ); + virtual bool isHashable() const override { return true; } + virtual size_t hashCode() const override { return (static_cast(nFrom) << 16) | nTo; } virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/svl/visitem.hxx b/include/svl/visitem.hxx index 8a458bbf2f6c..04d76365cda8 100644 --- a/include/svl/visitem.hxx +++ b/include/svl/visitem.hxx @@ -36,6 +36,8 @@ public: m_nValue.bVisible = bVisible; } + virtual bool isHashable() const override { return true; } + virtual size_t hashCode() const override { return static_cast(m_nValue.bVisible); } virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, diff --git a/include/svx/EnhancedCustomShape2d.hxx b/include/svx/EnhancedCustomShape2d.hxx index bed4fa9d75f8..3947da9c31c4 100644 --- a/include/svx/EnhancedCustomShape2d.hxx +++ b/include/svx/EnhancedCustomShape2d.hxx @@ -118,6 +118,7 @@ class SVXCORE_DLLPUBLIC EnhancedCustomShape2d final : public SfxItemSet css::uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > m_seqAdjustmentValues; css::uno::Sequence< css::beans::PropertyValues > m_seqHandles; css::uno::Sequence< css::awt::Size > m_seqSubViewSize; + css::uno::Sequence< double > m_seqGluePointLeavingDirections; bool m_bFilled : 1; bool m_bStroked : 1; diff --git a/include/svx/algitem.hxx b/include/svx/algitem.hxx index d0245403360d..450a349f0e53 100644 --- a/include/svx/algitem.hxx +++ b/include/svx/algitem.hxx @@ -77,6 +77,8 @@ public: MapUnit ePresMetric, OUString &rText, const IntlWrapper& ) const override; + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual SvxMarginItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/include/svx/annotation/Annotation.hxx b/include/svx/annotation/Annotation.hxx index d7e4842f534c..ba2021a70ec6 100644 --- a/include/svx/annotation/Annotation.hxx +++ b/include/svx/annotation/Annotation.hxx @@ -21,6 +21,7 @@ #include #include #include +#include #include class SdrUndoAction; @@ -102,13 +103,9 @@ class SVXCORE_DLLPUBLIC Annotation : public ::comphelper::WeakComponentImplHelper, public ::cppu::PropertySetMixin { -private: - static sal_uInt32 m_nLastId; - static sal_uInt32 nextID() { return m_nLastId++; } - protected: SdrPage* mpPage; - sal_uInt32 m_nId; + UniqueID maUniqueID; css::geometry::RealPoint2D m_Position; css::geometry::RealSize2D m_Size; @@ -170,7 +167,7 @@ public: SdrPage* getPage() { return mpPage; } // Unique ID of the annotation - sal_uInt32 GetId() const { return m_nId; } + sal_uInt64 GetId() const { return maUniqueID.getID(); } CreationInfo const& getCreationInfo() { return maCreationInfo; } void setCreationInfo(CreationInfo const& rCreationInfo) { maCreationInfo = rCreationInfo; } diff --git a/include/svx/annotation/AnnotationObject.hxx b/include/svx/annotation/AnnotationObject.hxx index e372fec1f56a..674d1290b9af 100644 --- a/include/svx/annotation/AnnotationObject.hxx +++ b/include/svx/annotation/AnnotationObject.hxx @@ -37,6 +37,8 @@ public: AnnotationObject(SdrModel& rSdrModel, tools::Rectangle const& rRectangle, sdr::annotation::AnnotationViewData const& aAnnotationViewData); + void setup(); + rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; SdrObjKind GetObjIdentifier() const override; diff --git a/include/svx/chrtitem.hxx b/include/svx/chrtitem.hxx index eb6d42fde640..9cff3a00a0e1 100644 --- a/include/svx/chrtitem.hxx +++ b/include/svx/chrtitem.hxx @@ -142,6 +142,8 @@ public: MapUnit ePresMetric, OUString &rText, const IntlWrapper&) const override; + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator == (const SfxPoolItem&) const override; virtual SvxDoubleItem* Clone(SfxItemPool *pPool = nullptr) const override; diff --git a/include/svx/e3ditem.hxx b/include/svx/e3ditem.hxx index bad0e95c89f5..61f3dddd85c7 100644 --- a/include/svx/e3ditem.hxx +++ b/include/svx/e3ditem.hxx @@ -34,6 +34,8 @@ public: SvxB3DVectorItem( const SvxB3DVectorItem& ); virtual ~SvxB3DVectorItem() override; + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual SvxB3DVectorItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/include/svx/grfcrop.hxx b/include/svx/grfcrop.hxx index 3eed97fbab47..a8cb0e032eb3 100644 --- a/include/svx/grfcrop.hxx +++ b/include/svx/grfcrop.hxx @@ -28,7 +28,7 @@ class SVXCORE_DLLPUBLIC SvxGrfCrop : public SfxPoolItem { - sal_Int32 nLeft, nRight, nTop, nBottom; + sal_Int32 m_nLeft, m_nRight, m_nTop, m_nBottom; public: SvxGrfCrop( TypedWhichId, SfxItemType eType = SfxItemType::SvxGrfCropType ); SvxGrfCrop( sal_Int32 nLeft, sal_Int32 nRight, @@ -54,15 +54,15 @@ public: virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; - void SetLeft( sal_Int32 nVal ) { nLeft = nVal; } - void SetRight( sal_Int32 nVal ) { nRight = nVal; } - void SetTop( sal_Int32 nVal ) { nTop = nVal; } - void SetBottom( sal_Int32 nVal ) { nBottom = nVal; } + void SetLeft( sal_Int32 nVal ) { m_nLeft = nVal; } + void SetRight( sal_Int32 nVal ) { m_nRight = nVal; } + void SetTop( sal_Int32 nVal ) { m_nTop = nVal; } + void SetBottom( sal_Int32 nVal ) { m_nBottom = nVal; } - sal_Int32 GetLeft() const { return nLeft; } - sal_Int32 GetRight() const { return nRight; } - sal_Int32 GetTop() const { return nTop; } - sal_Int32 GetBottom() const { return nBottom; } + sal_Int32 GetLeft() const { return m_nLeft; } + sal_Int32 GetRight() const { return m_nRight; } + sal_Int32 GetTop() const { return m_nTop; } + sal_Int32 GetBottom() const { return m_nBottom; } }; #endif // INCLUDED_SVX_GRFCROP_HXX diff --git a/include/svx/postattr.hxx b/include/svx/postattr.hxx index af980a3e5b9e..22ede7dffc92 100644 --- a/include/svx/postattr.hxx +++ b/include/svx/postattr.hxx @@ -39,6 +39,8 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SvxPostItAuthorItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool isHashable() const override; // hashCode is defined in CntUnencodedStringItem }; @@ -59,6 +61,8 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SvxPostItDateItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool isHashable() const override; // hashCode is defined in CntUnencodedStringItem }; /** The text of a note @@ -79,6 +83,8 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SvxPostItTextItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool isHashable() const override; // hashCode is defined in CntUnencodedStringItem }; @@ -93,6 +99,8 @@ public: SvxPostItIdItem( TypedWhichId nWhich ); virtual SvxPostItIdItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + virtual bool isHashable() const override; // hashCode is defined in CntUnencodedStringItem }; #endif diff --git a/include/svx/sdasitm.hxx b/include/svx/sdasitm.hxx index 7821bbd2e0a8..6ec62db34e00 100644 --- a/include/svx/sdasitm.hxx +++ b/include/svx/sdasitm.hxx @@ -69,6 +69,8 @@ private: SdrCustomShapeGeometryItem & operator =(SdrCustomShapeGeometryItem const &) = delete; // due to SfxPoolItem SdrCustomShapeGeometryItem & operator =(SdrCustomShapeGeometryItem &&) = delete; // due to SfxPoolItem + virtual bool isHashable() const override; + virtual size_t hashCode() const override; SAL_DLLPRIVATE virtual bool operator==( const SfxPoolItem& ) const override; SAL_DLLPRIVATE virtual bool GetPresentation(SfxItemPresentation ePresentation, diff --git a/include/svx/sdggaitm.hxx b/include/svx/sdggaitm.hxx index 249130d4d49e..6ec033a53798 100644 --- a/include/svx/sdggaitm.hxx +++ b/include/svx/sdggaitm.hxx @@ -32,8 +32,7 @@ class SVXCORE_DLLPUBLIC SdrGrafGamma100Item final : public SfxUInt32Item { public: - - SdrGrafGamma100Item( sal_uInt32 nGamma100 = 100 ) : SfxUInt32Item( SDRATTR_GRAFGAMMA, nGamma100 ) {} + SdrGrafGamma100Item( sal_uInt32 nGamma100 = 100 ) : SfxUInt32Item( SDRATTR_GRAFGAMMA, nGamma100, SfxItemType::SdrGrafGamma100ItemType ) {} SAL_DLLPRIVATE virtual SdrGrafGamma100Item* Clone( SfxItemPool* pPool = nullptr ) const override; diff --git a/include/svx/sdgluitm.hxx b/include/svx/sdgluitm.hxx index 4ef5e69e9e45..13e35435aed5 100644 --- a/include/svx/sdgluitm.hxx +++ b/include/svx/sdgluitm.hxx @@ -32,9 +32,8 @@ class SVXCORE_DLLPUBLIC SdrGrafLuminanceItem final : public SdrSignedPercentItem { public: - - SdrGrafLuminanceItem( short nLuminancePercent = 0 ) : SdrSignedPercentItem( - SDRATTR_GRAFLUMINANCE, nLuminancePercent ) {} + SdrGrafLuminanceItem( short nLuminancePercent = 0 ) + : SdrSignedPercentItem( SDRATTR_GRAFLUMINANCE, nLuminancePercent, SfxItemType::SdrGrafLuminanceItemType ) {} virtual SdrGrafLuminanceItem* Clone( SfxItemPool* pPool = nullptr ) const override; }; @@ -47,8 +46,8 @@ class SVXCORE_DLLPUBLIC SdrGrafContrastItem final : public SdrSignedPercentItem { public: - - SdrGrafContrastItem( short nContrastPercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFCONTRAST, nContrastPercent ) {} + SdrGrafContrastItem( short nContrastPercent = 0 ) + : SdrSignedPercentItem( SDRATTR_GRAFCONTRAST, nContrastPercent, SfxItemType::SdrGrafContrastItemType ) {} virtual SdrGrafContrastItem* Clone( SfxItemPool* pPool = nullptr ) const override; }; diff --git a/include/svx/sdmetitm.hxx b/include/svx/sdmetitm.hxx index 934c24034d94..751cd769aedc 100644 --- a/include/svx/sdmetitm.hxx +++ b/include/svx/sdmetitm.hxx @@ -29,7 +29,8 @@ class SVXCORE_DLLPUBLIC SdrMetricItem: public SfxInt32Item { public: - SdrMetricItem(TypedWhichId nId, sal_Int32 nVal): SfxInt32Item(nId,nVal) {} + SdrMetricItem(TypedWhichId nId, sal_Int32 nVal, SfxItemType eItemType = SfxItemType::SdrMetricItemType) + : SfxInt32Item(nId,nVal,eItemType) {} virtual SdrMetricItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual bool HasMetrics() const override; virtual void ScaleMetrics(tools::Long nMul, tools::Long nDiv) override; diff --git a/include/svx/sdooitm.hxx b/include/svx/sdooitm.hxx index befd67f749e0..b94a45bb9555 100644 --- a/include/svx/sdooitm.hxx +++ b/include/svx/sdooitm.hxx @@ -29,7 +29,8 @@ class SVXCORE_DLLPUBLIC SdrOnOffItem: public SfxBoolItem { public: - SdrOnOffItem(TypedWhichId nId, bool bOn): SfxBoolItem(nId,bOn) {} + SdrOnOffItem(TypedWhichId nId, bool bOn, SfxItemType eItemType = SfxItemType::SdrOnOffItemType) + : SfxBoolItem(nId, bOn, eItemType) {} virtual SdrOnOffItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual OUString GetValueTextByVal(bool bVal) const override; diff --git a/include/svx/sdprcitm.hxx b/include/svx/sdprcitm.hxx index f00c8d514edb..a7d439d0cf0a 100644 --- a/include/svx/sdprcitm.hxx +++ b/include/svx/sdprcitm.hxx @@ -31,7 +31,8 @@ class SVXCORE_DLLPUBLIC SdrPercentItem : public SfxUInt16Item { public: - SdrPercentItem(TypedWhichId nId, sal_uInt16 nVal): SfxUInt16Item(nId,nVal) {} + SdrPercentItem(TypedWhichId nId, sal_uInt16 nVal, SfxItemType eItemKind = SfxItemType::SdrPercentItemType) + : SfxUInt16Item(nId, nVal, eItemKind) {} virtual SdrPercentItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override; @@ -47,7 +48,8 @@ public: class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SdrSignedPercentItem : public SfxInt16Item { public: - SdrSignedPercentItem( sal_uInt16 nId, sal_Int16 nVal ) : SfxInt16Item( nId,nVal ) {} + SdrSignedPercentItem( sal_uInt16 nId, sal_Int16 nVal, SfxItemType eItemType = SfxItemType::SdrSignedPercentItemType ) + : SfxInt16Item( nId, nVal, eItemType ) {} virtual SdrSignedPercentItem* Clone( SfxItemPool* pPool = nullptr ) const override; virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override; diff --git a/include/svx/sdtaaitm.hxx b/include/svx/sdtaaitm.hxx index 1a4a51c0e07f..c5a95eeb0cf2 100644 --- a/include/svx/sdtaaitm.hxx +++ b/include/svx/sdtaaitm.hxx @@ -25,7 +25,7 @@ class SVXCORE_DLLPUBLIC SdrTextAniAmountItem final : public SfxInt16Item { public: - SdrTextAniAmountItem(sal_Int16 nVal=0): SfxInt16Item(SDRATTR_TEXT_ANIAMOUNT,nVal) {} + SdrTextAniAmountItem(sal_Int16 nVal=0): SfxInt16Item(SDRATTR_TEXT_ANIAMOUNT, nVal, SfxItemType::SdrTextAniAmountItemType) {} virtual SdrTextAniAmountItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual bool HasMetrics() const override; virtual void ScaleMetrics(tools::Long nMul, tools::Long nDiv) override; diff --git a/include/svx/sdtacitm.hxx b/include/svx/sdtacitm.hxx index 820aee926503..b54491c45ad8 100644 --- a/include/svx/sdtacitm.hxx +++ b/include/svx/sdtacitm.hxx @@ -25,7 +25,7 @@ // Number of loops. 0=infinite. class SAL_DLLPUBLIC_RTTI SdrTextAniCountItem final : public SfxUInt16Item { public: - SdrTextAniCountItem(sal_uInt16 nVal=0): SfxUInt16Item(SDRATTR_TEXT_ANICOUNT,nVal) {} + SdrTextAniCountItem(sal_uInt16 nVal=0): SfxUInt16Item(SDRATTR_TEXT_ANICOUNT, nVal, SfxItemType::SdrTextAniCountItemType) {} virtual SdrTextAniCountItem* Clone(SfxItemPool * = nullptr) const override { return new SdrTextAniCountItem(*this); } diff --git a/include/svx/sdtaiitm.hxx b/include/svx/sdtaiitm.hxx index d847208a6857..9a09d6a02344 100644 --- a/include/svx/sdtaiitm.hxx +++ b/include/svx/sdtaiitm.hxx @@ -24,7 +24,7 @@ class SVXCORE_DLLPUBLIC SdrTextAniStartInsideItem final : public SdrYesNoItem { public: - SdrTextAniStartInsideItem(bool bOn=false): SdrYesNoItem(SDRATTR_TEXT_ANISTARTINSIDE,bOn) {} + SdrTextAniStartInsideItem(bool bOn=false): SdrYesNoItem(SDRATTR_TEXT_ANISTARTINSIDE,bOn, SfxItemType::SdrTextAniStartInsideItemType) {} virtual ~SdrTextAniStartInsideItem() override; virtual SdrTextAniStartInsideItem* Clone(SfxItemPool* pPool=nullptr) const override; @@ -36,7 +36,7 @@ public: class SVXCORE_DLLPUBLIC SdrTextAniStopInsideItem final : public SdrYesNoItem { public: - SdrTextAniStopInsideItem(bool bOn=false): SdrYesNoItem(SDRATTR_TEXT_ANISTOPINSIDE,bOn) {} + SdrTextAniStopInsideItem(bool bOn=false): SdrYesNoItem(SDRATTR_TEXT_ANISTOPINSIDE,bOn, SfxItemType::SdrTextAniStopInsideItemType) {} virtual ~SdrTextAniStopInsideItem() override; virtual SdrTextAniStopInsideItem* Clone(SfxItemPool* pPool=nullptr) const override; diff --git a/include/svx/sdtayitm.hxx b/include/svx/sdtayitm.hxx index 7308991d00d5..f20e2c8e1af9 100644 --- a/include/svx/sdtayitm.hxx +++ b/include/svx/sdtayitm.hxx @@ -25,7 +25,7 @@ class SVXCORE_DLLPUBLIC SdrTextAniDelayItem final : public SfxUInt16Item { public: - SdrTextAniDelayItem(sal_uInt16 nVal=0): SfxUInt16Item(SDRATTR_TEXT_ANIDELAY,nVal) {} + SdrTextAniDelayItem(sal_uInt16 nVal=0): SfxUInt16Item(SDRATTR_TEXT_ANIDELAY, nVal, SfxItemType::SdrTextAniDelayItemType) {} virtual SdrTextAniDelayItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper&) const override; }; diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index f029d928aa8a..5f0175b57d7e 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -213,6 +213,7 @@ protected: bool m_bStarDrawPreviewMode:1; bool mbDisableTextEditUsesCommonUndoManager:1; bool mbVOCInvalidationIsReliable:1; // does the app reliably invalidate the VOC, or do we need to rebuild the primitives on every render? + bool m_bIsPDFDocument:1; sal_uInt16 m_nDefaultTabulator; sal_uInt32 m_nMaxUndoCount; @@ -581,6 +582,12 @@ public: bool IsWriter() const { return m_bIsWriter; } + bool IsPDFDocument() const { return m_bIsPDFDocument; } + void setPDFDocument(bool bIsPDFDocument) + { + m_bIsPDFDocument = bIsPDFDocument; + } + // Used as a fallback in *::ReadUserDataSequence() to process common properties void ReadUserDataSequenceValue(const css::beans::PropertyValue *pValue); void WriteUserDataSequence(css::uno::Sequence < css::beans::PropertyValue >& rValues); diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index d6e68943e0ac..55f11379356d 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -35,6 +35,7 @@ #include #include #include +#include // predefines namespace model { class Theme; } @@ -431,6 +432,7 @@ private: sal_Int32 mnBorderUpper; // top page margin sal_Int32 mnBorderRight; // right page margin sal_Int32 mnBorderLower; // bottom page margin + UniqueID maUniqueID; bool mbBackgroundFullSize = false; ///< Background object to represent the whole page. std::unique_ptr mpLayerAdmin; @@ -502,6 +504,7 @@ public: sal_Int32 GetUpperBorder() const; sal_Int32 GetRightBorder() const; sal_Int32 GetLowerBorder() const; + sal_uInt64 GetUniqueID() const { return maUniqueID.getID(); } void SetBackgroundFullSize(bool bIn); bool IsBackgroundFullSize() const; diff --git a/include/svx/svdsnpv.hxx b/include/svx/svdsnpv.hxx index a7390ad49ad6..15f2814dcfa2 100644 --- a/include/svx/svdsnpv.hxx +++ b/include/svx/svdsnpv.hxx @@ -268,7 +268,7 @@ public: void SetSlantButShear(bool bOn) { bSlantButShear=bOn; } bool IsSlantButShear() const { return bSlantButShear; } - // Don't contort objecte while Crook. persistent. Default=FALSE. (ni) + // Don't contort object while Crook. persistent. Default=FALSE. (ni) void SetCrookNoContortion(bool bOn) { bCrookNoContortion=bOn; } bool IsCrookNoContortion() const { return bCrookNoContortion; } diff --git a/include/svx/svxgraphicitem.hxx b/include/svx/svxgraphicitem.hxx index 6d78b0980baa..47f8d1b59354 100644 --- a/include/svx/svxgraphicitem.hxx +++ b/include/svx/svxgraphicitem.hxx @@ -31,6 +31,8 @@ class SVX_DLLPUBLIC SvxGraphicItem final : public SfxPoolItem public: SvxGraphicItem( Graphic aGraphic); + virtual bool isHashable() const override; + virtual size_t hashCode() const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual SvxGraphicItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/include/svx/sxcecitm.hxx b/include/svx/sxcecitm.hxx index 9f20c10c1a7f..064de9ff9ece 100644 --- a/include/svx/sxcecitm.hxx +++ b/include/svx/sxcecitm.hxx @@ -49,7 +49,7 @@ public: class SVXCORE_DLLPUBLIC SdrCaptionEscIsRelItem final : public SdrYesNoItem { public: - SdrCaptionEscIsRelItem(bool bRel=true): SdrYesNoItem(SDRATTR_CAPTIONESCISREL,bRel) {} + SdrCaptionEscIsRelItem(bool bRel=true): SdrYesNoItem(SDRATTR_CAPTIONESCISREL,bRel, SfxItemType::SdrCaptionEscIsRelItemType) {} virtual ~SdrCaptionEscIsRelItem() override; virtual SdrCaptionEscIsRelItem* Clone(SfxItemPool* pPool=nullptr) const override; @@ -68,7 +68,7 @@ public: class SVXCORE_DLLPUBLIC SdrCaptionEscRelItem final : public SfxInt32Item { public: - SdrCaptionEscRelItem(sal_Int32 nEscRel=5000): SfxInt32Item(SDRATTR_CAPTIONESCREL,nEscRel) {} + SdrCaptionEscRelItem(sal_Int32 nEscRel=5000): SfxInt32Item(SDRATTR_CAPTIONESCREL, nEscRel, SfxItemType::SdrCaptionEscRelItemType) {} virtual ~SdrCaptionEscRelItem() override; virtual SdrCaptionEscRelItem* Clone(SfxItemPool* pPool=nullptr) const override; @@ -87,7 +87,7 @@ public: class SdrCaptionEscAbsItem final : public SdrMetricItem { public: - SdrCaptionEscAbsItem(tools::Long nEscAbs=0): SdrMetricItem(SDRATTR_CAPTIONESCABS,nEscAbs) {} + SdrCaptionEscAbsItem(tools::Long nEscAbs=0): SdrMetricItem(SDRATTR_CAPTIONESCABS, nEscAbs, SfxItemType::SdrCaptionEscAbsItemType) {} virtual SdrCaptionEscAbsItem* Clone(SfxItemPool*) const override { return new SdrCaptionEscAbsItem(*this); diff --git a/include/svx/sxcgitm.hxx b/include/svx/sxcgitm.hxx index 993d164dea10..cb2cd2f465ab 100644 --- a/include/svx/sxcgitm.hxx +++ b/include/svx/sxcgitm.hxx @@ -30,7 +30,7 @@ class SdrCaptionGapItem final : public SdrMetricItem { public: SdrCaptionGapItem(tools::Long nGap = 0) - : SdrMetricItem(SDRATTR_CAPTIONGAP, nGap) + : SdrMetricItem(SDRATTR_CAPTIONGAP, nGap, SfxItemType::SdrCaptionGapItemType) { } virtual SdrCaptionGapItem* Clone(SfxItemPool*) const override diff --git a/include/svx/sxcllitm.hxx b/include/svx/sxcllitm.hxx index 8ac03f0eaf84..00ebe20ddfe4 100644 --- a/include/svx/sxcllitm.hxx +++ b/include/svx/sxcllitm.hxx @@ -30,7 +30,7 @@ */ class SVXCORE_DLLPUBLIC SdrCaptionLineLenItem final : public SdrMetricItem { public: - SdrCaptionLineLenItem(tools::Long nLineLen=0): SdrMetricItem(SDRATTR_CAPTIONLINELEN,nLineLen) {} + SdrCaptionLineLenItem(tools::Long nLineLen=0): SdrMetricItem(SDRATTR_CAPTIONLINELEN,nLineLen, SfxItemType::SdrCaptionLineLenItemType) {} virtual ~SdrCaptionLineLenItem() override; virtual SdrCaptionLineLenItem* Clone(SfxItemPool* pPool=nullptr) const override; @@ -46,7 +46,7 @@ public: */ class SVXCORE_DLLPUBLIC SdrCaptionFitLineLenItem final : public SdrYesNoItem { public: - SdrCaptionFitLineLenItem(bool bBestFit=true): SdrYesNoItem(SDRATTR_CAPTIONFITLINELEN,bBestFit) {} + SdrCaptionFitLineLenItem(bool bBestFit=true): SdrYesNoItem(SDRATTR_CAPTIONFITLINELEN,bBestFit, SfxItemType::SdrCaptionFitLineLenItemType) {} virtual ~SdrCaptionFitLineLenItem() override; virtual SdrCaptionFitLineLenItem* Clone(SfxItemPool* pPool=nullptr) const override; diff --git a/include/svx/sxelditm.hxx b/include/svx/sxelditm.hxx index 7d2bc11dc102..1b3a8b52f59c 100644 --- a/include/svx/sxelditm.hxx +++ b/include/svx/sxelditm.hxx @@ -26,7 +26,8 @@ class SAL_DLLPUBLIC_RTTI SdrEdgeLineDeltaCountItem final : public SfxUInt16Item { public: SdrEdgeLineDeltaCountItem(sal_uInt16 nVal = 0) - : SfxUInt16Item(SDRATTR_EDGELINEDELTACOUNT, nVal) + : SfxUInt16Item(SDRATTR_EDGELINEDELTACOUNT, nVal, + SfxItemType::SdrEdgeLineDeltaCountItemType) { } virtual SdrEdgeLineDeltaCountItem* Clone(SfxItemPool*) const override diff --git a/include/svx/sxenditm.hxx b/include/svx/sxenditm.hxx index ed72c9224428..c678b51b06dd 100644 --- a/include/svx/sxenditm.hxx +++ b/include/svx/sxenditm.hxx @@ -25,7 +25,7 @@ class SVXCORE_DLLPUBLIC SdrEdgeNode1HorzDistItem final : public SdrMetricItem { public: - SdrEdgeNode1HorzDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE1HORZDIST,nVal) {} + SdrEdgeNode1HorzDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE1HORZDIST, nVal, SfxItemType::SdrEdgeNode1HorzDistItemType) {} SAL_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; SAL_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; SAL_DLLPRIVATE virtual SdrEdgeNode1HorzDistItem* Clone(SfxItemPool* pPool=nullptr) const override; @@ -33,7 +33,7 @@ public: class SVXCORE_DLLPUBLIC SdrEdgeNode1VertDistItem final : public SdrMetricItem { public: - SdrEdgeNode1VertDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE1VERTDIST,nVal) {} + SdrEdgeNode1VertDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE1VERTDIST, nVal, SfxItemType::SdrEdgeNode1VertDistItemType) {} SAL_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; SAL_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; SAL_DLLPRIVATE virtual SdrEdgeNode1VertDistItem* Clone(SfxItemPool* pPool=nullptr) const override; @@ -41,7 +41,7 @@ public: class SVXCORE_DLLPUBLIC SdrEdgeNode2HorzDistItem final : public SdrMetricItem { public: - SdrEdgeNode2HorzDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE2HORZDIST,nVal) {} + SdrEdgeNode2HorzDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE2HORZDIST, nVal, SfxItemType::SdrEdgeNode2HorzDistItemType) {} SAL_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; SAL_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; SAL_DLLPRIVATE virtual SdrEdgeNode2HorzDistItem* Clone(SfxItemPool* pPool=nullptr) const override; @@ -49,7 +49,7 @@ public: class SVXCORE_DLLPUBLIC SdrEdgeNode2VertDistItem final : public SdrMetricItem { public: - SdrEdgeNode2VertDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE2VERTDIST,nVal) {} + SdrEdgeNode2VertDistItem(tools::Long nVal): SdrMetricItem(SDRATTR_EDGENODE2VERTDIST, nVal, SfxItemType::SdrEdgeNode2VertDistItemType) {} SAL_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; SAL_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; SAL_DLLPRIVATE virtual SdrEdgeNode2VertDistItem* Clone(SfxItemPool* pPool=nullptr) const override; @@ -57,13 +57,15 @@ public: class SdrEdgeNode1GlueDistItem final : public SdrMetricItem { public: - SdrEdgeNode1GlueDistItem(tools::Long nVal=0): SdrMetricItem(SDRATTR_EDGENODE1GLUEDIST,nVal) {} + SdrEdgeNode1GlueDistItem(tools::Long nVal=0) + : SdrMetricItem(SDRATTR_EDGENODE1GLUEDIST, nVal, SfxItemType::SdrEdgeNode1GlueDistItemType) {} virtual SdrEdgeNode1GlueDistItem* Clone(SfxItemPool* pPool=nullptr) const override; }; class SdrEdgeNode2GlueDistItem final : public SdrMetricItem { public: - SdrEdgeNode2GlueDistItem(tools::Long nVal=0): SdrMetricItem(SDRATTR_EDGENODE2GLUEDIST,nVal) {} + SdrEdgeNode2GlueDistItem(tools::Long nVal=0) + : SdrMetricItem(SDRATTR_EDGENODE2GLUEDIST, nVal, SfxItemType::SdrEdgeNode2GlueDistItemType) {} virtual SdrEdgeNode2GlueDistItem* Clone(SfxItemPool* pPool=nullptr) const override; }; diff --git a/include/svx/sxmbritm.hxx b/include/svx/sxmbritm.hxx index 022656aaa142..5cdc6e69f3eb 100644 --- a/include/svx/sxmbritm.hxx +++ b/include/svx/sxmbritm.hxx @@ -31,7 +31,7 @@ // (SdrMeasureLineDistItem) over the reference edge class SVXCORE_DLLPUBLIC SdrMeasureBelowRefEdgeItem final : public SdrYesNoItem { public: - SdrMeasureBelowRefEdgeItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASUREBELOWREFEDGE,bOn) {} + SdrMeasureBelowRefEdgeItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASUREBELOWREFEDGE,bOn, SfxItemType::SdrMeasureBelowRefEdgeItemType) {} virtual ~SdrMeasureBelowRefEdgeItem() override; virtual SdrMeasureBelowRefEdgeItem* Clone(SfxItemPool* pPool=nullptr) const override; diff --git a/include/svx/sxmtfitm.hxx b/include/svx/sxmtfitm.hxx index 11de732865a7..1100a0948f16 100644 --- a/include/svx/sxmtfitm.hxx +++ b/include/svx/sxmtfitm.hxx @@ -29,7 +29,7 @@ // Abrogate TextUpsideDown, TextRota90 and TextAutoAngle. (n.i.) class SdrMeasureTextIsFixedAngleItem final : public SdrYesNoItem { public: - SdrMeasureTextIsFixedAngleItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTISFIXEDANGLE,bOn) {} + SdrMeasureTextIsFixedAngleItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTISFIXEDANGLE,bOn, SfxItemType::SdrMeasureTextIsFixedAngleItemType) {} virtual ~SdrMeasureTextIsFixedAngleItem() override; virtual SdrMeasureTextIsFixedAngleItem* Clone(SfxItemPool* pPool=nullptr) const override; @@ -42,7 +42,8 @@ public: //Angle of the text in 1/100deg. 0=horizontal; read from left to right. (n.i.) class SdrMeasureTextFixedAngleItem final : public SdrAngleItem { public: - SdrMeasureTextFixedAngleItem(Degree100 nVal=0_deg100): SdrAngleItem(SDRATTR_MEASURETEXTFIXEDANGLE,nVal) {} + SdrMeasureTextFixedAngleItem(Degree100 nVal=0_deg100) + : SdrAngleItem(SDRATTR_MEASURETEXTFIXEDANGLE,nVal, SfxItemType::SdrMeasureTextFixedAngleItemType) {} virtual ~SdrMeasureTextFixedAngleItem() override; virtual SdrMeasureTextFixedAngleItem* Clone(SfxItemPool* pPool=nullptr) const override; @@ -55,7 +56,8 @@ public: // The decimal places used for the measure value class SVXCORE_DLLPUBLIC SdrMeasureDecimalPlacesItem final : public SfxInt16Item { public: - SdrMeasureDecimalPlacesItem(sal_Int16 nVal=2): SfxInt16Item(SDRATTR_MEASUREDECIMALPLACES,nVal) {} + SdrMeasureDecimalPlacesItem(sal_Int16 nVal=2) + : SfxInt16Item(SDRATTR_MEASUREDECIMALPLACES, nVal, SfxItemType::SdrMeasureDecimalPlacesItemType) {} virtual ~SdrMeasureDecimalPlacesItem() override; virtual SdrMeasureDecimalPlacesItem* Clone(SfxItemPool* pPool=nullptr) const override; diff --git a/include/svx/sxmtritm.hxx b/include/svx/sxmtritm.hxx index 184a59f39307..3f0c3579a625 100644 --- a/include/svx/sxmtritm.hxx +++ b/include/svx/sxmtritm.hxx @@ -25,7 +25,7 @@ // text across the dimension line (90deg counter-clockwise rotation) class SVXCORE_DLLPUBLIC SdrMeasureTextRota90Item final : public SdrYesNoItem { public: - SdrMeasureTextRota90Item(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTROTA90,bOn) {} + SdrMeasureTextRota90Item(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTROTA90,bOn, SfxItemType::SdrMeasureTextRota90ItemType) {} virtual ~SdrMeasureTextRota90Item() override; virtual SdrMeasureTextRota90Item* Clone(SfxItemPool* pPool=nullptr) const override; @@ -39,7 +39,7 @@ public: // Text is also switched to the other side of the dimension line, if not Rota90 class SdrMeasureTextUpsideDownItem final : public SdrYesNoItem { public: - SdrMeasureTextUpsideDownItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTUPSIDEDOWN,bOn) {} + SdrMeasureTextUpsideDownItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTUPSIDEDOWN,bOn, SfxItemType::SdrMeasureTextUpsideDownItemType) {} virtual ~SdrMeasureTextUpsideDownItem() override; virtual SdrMeasureTextUpsideDownItem* Clone(SfxItemPool* pPool=nullptr) const override; diff --git a/include/systools/win32/comtools.hxx b/include/systools/win32/comtools.hxx index 1d618051d2c7..9c2f49e8be0a 100644 --- a/include/systools/win32/comtools.hxx +++ b/include/systools/win32/comtools.hxx @@ -19,6 +19,9 @@ #pragma once +#include + +#include #include #include #include @@ -35,22 +38,27 @@ namespace sal::systools class ComError : public std::runtime_error { public: - ComError(const std::string& message, HRESULT hr) : - std::runtime_error(message), - hr_(hr) + ComError(std::string_view message, HRESULT hr, + const std::source_location& loc = std::source_location::current()) + : std::runtime_error(std::string(message)) + , hr_(hr) + , loc_(loc) {} HRESULT GetHresult() const { return hr_; } + const std::source_location& GetLocation() const { return loc_; } private: HRESULT hr_; + std::source_location loc_; }; /* Convert failed HRESULT to thrown ComError */ - inline void ThrowIfFailed(HRESULT hr, std::string_view msg) + inline void ThrowIfFailed(HRESULT hr, std::string_view msg, + std::source_location loc = std::source_location::current()) { if (FAILED(hr)) - throw ComError(std::string(msg), hr); + throw ComError(msg, hr, loc); } /* A guard class to call CoInitializeEx/CoUninitialize in proper pairs @@ -92,10 +100,7 @@ namespace sal::systools }; struct COM_QUERY_TAG {} constexpr COM_QUERY; - struct COM_QUERY_THROW_TAG {} constexpr COM_QUERY_THROW; - template - constexpr bool is_COM_query_tag - = std::is_same_v || std::is_same_v; + struct COM_QUERY_THROW_TAG : public COM_QUERY_TAG {} constexpr COM_QUERY_THROW; /* A simple COM smart pointer template */ template @@ -157,7 +162,8 @@ namespace sal::systools ~COMReference() { release(com_ptr_); } - template , int> = 0> + template + requires std::is_base_of_v COMReference QueryInterface(TAG) const { T2* ip = nullptr; diff --git a/include/test/bootstrapfixture.hxx b/include/test/bootstrapfixture.hxx index 438bba58a431..f512cabc7784 100644 --- a/include/test/bootstrapfixture.hxx +++ b/include/test/bootstrapfixture.hxx @@ -46,8 +46,6 @@ class OOO_DLLPUBLIC_TEST BootstrapFixture : public BootstrapFixtureBase bool m_bAssertOnDialog; protected: - css::uno::Reference mxComponentContext; - // A convenience function to be used to conditionally exclude tests not behaving properly // on UI scaling other than 1:1. Using this should be considered a temporary workaround, // until a proper fix is implemented that either considers the DPI properly in the test, or diff --git a/include/tools/UniqueID.hxx b/include/tools/UniqueID.hxx new file mode 100644 index 000000000000..c649a5185469 --- /dev/null +++ b/include/tools/UniqueID.hxx @@ -0,0 +1,34 @@ +/* -*- 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/. + */ + +#pragma once + +#include +#include + +/** Unique ID for an object. + * + * Generates a unique ID and stores it in a member variable, so the ID returned + * by getId() is the same as long as the object is alive. + * + * ID numbers start with 1. + * + */ +class TOOLS_DLLPUBLIC UniqueID final +{ +private: + sal_uInt64 mnID; + +public: + UniqueID(); + + sal_uInt64 getID() const { return mnID; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/tools/color.hxx b/include/tools/color.hxx index 0520df6d3c68..f95ef582f1d6 100644 --- a/include/tools/color.hxx +++ b/include/tools/color.hxx @@ -177,7 +177,7 @@ public: */ bool IsFullyTransparent() const { - return T == 255; + return GetAlpha() == 0; } /** Sets the red value. @@ -217,7 +217,7 @@ public: */ Color GetRGBColor() const { - return {R, G, B}; + return { GetRed(), GetGreen(), GetBlue() }; } /* Comparison and operators */ @@ -279,7 +279,7 @@ public: */ sal_uInt8 GetLuminance() const { - return sal_uInt8((B * 29UL + G * 151UL + R * 76UL) >> 8); + return sal_uInt8((GetBlue() * 29UL + GetGreen() * 151UL + GetRed() * 76UL) >> 8); } /** Increases the color luminance by cLumInc. @@ -343,9 +343,9 @@ public: */ void Invert() { - R = ~R; - G = ~G; - B = ~B; + SetRed(~GetRed()); + SetGreen(~GetGreen()); + SetBlue(~GetBlue()); } /** Merges color with rMergeColor. @@ -355,9 +355,9 @@ public: */ void Merge(const Color& rMergeColor, sal_uInt8 cTransparency) { - R = color::ColorChannelMerge(R, rMergeColor.R, cTransparency); - G = color::ColorChannelMerge(G, rMergeColor.G, cTransparency); - B = color::ColorChannelMerge(B, rMergeColor.B, cTransparency); + SetRed(color::ColorChannelMerge(GetRed(), rMergeColor.GetRed(), cTransparency)); + SetGreen(color::ColorChannelMerge(GetGreen(), rMergeColor.GetGreen(), cTransparency)); + SetBlue(color::ColorChannelMerge(GetBlue(), rMergeColor.GetBlue(), cTransparency)); } /* Change of format */ @@ -411,7 +411,7 @@ public: */ basegfx::BColor getBColor() const { - basegfx::BColor aColor(R / 255.0, G / 255.0, B / 255.0); + basegfx::BColor aColor(GetRed() / 255.0, GetGreen() / 255.0, GetBlue() / 255.0); if (mValue == Color(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF).mValue) aColor.setAutomatic(true); return aColor; diff --git a/include/tools/helpers.hxx b/include/tools/helpers.hxx index 6e499a6564a0..a6617a3fafd6 100644 --- a/include/tools/helpers.hxx +++ b/include/tools/helpers.hxx @@ -7,11 +7,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once - +#include #include #include #include #include +#include #include inline sal_uInt32 AlignedWidth4Bytes(sal_uInt32 nWidthBits) @@ -45,4 +46,17 @@ template [[nodiscard]] inline T NormAngle360(T angle) return angle; } +// get hash from interface +// TODO: UNIT TEST +[[nodiscard]] inline +std::string GetInterfaceHash(const ::css::uno::Reference<::css::uno::XInterface>& xIf) +{ + if (xIf.is()) + { + auto ptr = reinterpret_cast(xIf.get()); + return std::to_string(ptr); + } + return {}; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx index 7e7c4a2aafc6..96f21676d51b 100644 --- a/include/tools/urlobj.hxx +++ b/include/tools/urlobj.hxx @@ -1210,7 +1210,7 @@ inline bool INetURLObject::GetNewAbsURL(OUString const & rTheRelURIRef, FSysStyle::Detect)) return false; if (pTheAbsURIRef) - *pTheAbsURIRef = aTheAbsURIRef; + *pTheAbsURIRef = std::move(aTheAbsURIRef); return true; } diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index be6c050ad36d..483176aca3b8 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -384,6 +384,12 @@ public: * @param pViewShell the view to get the options from, if nullptr the current view shell is used */ virtual OString getViewRenderState(SfxViewShell* = nullptr) { return rtl::OString(); } + + /** Return JSON structure filled with the information about the presentation (Impress only function) */ + virtual OString getPresentationInfo() const + { + return {}; + } }; } // namespace vcl diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index 886c796e6c67..f7cc49850f8f 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -570,7 +570,7 @@ public: const AlphaMask& rAlphaMask); // access to SystemDependentDataHolder, to support overload in derived class(es) - SAL_DLLPRIVATE const basegfx::SystemDependentDataHolder* accessSystemDependentDataHolder() const; + const basegfx::SystemDependentDataHolder* accessSystemDependentDataHolder() const; public: /** ReassignWithSize and recalculate bitmap. diff --git a/include/vcl/graphic/GraphicMetadata.hxx b/include/vcl/graphic/GraphicMetadata.hxx index 33ee9d81c3b4..2aa9f1cb4107 100644 --- a/include/vcl/graphic/GraphicMetadata.hxx +++ b/include/vcl/graphic/GraphicMetadata.hxx @@ -51,6 +51,7 @@ enum class GraphicFileFormat SVGZ = 0x00fc, APNG = 0x00fd }; + struct GraphicMetadata { Size maPixSize{}; @@ -63,6 +64,7 @@ struct GraphicMetadata sal_uInt8 mnNumberOfImageComponents = 0; bool mbIsTransparent = false; bool mbIsAlpha = false; + bool mbIsAnimated = false; }; #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index bf1f64237a1f..6d4dcde025f2 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -134,8 +134,6 @@ class VCL_DLLPUBLIC GraphicDescriptor final GraphicMetadata aMetadata; bool bOwnStream; - SAL_DLLPRIVATE void ImpConstruct(); - SAL_DLLPRIVATE bool ImpDetectBMP( SvStream& rStm, bool bExtendedInfo ); SAL_DLLPRIVATE bool ImpDetectGIF( SvStream& rStm, bool bExtendedInfo ); SAL_DLLPRIVATE bool ImpDetectJPG( SvStream& rStm, bool bExtendedInfo ); diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 2725642763c0..57836fc59794 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -837,7 +837,7 @@ public: @returns the global instance of the SystemDependentDataManager */ - SAL_DLLPRIVATE static basegfx::SystemDependentDataManager& GetSystemDependentDataManager(); + static basegfx::SystemDependentDataManager& GetSystemDependentDataManager(); /** Get the first top-level window of the application. diff --git a/include/vcl/toolkit/ivctrl.hxx b/include/vcl/toolkit/ivctrl.hxx index 9441f46a7a30..2973b74f2015 100644 --- a/include/vcl/toolkit/ivctrl.hxx +++ b/include/vcl/toolkit/ivctrl.hxx @@ -37,10 +37,8 @@ class SvxIconChoiceCtrl_Impl; enum class SvxIconViewFlags { NONE = 0x0000, - POS_LOCKED = 0x0001, - SELECTED = 0x0002, - FOCUSED = 0x0004, - POS_MOVED = 0x0008, // Moved by Drag and Drop, but not logged + SELECTED = 0x0001, + FOCUSED = 0x0002, }; namespace o3tl { @@ -75,14 +73,6 @@ class SvxIconChoiceCtrlEntry tools::Rectangle aGridRect; // Only valid in Grid-mode sal_Int32 nPos; - /* - The insert position in the Insertlist is equal to the (sort) order stated at the Insert - (-> Order of the anchors in the anchors-list!). In "AutoArrange" mode the visible order - can differ. The entries will be linked because of this. - */ - SvxIconChoiceCtrlEntry* pblink; // backward (linker neighbour) - SvxIconChoiceCtrlEntry* pflink; // forward (rechter neighbour) - SvxIconChoiceCtrlTextMode eTextMode; sal_uInt16 nX,nY; // for keyboard control SvxIconViewFlags nFlags; @@ -91,23 +81,6 @@ class SvxIconChoiceCtrlEntry void SetFlags( SvxIconViewFlags nMask ) { nFlags |= nMask; } void AssignFlags( SvxIconViewFlags _nFlags ) { nFlags = _nFlags; } - // set left neighbour (A <-> B ==> A <-> this <-> B) - void SetBacklink( SvxIconChoiceCtrlEntry* pA ) - { - pA->pflink->pblink = this; // X <- B - this->pflink = pA->pflink; // X -> B - this->pblink = pA; // A <- X - pA->pflink = this; // A -> X - } - // Unlink (A <-> this <-> B ==> A <-> B) - void Unlink() - { - this->pblink->pflink = this->pflink; - this->pflink->pblink = this->pblink; - this->pflink = nullptr; - this->pblink = nullptr; - } - public: SvxIconChoiceCtrlEntry( OUString aText, Image aImage ); @@ -122,20 +95,6 @@ public: SvxIconViewFlags GetFlags() const { return nFlags; } bool IsSelected() const { return bool(nFlags & SvxIconViewFlags::SELECTED); } bool IsFocused() const { return bool(nFlags & SvxIconViewFlags::FOCUSED); } - bool IsPosLocked() const { return bool(nFlags & SvxIconViewFlags::POS_LOCKED); } -}; - -class SvxIconChoiceCtrlColumnInfo -{ - tools::Long nWidth; - -public: - SvxIconChoiceCtrlColumnInfo() : - nWidth( 100 ) {} - SvxIconChoiceCtrlColumnInfo( const SvxIconChoiceCtrlColumnInfo& ); - - void SetWidth( tools::Long nWd ) { nWidth = nWd; } - tools::Long GetWidth() const { return nWidth; } }; @@ -156,7 +115,6 @@ public: WB_NOCOLUMNHEADER // No Headerbar in Details view (Headerbar not implemented) WB_NOPOINTERFOCUS // No GrabFocus at MouseButtonDown WB_HIGHLIGHTFRAME // The entry beneath the mouse will be highlighted - WB_NOASYNCSELECTHDL // Do not collect events -> Selection handlers will be called synchronously */ #define WB_ICON WB_RECTSTYLE @@ -164,14 +122,11 @@ public: #define WB_DETAILS WB_VCENTER #define WB_NOHSCROLL WB_SPIN #define WB_NOVSCROLL WB_DRAG -#define WB_NOSELECTION WB_REPEAT #define WB_NODRAGSELECTION WB_PATHELLIPSIS -#define WB_SMART_ARRANGE 0x01000000 // used to be WB_PASSWORD #define WB_ALIGN_TOP WB_TOP #define WB_ALIGN_LEFT WB_LEFT #define WB_NOCOLUMNHEADER WB_CENTER #define WB_HIGHLIGHTFRAME WB_IGNORETAB -#define WB_NOASYNCSELECTHDL WB_NOLABEL class MnemonicGenerator; @@ -186,7 +141,6 @@ class UNLESS_MERGELIBS_MORE(VCL_DLLPUBLIC) SvtIconChoiceCtrl final : public Cont virtual void Command( const CommandEvent& rCEvt ) override; virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; - virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; virtual void MouseMove( const MouseEvent& rMEvt ) override; virtual void Resize() override; virtual void GetFocus() override; @@ -194,12 +148,6 @@ class UNLESS_MERGELIBS_MORE(VCL_DLLPUBLIC) SvtIconChoiceCtrl final : public Cont void ClickIcon(); virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; virtual void RequestHelp( const HelpEvent& rHEvt ) override; - static void DrawEntryImage( - SvxIconChoiceCtrlEntry const * pEntry, - const Point& rPos, - OutputDevice& rDev ); - - static OUString GetEntryText( SvxIconChoiceCtrlEntry const * pEntry ); virtual void FillLayoutData() const override; @@ -212,7 +160,6 @@ public: virtual void dispose() override; WinBits GetStyle() const; - void SetSelectionMode(SelectionMode eMode); void SetFont( const vcl::Font& rFont ); void SetPointFont( const vcl::Font& rFont ); @@ -239,13 +186,8 @@ public: void SetCursor( SvxIconChoiceCtrlEntry* pEntry ); SvxIconChoiceCtrlEntry* GetCursor() const; - // sal_uLong is the position of the selected element in the list SvxIconChoiceCtrlEntry* GetSelectedEntry() const; -#ifdef DBG_UTIL - void SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry ); -#endif - tools::Rectangle GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const; tools::Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const; diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx index 2dda5912fbca..56c2f86a9234 100644 --- a/lotuswordpro/source/filter/lwpfribmark.cxx +++ b/lotuswordpro/source/filter/lwpfribmark.cxx @@ -150,7 +150,7 @@ void LwpFribBookMark::RegisterStyle(LwpFoundry* pFoundry) xMarkStart->SetDivision(sDivision); xMarkStart->SetName(name); pMarkMgr->AddXFBookmarkStart(name, xMarkStart.get()); //add to map - m_xStart = xMarkStart; + m_xStart = std::move(xMarkStart); } else if (type == MARKER_END) { @@ -158,7 +158,7 @@ void LwpFribBookMark::RegisterStyle(LwpFoundry* pFoundry) xMarkEnd->SetDivision(sDivision); xMarkEnd->SetName(name); pMarkMgr->AddXFBookmarkEnd(name, xMarkEnd.get()); //add to map - m_xEnd = xMarkEnd; + m_xEnd = std::move(xMarkEnd); } } diff --git a/odk/CppunitTest_odk_checkapi.mk b/odk/CppunitTest_odk_checkapi.mk index 1c93be6a2473..e27879d91e1f 100644 --- a/odk/CppunitTest_odk_checkapi.mk +++ b/odk/CppunitTest_odk_checkapi.mk @@ -15,6 +15,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,odk_checkapi,\ $(eval $(call gb_CppunitTest_add_cxxflags,odk_checkapi,\ $(gb_CXX03FLAGS) \ + $(if $(ENABLE_GTK3),$(GTK3_CFLAGS)) \ )) $(eval $(call gb_CppunitTest_set_external_code,odk_checkapi)) diff --git a/odk/Package_odk_headers.mk b/odk/Package_odk_headers.mk index f4f7d9ba3a73..c103c23d4b27 100644 --- a/odk/Package_odk_headers.mk +++ b/odk/Package_odk_headers.mk @@ -1,4 +1,3 @@ - # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- # # This file is part of the LibreOffice project. @@ -185,6 +184,7 @@ $(eval $(call gb_Package_add_files_with_dir,odk_headers,$(SDKDIRNAME)/include,\ uno/mapping.hxx \ uno/sequence2.h \ uno/threadpool.h \ + $(if $(ENABLE_GTK3),LibreOfficeKit/LibreOfficeKitGtk.h) \ LibreOfficeKit/LibreOfficeKit.hxx \ LibreOfficeKit/LibreOfficeKitEnums.h \ LibreOfficeKit/LibreOfficeKit.h \ diff --git a/officecfg/registry/data/org/openoffice/VCL.xcu b/officecfg/registry/data/org/openoffice/VCL.xcu index 2d472da4d2e5..6387f81c3e94 100644 --- a/officecfg/registry/data/org/openoffice/VCL.xcu +++ b/officecfg/registry/data/org/openoffice/VCL.xcu @@ -892,6 +892,25 @@ + + + Agency FB + + + Agency FB + + + Normal,SansSerif + + + + + Agdasima + + + Normal,SansSerif + + albanyamt;albany;liberationsans;arial;nimbussansl;helvetica;lucidasans;lucida;geneva;helmet;sansserif;nimbussans;andalesansui;arialunicodems;lucidaunicode @@ -1141,9 +1160,20 @@ Normal,SansSerif + + + Baskerville Old Face + + + Baskerville Old Face + + + Normal,Serif + + - thorndaleamt;thorndale;timesnewroman;nimbusromanno9l;times;timesroman;newyork;timmons;serif;lucidaserif;lucidabright;roman;nimbusromanno9;bookman;itcbookman;garamond;garamondmt;palatino + Bacasime Antique;thorndaleamt;thorndale;timesnewroman;nimbusromanno9l;times;timesroman;newyork;timmons;serif;lucidaserif;lucidabright;roman;nimbusromanno9;bookman;itcbookman;garamond;garamondmt;palatino @@ -1192,6 +1222,17 @@ CJK,CJK_KR + + + Berlin Sans FB + + + Berlin Sans FB + + + Normal,SansSerif + + thorndaleamt;thorndale;timesnewroman;nimbusromanno9l;times;timesroman;newyork;timmons;serif;lucidaserif;lucidabright;roman;nimbusromanno9;bookman;itcbookman;garamond;garamondmt;palatino @@ -1209,6 +1250,14 @@ Normal,Serif + + + Belanosima + + + Normal,SansSerif + + dejavusans @@ -1413,6 +1462,17 @@ Normal,SansSerif + + + Cooper Black + + + Cooper Black + + + Normal,Serif + + Normal,SansSerif,Fixed @@ -1423,6 +1483,14 @@ Normal,Serif + + + Caprasimo + + + Normal,Serif + + Normal,SansSerif @@ -3094,7 +3162,7 @@ - zapfchancery;itczapfchancery;monotypecorsiva;corsiva;chancery;chanceryl;lucidacalligraphy;lucidahandwriting;palacescript;palacescriptmt;arioso;shelley;andymt;comicsansms;andy;kidprint; + Lugrasimo;zapfchancery;itczapfchancery;monotypecorsiva;corsiva;chancery;chanceryl;lucidacalligraphy;lucidahandwriting;palacescript;palacescriptmt;arioso;shelley;andymt;comicsansms;andy;kidprint; @@ -3145,7 +3213,7 @@ - andymt;comicsansms;andy;kidprint;zapfchancery;itczapfchancery;monotypecorsiva;corsiva;chancery;chanceryl;lucidacalligraphy;lucidahandwriting;palacescript;palacescriptmt;arioso;shelley + Lumanosimo;andymt;comicsansms;andy;kidprint;zapfchancery;itczapfchancery;monotypecorsiva;corsiva;chancery;chanceryl;lucidacalligraphy;lucidahandwriting;palacescript;palacescriptmt;arioso;shelley @@ -3160,6 +3228,14 @@ Italic,Script,Handwriting + + + Lunasima + + + Normal,SansSerif + + albanyamt;albany;arial;nimbussansl;helvetica;lucidasans;lucida;geneva;helmet;sansserif;nimbussans;andalesansui;arialunicodems;lucidaunicode @@ -3262,6 +3338,39 @@ Normal,Fixed,Typewriter + + + Lucida Calligraphy + + + Lucida Calligraphy + + + Italic,Script,Chancery + + + + + Lucida Grande + + + Lucida Grande + + + Normal,SansSerif + + + + + Lucida Handwriting + + + Lucida Handwriting + + + Italic,Script,Handwriting + + starsymbol;opensymbol;starbats;wingdings;zapfdingbats;itczapfdingbats;monotypesorts;dingbats;lucidadingbats;lucidasansdingbats;webdings;symbol;standardsymbols;standardsymbolsl;andalesansui;arialunicodems;lucidaunicode diff --git a/oox/qa/unit/data/connectorConnection.pptx b/oox/qa/unit/data/connectorConnection.pptx new file mode 100644 index 000000000000..e8a86a157151 Binary files /dev/null and b/oox/qa/unit/data/connectorConnection.pptx differ diff --git a/oox/qa/unit/data/curvedConnectors.pptx b/oox/qa/unit/data/curvedConnectors.pptx new file mode 100644 index 000000000000..a961aed03444 Binary files /dev/null and b/oox/qa/unit/data/curvedConnectors.pptx differ diff --git a/oox/qa/unit/data/elbowConnectors.pptx b/oox/qa/unit/data/elbowConnectors.pptx new file mode 100644 index 000000000000..df876f4e73c2 Binary files /dev/null and b/oox/qa/unit/data/elbowConnectors.pptx differ diff --git a/sd/qa/unit/data/pptx/standardConnectors.pptx b/oox/qa/unit/data/standardConnectors.pptx similarity index 100% rename from sd/qa/unit/data/pptx/standardConnectors.pptx rename to oox/qa/unit/data/standardConnectors.pptx diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index ed2cd7965a78..28266b8783c6 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -39,6 +39,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -91,6 +92,114 @@ uno::Reference OoxShapeTest::getShapeByName(std::u16string_view return xRet; } +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testConnectorConnection) +{ + loadFromFile(u"connectorConnection.pptx"); + + uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + + uno::Reference xConnector(xDrawPage->getByIndex(0), uno::UNO_QUERY); + uno::Reference xConnectorProps(xConnector, uno::UNO_QUERY); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 0 + // - Actual : -1 + // i.e. the connector shape is not attaching to the shape + sal_Int32 nStartGlueId; + xConnectorProps->getPropertyValue("StartGluePointIndex") >>= nStartGlueId; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nStartGlueId); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 2 + // - Actual : -1 + // i.e. the connector shape is not attaching to the shape + sal_Int32 nEndGlueId; + xConnectorProps->getPropertyValue("EndGluePointIndex") >>= nEndGlueId; + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), nEndGlueId); +} + +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testElbowConnectors) +{ + loadFromFile(u"elbowConnectors.pptx"); + + sal_Int32 nEdgeLineDelta; + uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + + uno::Reference xShape1(xDrawPage->getByIndex(2), uno::UNO_QUERY); + uno::Reference xShapeProps1(xShape1, uno::UNO_QUERY); + xShapeProps1->getPropertyValue(UNO_NAME_EDGELINE1DELTA) >>= nEdgeLineDelta; + CPPUNIT_ASSERT_EQUAL(sal_Int32(-2756), nEdgeLineDelta); + + uno::Reference xShape2(xDrawPage->getByIndex(5), uno::UNO_QUERY); + uno::Reference xShapeProps2(xShape2, uno::UNO_QUERY); + xShapeProps2->getPropertyValue(UNO_NAME_EDGELINE1DELTA) >>= nEdgeLineDelta; + CPPUNIT_ASSERT_EQUAL(sal_Int32(-805), nEdgeLineDelta); +} + +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testCurvedConnectors) +{ + loadFromFile(u"curvedConnectors.pptx"); + + sal_Int32 nEdgeLineDelta; + uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + + uno::Reference xShape1(xDrawPage->getByIndex(2), uno::UNO_QUERY); + uno::Reference xShapeProps1(xShape1, uno::UNO_QUERY); + xShapeProps1->getPropertyValue(UNO_NAME_EDGELINE1DELTA) >>= nEdgeLineDelta; + CPPUNIT_ASSERT_EQUAL(sal_Int32(-2364), nEdgeLineDelta); + xShapeProps1->getPropertyValue(UNO_NAME_EDGELINE2DELTA) >>= nEdgeLineDelta; + CPPUNIT_ASSERT_EQUAL(sal_Int32(4250), nEdgeLineDelta); + xShapeProps1->getPropertyValue(UNO_NAME_EDGELINE3DELTA) >>= nEdgeLineDelta; + CPPUNIT_ASSERT_EQUAL(sal_Int32(2051), nEdgeLineDelta); + + uno::Reference xShape2(xDrawPage->getByIndex(5), uno::UNO_QUERY); + uno::Reference xShapeProps2(xShape2, uno::UNO_QUERY); + xShapeProps2->getPropertyValue(UNO_NAME_EDGELINE1DELTA) >>= nEdgeLineDelta; + CPPUNIT_ASSERT_EQUAL(sal_Int32(3019), nEdgeLineDelta); +} + +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testStandardConnectors) +{ + loadFromFile(u"standardConnectors.pptx"); + + uno::Reference xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + + sal_Int32 aEdgeValue[] = { -1352, -2457, 2402, // bentConnector5 + 3977, 0, 0, // bentConnector3 + -2899, 0, 0, // bentConnector3 + -1260, 4612, 0, // bentConnector4 + -1431, -2642, 0, // bentConnector4 + 3831, 3438, -1578 }; // bentConnector5 + sal_Int32 nCount = 0; + sal_Int32 nEdgeLineDelta; + for (size_t i = 0; i < 10; i++) + { + uno::Reference xShape(xDrawPage->getByIndex(i), uno::UNO_QUERY); + uno::Reference xShapeProps(xShape, uno::UNO_QUERY); + bool bConnector = xShapeProps->getPropertySetInfo()->hasPropertyByName(u"EdgeKind"_ustr); + if (bConnector) + { + xShapeProps->getPropertyValue(UNO_NAME_EDGELINE1DELTA) >>= nEdgeLineDelta; + CPPUNIT_ASSERT_EQUAL(aEdgeValue[nCount], nEdgeLineDelta); + nCount++; + xShapeProps->getPropertyValue(UNO_NAME_EDGELINE2DELTA) >>= nEdgeLineDelta; + CPPUNIT_ASSERT_EQUAL(aEdgeValue[nCount], nEdgeLineDelta); + nCount++; + xShapeProps->getPropertyValue(UNO_NAME_EDGELINE3DELTA) >>= nEdgeLineDelta; + CPPUNIT_ASSERT_EQUAL(aEdgeValue[nCount], nEdgeLineDelta); + nCount++; + } + } +} + CPPUNIT_TEST_FIXTURE(OoxShapeTest, testGroupTransform) { loadFromFile(u"tdf141463_GroupTransform.pptx"); diff --git a/oox/source/drawingml/customshapepresetdata.cxx b/oox/source/drawingml/customshapepresetdata.cxx index 597f19b5943e..b03d583a8cdf 100644 --- a/oox/source/drawingml/customshapepresetdata.cxx +++ b/oox/source/drawingml/customshapepresetdata.cxx @@ -162,6 +162,18 @@ awt::Rectangle lcl_parseRectangle(std::string_view rValue) return aRectangle; } +sal_Int32 lcl_parseDirection(std::string_view rValue) +{ + sal_Int32 aDirection; + // We expect the following here: Direction + static const char aExpectedWidthPrefix[] = "Dir = (long) "; + assert(o3tl::starts_with(rValue, aExpectedWidthPrefix)); + sal_Int32 nIndex = strlen(aExpectedWidthPrefix); + aDirection = o3tl::toInt32(rValue.substr(nIndex)); + + return aDirection; +} + awt::Size lcl_parseSize(std::string_view rValue) { awt::Size aSize; @@ -582,6 +594,73 @@ void lcl_parsePathGluePoints(std::vector& rPath, std::stri } } +void lcl_parsePathGluePointLeavingDirectionsValues(std::vector& rPath, + std::string_view rValue) +{ + std::vector aDirection; + sal_Int32 nLevel = 0; + sal_Int32 nStart = 0; + for (size_t i = 0; i < rValue.size(); ++i) + { + if (rValue[i] == '{') + { + if (!nLevel) + nStart = i; + nLevel++; + } + else if (rValue[i] == '}') + { + nLevel--; + if (!nLevel) + aDirection.push_back(lcl_parseDirection( + rValue.substr(nStart + strlen("{ "), i - nStart - strlen(" },")))); + } + } + + beans::PropertyValue aPropertyValue; + aPropertyValue.Name = "GluePointLeavingDirections"; + aPropertyValue.Value <<= comphelper::containerToSequence(aDirection); + rPath.push_back(aPropertyValue); +} + +void lcl_parsePathGluePointLeavingDirections(std::vector& rPath, + std::string_view rValue) +{ + sal_Int32 nLevel = 0; + bool bIgnore = false; + sal_Int32 nStart = 0; + for (size_t i = 0; i < rValue.size(); ++i) + { + if (rValue[i] == '{') + { + if (!nLevel) + bIgnore = true; + nLevel++; + } + else if (rValue[i] == '}') + { + nLevel--; + if (!nLevel) + bIgnore = false; + } + else if (rValue[i] == ',' && !bIgnore) + { + std::string_view aToken = rValue.substr(nStart, i - nStart); + static const char aExpectedPrefix[] = "Value = (any) { ([]long) { "; + if (o3tl::starts_with(aToken, aExpectedPrefix)) + { + aToken = aToken.substr(strlen(aExpectedPrefix), + aToken.size() - strlen(aExpectedPrefix) - strlen(" } }")); + lcl_parsePathGluePointLeavingDirectionsValues(rPath, aToken); + } + else if (!o3tl::starts_with(aToken, "Name =") && !o3tl::starts_with(aToken, "Handle =")) + SAL_WARN("oox", + "lcl_parsePathGluePointLeavingDirections: unexpected token: " << aToken); + nStart = i + strlen(", "); + } + } +} + void lcl_parsePathSegmentValues(std::vector& rPath, std::string_view rValue) { std::vector aSegments; @@ -804,6 +883,8 @@ void lcl_parsePath(std::vector& rPath, std::string_view rV lcl_parsePathCoordinates(rPath, aToken); else if (o3tl::starts_with(aToken, "Name = \"GluePoints\"")) lcl_parsePathGluePoints(rPath, aToken); + else if (o3tl::starts_with(aToken, "Name = \"GluePointLeavingDirections\"")) + lcl_parsePathGluePointLeavingDirections(rPath, aToken); else if (o3tl::starts_with(aToken, "Name = \"Segments\"")) lcl_parsePathSegments(rPath, aToken); else if (o3tl::starts_with(aToken, "Name = \"TextFrames\"")) diff --git a/oox/source/drawingml/customshapes/oox-drawingml-cs-presets b/oox/source/drawingml/customshapes/oox-drawingml-cs-presets index 004bf6abfadd..4ef1ccf5d9dd 100644 --- a/oox/source/drawingml/customshapes/oox-drawingml-cs-presets +++ b/oox/source/drawingml/customshapes/oox-drawingml-cs-presets @@ -979,7 +979,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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, 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) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, 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) 3 }, Type = (short) 1 } } } }, 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) 2, Count = (short) 3 }, { 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) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 1 }, 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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, 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) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, 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) 3 }, Type = (short) 1 } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "GluePointLeavingDirections", Handle = (long) 0, Value = (any) { ([]long) { { Dir = (long) 3 }, { Dir = (long) 1 }, { Dir = (long) 4 }, { Dir = (long) 2 } } }, 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) 2, Count = (short) 3 }, { 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) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 1 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } Type "ooxml-non-primitive" ViewBox @@ -1081,7 +1081,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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { 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) 0 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 17 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 18 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, 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) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, 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) 7 }, 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) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 11 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, 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) 7 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 } } } }, 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) 4 }, { 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) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, 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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { 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) 0 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 17 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 18 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, 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) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, 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) 7 }, 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) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, 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) 7 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "GluePointLeavingDirections", Handle = (long) 0, Value = (any) { ([]long) { { Dir = (long) 3 }, { Dir = (long) 3 }, { Dir = (long) 1 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 2 }, { 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) 4 }, { 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) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } Type "ooxml-non-primitive" ViewBox @@ -1744,7 +1744,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) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 20 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 17 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 18 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 20 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, 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) 17 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 18 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 20 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 20 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, 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 = "Segments", Handle = (long) 0, Value = (any) { ([]com.sun.star.drawing.EnhancedCustomShapeSegment) { { Command = (short) 1, Count = (short) 1 }, { Command = (short) 2, Count = (short) 6 }, { 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) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 17 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, 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) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 20 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 17 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 18 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 20 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, 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) 17 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 18 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 20 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 20 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, 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) 2 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 1 }, { 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) 2, Count = (short) 6 }, { 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) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 19 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 17 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } Type "ooxml-non-primitive" ViewBox @@ -1761,7 +1761,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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, 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) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 23 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, 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) 10 }, 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) 23 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, 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) 10 }, 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) 8 }, 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) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, Type = (short) 1 } } } }, 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) 2, Count = (short) 5 }, { 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) 19 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 20 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, 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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, 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) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 23 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, 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) 10 }, 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) 23 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, 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) 10 }, 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) 8 }, 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) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, Type = (short) 1 } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "GluePointLeavingDirections", Handle = (long) 0, Value = (any) { ([]long) { { Dir = (long) 2 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 1 }, { Dir = (long) 3 }, { 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) 2, Count = (short) 5 }, { 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) 19 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 20 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } Type "ooxml-non-primitive" ViewBox @@ -2254,7 +2254,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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, 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) 4 }, 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) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, 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) 4 }, 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) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, 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 = "Segments", Handle = (long) 0, Value = (any) { ([]com.sun.star.drawing.EnhancedCustomShapeSegment) { { Command = (short) 1, Count = (short) 1 }, { Command = (short) 2, Count = (short) 7 }, { 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) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, 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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, 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) 4 }, 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) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, 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) 4 }, 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) 2 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, 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) 2 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 1 }, { Dir = (long) 1 }, { Dir = (long) 3 }, { 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) 2, Count = (short) 7 }, { 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) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } Type "ooxml-non-primitive" ViewBox @@ -2271,7 +2271,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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 23 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, 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) 9 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 } } } }, 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) 2, Count = (short) 3 }, { 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) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, 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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 23 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, 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) 9 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 9 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 22 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 21 }, Type = (short) 1 } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "GluePointLeavingDirections", Handle = (long) 0, Value = (any) { ([]long) { { Dir = (long) 3 }, { Dir = (long) 3 }, { Dir = (long) 2 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 1 } } }, 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) 2, Count = (short) 3 }, { 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) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } Type "ooxml-non-primitive" ViewBox @@ -2288,7 +2288,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) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, 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) 10 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 } } } }, 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) 2, Count = (short) 4 }, { 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) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 17 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, 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) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, 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) 10 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "GluePointLeavingDirections", Handle = (long) 0, Value = (any) { ([]long) { { Dir = (long) 3 }, { Dir = (long) 1 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 2 } } }, 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) 2, Count = (short) 4 }, { 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) 12 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 17 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 13 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 16 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } Type "ooxml-non-primitive" ViewBox @@ -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 = "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) 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 } } Type "ooxml-non-primitive" ViewBox @@ -2611,7 +2611,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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, 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) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, 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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, , { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, 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) 4 }, 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) 4 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, 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) 3 }, Type = (short) 1 } } } }, 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) 2, Count = (short) 2 }, { 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) 7 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 1 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, 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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, 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) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, 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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, , { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, 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) 4 }, 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) 4 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, 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) 3 }, Type = (short) 1 } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "GluePointLeavingDirections", Handle = (long) 0, Value = (any) { ([]long) { { Dir = (long) 3 }, { Dir = (long) 1 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 2 } } }, 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) 2, Count = (short) 2 }, { 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) 7 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 1 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } Type "ooxml-non-primitive" ViewBox @@ -2985,7 +2985,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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, 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) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, 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) 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) 6 }, 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 = "Segments", Handle = (long) 0, Value = (any) { ([]com.sun.star.drawing.EnhancedCustomShapeSegment) { { Command = (short) 1, Count = (short) 1 }, { Command = (short) 2, Count = (short) 3 }, { 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) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, 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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 15 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, 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) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 3 }, 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) 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) 6 }, 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 = "GluePointLeavingDirections", Handle = (long) 0, Value = (any) { ([]long) { { Dir = (long) 3 }, { Dir = (long) 1 }, { Dir = (long) 4 }, { Dir = (long) 2 } } }, 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) 2, Count = (short) 3 }, { 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) 8 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 10 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 11 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 14 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } Type "ooxml-non-primitive" ViewBox @@ -3002,7 +3002,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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, 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) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 1 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, 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) 6 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 } } } }, 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) 2, Count = (short) 2 }, { 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) 1 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, 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) 0 }, Type = (short) 0 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, 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) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 0 }, Type = (short) 0 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 1 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, 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) 6 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 2 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 7 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 } }, { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE }, { Name = "GluePointLeavingDirections", Handle = (long) 0, Value = (any) { ([]long) { { Dir = (long) 3 }, { Dir = (long) 1 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 4 }, { Dir = (long) 2 } } }, 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) 2, Count = (short) 2 }, { 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) 1 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 5 }, Type = (short) 1 } }, BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { First = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 4 }, Type = (short) 1 }, Second = (com.sun.star.drawing.EnhancedCustomShapeParameter) { Value = (any) { (long) 6 }, Type = (short) 1 } } } } }, State = (com.sun.star.beans.PropertyState) DIRECT_VALUE } } Type "ooxml-non-primitive" ViewBox diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 4c7de78b8817..ce94175a94aa 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -383,7 +383,7 @@ void Shape::addShape( const basegfx::B2DHomMatrix& aTransformation, const FillProperties& rShapeOrParentShapeFillProps, ShapeIdMap* pShapeMap, - oox::drawingml::ShapePtr pParentGroupShape) + const oox::drawingml::ShapePtr& pParentGroupShape) { SAL_INFO("oox.drawingml", "Shape::addShape: id='" << msId << "'"); @@ -908,7 +908,7 @@ Reference< XShape > const & Shape::createAndInsert( bool bDoNotInsertEmptyTextBody, basegfx::B2DHomMatrix& aParentTransformation, const FillProperties& rShapeOrParentShapeFillProps, - oox::drawingml::ShapePtr pParentGroupShape) + const oox::drawingml::ShapePtr& pParentGroupShape) { bool bIsEmbMedia = false; SAL_INFO("oox.drawingml", "Shape::createAndInsert: id='" << msId << "' service='" << rServiceName << "'"); diff --git a/oox/source/ppt/comments.cxx b/oox/source/ppt/comments.cxx index b85d95b4a692..37fa924e786f 100644 --- a/oox/source/ppt/comments.cxx +++ b/oox/source/ppt/comments.cxx @@ -20,14 +20,13 @@ void CommentAuthorList::setValues(const CommentAuthorList& list) { for (auto const& author : list.cmAuthorLst) { - CommentAuthor temp; - // TODO JNA : why not doing push_back at the end instead of using back()? - cmAuthorLst.push_back(temp); - cmAuthorLst.back().clrIdx = author.clrIdx; - cmAuthorLst.back().id = author.id; - cmAuthorLst.back().initials = author.initials; - cmAuthorLst.back().lastIdx = author.lastIdx; - cmAuthorLst.back().name = author.name; + CommentAuthor commentAuthor; + commentAuthor.clrIdx = author.clrIdx; + commentAuthor.id = author.id; + commentAuthor.initials = author.initials; + commentAuthor.lastIdx = author.lastIdx; + commentAuthor.name = author.name; + cmAuthorLst.push_back(commentAuthor); } } @@ -77,6 +76,17 @@ OUString Comment::getAuthor(const CommentAuthorList& list) return u"Anonymous"_ustr; } +OUString Comment::getInitials(const CommentAuthorList& list) +{ + const sal_Int32 nId = authorId.toInt32(); + for (auto const& author : list.cmAuthorLst) + { + if (author.id.toInt32() == nId) + return author.initials; + } + return u"A"_ustr; +} + const Comment& CommentList::getCommentAtIndex(int index) { if (index < 0 || o3tl::make_unsigned(index) >= cmLst.size()) diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index c8783a7da976..9a1ea8679cef 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -595,6 +595,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage ::oox::drawingml::convertEmuToHmm( nPosX ) * 15.87, ::oox::drawingml::convertEmuToHmm( nPosY ) * 15.87 ) ); xAnnotation->setAuthor( aComment.getAuthor(maAuthorList) ); + xAnnotation->setInitials( aComment.getInitials(maAuthorList) ); xAnnotation->setDateTime( aComment.getDateTime() ); uno::Reference< text::XText > xText( xAnnotation->getTextRange() ); xText->setString( aComment.get_text()); diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index bc7fc3514a68..915ce1a1d733 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -47,6 +48,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::oox::core; @@ -134,12 +136,35 @@ sal_Int16 SlidePersist::getLayoutFromValueToken() const return nLayout; } +static void lcl_createShapeMap(oox::drawingml::ShapePtr rShapePtr, + oox::drawingml::ShapeIdMap& rShapeMap) +{ + std::vector& rChildren = rShapePtr->getChildren(); + if (!rChildren.empty()) + { + for (const auto& pIt : rChildren) + { + if (pIt->isConnectorShape()) + { + rShapeMap[pIt->getId()] = pIt; // add child itself + lcl_createShapeMap(pIt, rShapeMap); // and all its descendants + } + } + } + else + { + if(rShapePtr->isConnectorShape()) + rShapeMap[rShapePtr->getId()] = rShapePtr; + } +} + void SlidePersist::createXShapes( XmlFilterBase& rFilterBase ) { applyTextStyles( rFilterBase ); Reference< XShapes > xShapes( getPage() ); std::vector< oox::drawingml::ShapePtr >& rShapes( maShapesPtr->getChildren() ); + oox::drawingml::ShapeIdMap aConnectorShapeMap; for (auto const& shape : rShapes) { @@ -151,24 +176,42 @@ void SlidePersist::createXShapes( XmlFilterBase& rFilterBase ) if ( pPPTShape ) { pPPTShape->addShape( rFilterBase, *this, getTheme().get(), xShapes, aTransformation, &getShapeMap() ); - if (pPPTShape->isConnectorShape()) - maConnectorShapeId.push_back(pPPTShape->getId()); - if (!pPPTShape->getChildren().empty()) - { - for (size_t i = 0; i < pPPTShape->getChildren().size(); i++) - { - if (pPPTShape->getChildren()[i]->isConnectorShape()) - maConnectorShapeId.push_back(pPPTShape->getChildren()[i]->getId()); - } - } + + const auto& pIter = maShapeMap.find(pPPTShape->getId()); + if (pIter != maShapeMap.end()) + lcl_createShapeMap(pIter->second, aConnectorShapeMap); } else child->addShape( rFilterBase, getTheme().get(), xShapes, aTransformation, maShapesPtr->getFillProperties(), &getShapeMap() ); } } - if (!maConnectorShapeId.empty()) - createConnectorShapeConnection(); + if (!aConnectorShapeMap.empty()) + { + for (auto& pIt : aConnectorShapeMap) + { + ConnectorHelper::applyConnections(pIt.second, getShapeMap()); + + SdrObject* pObj = SdrObject::getSdrObjectFromXShape(pIt.second->getXShape()); + SdrModel& rModel(pObj->getSdrModelFromSdrObject()); + rModel.setLock(false); + + if (pIt.second->getConnectorName() == u"bentConnector3"_ustr + || pIt.second->getConnectorName() == u"bentConnector4"_ustr + || pIt.second->getConnectorName() == u"bentConnector5"_ustr) + { + ConnectorHelper::applyBentHandleAdjustments(pIt.second); + } + else if (pIt.second->getConnectorName() == u"curvedConnector3"_ustr + || pIt.second->getConnectorName() == u"curvedConnector4"_ustr + || pIt.second->getConnectorName() == u"curvedConnector5"_ustr) + { + ConnectorHelper::applyCurvedHandleAdjustments(pIt.second); + } + else // bentConnector2 + createConnectorShapeConnection(pIt.second); + } + } Reference< XAnimationNodeSupplier > xNodeSupplier( getPage(), UNO_QUERY); if( !xNodeSupplier.is() ) @@ -419,282 +462,126 @@ static void lcl_SetEdgeLineValue(uno::Reference& rXConnector, nEndA = lcl_GetAngle(xEndSp, aEndPt); } - // bentConnector3, bentConnector4, bentConnector5 - if (!rShapePtr->getConnectorAdjustments().empty()) + const OUString sConnectorName = rShapePtr->getConnectorName(); + if (sConnectorName == "bentConnector2") { - sal_Int32 nAdjustValue = 0; - for (size_t i = 0; i < rShapePtr->getConnectorAdjustments().size(); i++) + awt::Size aConnSize = rXConnector->getSize(); + if (xStartSp.is() || xEndSp.is()) { - bool bVertical = false; - if (xStartSp.is() || xEndSp.is()) - bVertical = xStartSp.is() ? ((nStartA == 90 || nStartA == 270) ? true : false) - : ((nEndA == 90 || nEndA == 270) ? true : false); - else + if (nStartA >= 0) { - sal_Int32 nAng = rShapePtr->getRotation() / 60000; - bVertical = (nAng == 90 || nAng == 270) ? true : false; - } - - if (i % 2 == 1) - bVertical = !bVertical; - - nAdjustValue = rShapePtr->getConnectorAdjustments()[i].toInt32(); - if (bVertical) - { - sal_Int32 nY = aStartPt.Y + ((nAdjustValue * (aEndPt.Y - aStartPt.Y)) / 100000); - if (xStartSp.is() && xEndSp.is()) + switch (nStartA) { - if (aS.Top() <= aE.Top()) - { - if (nStartA == 270 && i != 2) - nEdge = nY - aS.Top(); - else - { - if (aS.Bottom() < aE.Top() && nEndA != 90) - { - nEdge = nY - (aS.Bottom() + ((aE.Top() - aS.Bottom()) / 2)); - } - else - nEdge = nY - aE.Bottom(); - } - } - else - { - if (nStartA == 90 && i != 2) - nEdge = nY - aS.Bottom(); - else - { - if (aE.Bottom() < aS.Top() && nEndA != 270) - nEdge = nY - (aS.Top() + ((aE.Bottom() - aS.Top()) / 2)); - else - nEdge = nY - aE.Top(); - } - } - } - else if ((xStartSp.is() && !xEndSp.is()) || (!xStartSp.is() && xEndSp.is())) - { - if (aStartPt.Y < aEndPt.Y) - { - if (xStartSp.is()) - nEdge = (nStartA == 90) - ? nY - (aEndPt.Y - ((aEndPt.Y - aS.Bottom()) / 2)) - : nY - aS.Top(); - else - nEdge = (nEndA == 90) - ? nY - aE.Bottom() - : nY - (aStartPt.Y + ((aE.Top() - aStartPt.Y) / 2)); - } - else - { - if (xStartSp.is()) - nEdge = (nStartA == 90) ? nY - aS.Bottom() - : nY - (aEndPt.Y + ((aS.Top() - aEndPt.Y) / 2)); - else - nEdge = (nEndA == 90) - ? nY - (aStartPt.Y - ((aStartPt.Y - aE.Bottom()) / 2)) - : nY - aE.Top(); - } - } - else - { - nEdge = (aStartPt.Y < aEndPt.Y) - ? nY - (aStartPt.Y + (rXConnector->getSize().Height / 2)) - : nY - (aStartPt.Y - (rXConnector->getSize().Height / 2)); - } - } - else // Horizontal - { - sal_Int32 nX = aStartPt.X + ((nAdjustValue * (aEndPt.X - aStartPt.X)) / 100000); - if (xStartSp.is() && xEndSp.is()) - { - if (aS.Left() <= aE.Left()) - { - if (nStartA == 180 && i != 2) - nEdge = nX - aS.Left(); - else - { - if (aS.Right() < aE.Left() && nEndA != 0) - nEdge = nX - (aS.Right() + ((aE.Left() - aS.Right()) / 2)); - else - nEdge = nX - aE.Right(); - } - } - else - { - if (nStartA == 0 && i != 2) - nEdge = nX - aS.Right(); - else - { - if (aE.Right() < aS.Left() && nEndA != 180) - nEdge = nX - (aS.Left() + ((aE.Right() - aS.Left()) / 2)); - else - nEdge = nX - aE.Left(); - } - } - } - else if ((xStartSp.is() && !xEndSp.is()) || (!xStartSp.is() && xEndSp.is())) - { - if (aStartPt.X < aEndPt.X) - { - if (xStartSp.is()) - nEdge = (nStartA == 0) - ? nX - (aS.Right() + ((aEndPt.X - aS.Right()) / 2)) - : nX - aS.Left(); - else - nEdge = (nEndA == 0) - ? nX - aE.Right() - : nX - (aStartPt.X + ((aE.Left() - aStartPt.X) / 2)); - } - else - { - if (xStartSp.is()) - nEdge = (nStartA == 0) ? nX - aS.Right() - : nX - (aEndPt.X + ((aS.Left() - aEndPt.X) / 2)); - else - nEdge = (nEndA == 0) - ? nX - (aE.Right() + ((aStartPt.X - aE.Right()) / 2)) - : nX - aE.Left(); - } - } - else - { - nEdge = (aStartPt.X < aEndPt.X) - ? nX - (aStartPt.X + (rXConnector->getSize().Width / 2)) - : nX - (aStartPt.X - (rXConnector->getSize().Width / 2)); - } - } - xPropSet->setPropertyValue("EdgeLine" + OUString::number(i + 1) + "Delta", Any(nEdge)); - } - } - else - { - const OUString sConnectorName = rShapePtr->getConnectorName(); - if (sConnectorName == "bentConnector2") - { - awt::Size aConnSize = rXConnector->getSize(); - if (xStartSp.is() || xEndSp.is()) - { - if (nStartA >= 0) - { - switch (nStartA) - { - case 0: nEdge = aEndPt.X - aS.Right(); break; - case 180: nEdge = aEndPt.X - aS.Left(); break; - case 90: nEdge = aEndPt.Y - aS.Bottom(); break; - case 270: nEdge = aEndPt.Y - aS.Top(); break; - } - } else { - switch (nEndA) - { - case 0: nEdge = aStartPt.X - aE.Right(); break; - case 180: nEdge = aStartPt.X - aE.Left(); break; - case 90: nEdge = aStartPt.Y - aE.Bottom(); break; - case 270: nEdge = aStartPt.Y - aE.Top(); break; - } + case 0: nEdge = aEndPt.X - aS.Right(); break; + case 180: nEdge = aEndPt.X - aS.Left(); break; + case 90: nEdge = aEndPt.Y - aS.Bottom(); break; + case 270: nEdge = aEndPt.Y - aS.Top(); break; } } else { - bool bFlipH = rShapePtr->getFlipH(); - bool bFlipV = rShapePtr->getFlipV(); - sal_Int32 nConnectorAngle = rShapePtr->getRotation() / 60000; - if (aConnSize.Height < aConnSize.Width) + switch (nEndA) { - if ((nConnectorAngle == 90 && bFlipH && bFlipV) || (nConnectorAngle == 180) - || (nConnectorAngle == 270 && bFlipH)) - nEdge -= aConnSize.Width; - else - nEdge += aConnSize.Width; - } - else - { - if ((nConnectorAngle == 180 && bFlipV) || (nConnectorAngle == 270 && bFlipV) - || (nConnectorAngle == 90 && bFlipH && bFlipV) - || (nConnectorAngle == 0 && !bFlipV)) - nEdge -= aConnSize.Height; - else - nEdge += aConnSize.Height; + case 0: nEdge = aStartPt.X - aE.Right(); break; + case 180: nEdge = aStartPt.X - aE.Left(); break; + case 90: nEdge = aStartPt.Y - aE.Bottom(); break; + case 270: nEdge = aStartPt.Y - aE.Top(); break; } } - xPropSet->setPropertyValue(u"EdgeLine1Delta"_ustr, Any(nEdge / 2)); } + else + { + bool bFlipH = rShapePtr->getFlipH(); + bool bFlipV = rShapePtr->getFlipV(); + sal_Int32 nConnectorAngle = rShapePtr->getRotation() / 60000; + if (aConnSize.Height < aConnSize.Width) + { + if ((nConnectorAngle == 90 && bFlipH && bFlipV) || (nConnectorAngle == 180) + || (nConnectorAngle == 270 && bFlipH)) + nEdge -= aConnSize.Width; + else + nEdge += aConnSize.Width; + } + else + { + if ((nConnectorAngle == 180 && bFlipV) || (nConnectorAngle == 270 && bFlipV) + || (nConnectorAngle == 90 && bFlipH && bFlipV) + || (nConnectorAngle == 0 && !bFlipV)) + nEdge -= aConnSize.Height; + else + nEdge += aConnSize.Height; + } + } + xPropSet->setPropertyValue(u"EdgeLine1Delta"_ustr, Any(nEdge / 2)); } } // create connection between two shape with a connector shape. -void SlidePersist::createConnectorShapeConnection() +void SlidePersist::createConnectorShapeConnection(oox::drawingml::ShapePtr& pConnector) { - sal_Int32 nConnectorShapeCount = maConnectorShapeId.size(); - for (sal_Int32 i = 0; i < nConnectorShapeCount; i++) + oox::drawingml::ConnectorShapePropertiesList aConnectorShapeProperties + = pConnector->getConnectorShapeProperties(); + uno::Reference xConnector(pConnector->getXShape(), uno::UNO_QUERY); + uno::Reference xPropertySet(xConnector, uno::UNO_QUERY); + + if (xConnector.is()) { - const auto& pIt = maShapeMap.find(maConnectorShapeId[i]); - if (pIt == maShapeMap.end()) - continue; - oox::drawingml::ConnectorShapePropertiesList aConnectorShapeProperties - = pIt->second->getConnectorShapeProperties(); - uno::Reference xConnector(pIt->second->getXShape(), uno::UNO_QUERY); - uno::Reference xPropertySet(xConnector, uno::UNO_QUERY); - - if (xConnector.is()) + sal_Int32 nCount = aConnectorShapeProperties.size(); + for (sal_Int32 j = 0; j < nCount; j++) { - sal_Int32 nCount = aConnectorShapeProperties.size(); - for (sal_Int32 j = 0; j < nCount; j++) + OUString aDestShapeId = aConnectorShapeProperties[j].maDestShapeId; + const auto& pShape = maShapeMap.find(aDestShapeId); + if (pShape == maShapeMap.end()) + continue; + uno::Reference xShape(pShape->second->getXShape(), uno::UNO_QUERY); + if (xShape.is()) { - OUString aDestShapeId = aConnectorShapeProperties[j].maDestShapeId; - const auto& pShape = maShapeMap.find(aDestShapeId); - if (pShape == maShapeMap.end()) - continue; - uno::Reference xShape(pShape->second->getXShape(), uno::UNO_QUERY); - if (xShape.is()) + uno::Reference xSupplier(xShape, uno::UNO_QUERY); + css::uno::Reference xGluePoints( + xSupplier->getGluePoints(), uno::UNO_QUERY); + + sal_Int32 nCountGluePoints = xGluePoints->getIdentifiers().getLength(); + sal_Int32 nGlueId = aConnectorShapeProperties[j].mnDestGlueId; + + // The first 4 glue points belong to the bounding box. + if (nCountGluePoints > 4) + nGlueId += 4; + else { - uno::Reference xSupplier(xShape, uno::UNO_QUERY); - css::uno::Reference xGluePoints( - xSupplier->getGluePoints(), uno::UNO_QUERY); - - sal_Int32 nCountGluePoints = xGluePoints->getIdentifiers().getLength(); - sal_Int32 nGlueId = aConnectorShapeProperties[j].mnDestGlueId; - - // The first 4 glue points belong to the bounding box. - if (nCountGluePoints > 4) - nGlueId += 4; - else + bool bFlipH = pShape->second->getFlipH(); + bool bFlipV = pShape->second->getFlipV(); + if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV)) { - bool bFlipH = pShape->second->getFlipH(); - bool bFlipV = pShape->second->getFlipV(); - if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV)) - { - // change id of the left and right glue points of the bounding box (1 <-> 3) - if (nGlueId == 1) - nGlueId = 3; // Right - else if (nGlueId == 3) - nGlueId = 1; // Left - } - } - - bool bStart = aConnectorShapeProperties[j].mbStartShape; - if (bStart) - { - xPropertySet->setPropertyValue(u"StartShape"_ustr, uno::Any(xShape)); - xPropertySet->setPropertyValue(u"StartGluePointIndex"_ustr, uno::Any(nGlueId)); - } - else - { - xPropertySet->setPropertyValue(u"EndShape"_ustr, uno::Any(xShape)); - xPropertySet->setPropertyValue(u"EndGluePointIndex"_ustr, uno::Any(nGlueId)); + // change id of the left and right glue points of the bounding box (1 <-> 3) + if (nGlueId == 1) + nGlueId = 3; // Right + else if (nGlueId == 3) + nGlueId = 1; // Left } } - } - uno::Reference xPropInfo = xPropertySet->getPropertySetInfo(); - if (xPropInfo->hasPropertyByName(u"EdgeKind"_ustr)) - { - ConnectorType aConnectorType; - xPropertySet->getPropertyValue(u"EdgeKind"_ustr) >>= aConnectorType; - if (aConnectorType == ConnectorType_STANDARD) - lcl_SetEdgeLineValue(xConnector, pIt->second); + + bool bStart = aConnectorShapeProperties[j].mbStartShape; + if (bStart) + { + xPropertySet->setPropertyValue(u"StartShape"_ustr, uno::Any(xShape)); + xPropertySet->setPropertyValue(u"StartGluePointIndex"_ustr, uno::Any(nGlueId)); + } + else + { + xPropertySet->setPropertyValue(u"EndShape"_ustr, uno::Any(xShape)); + xPropertySet->setPropertyValue(u"EndGluePointIndex"_ustr, uno::Any(nGlueId)); + } } } + uno::Reference xPropInfo = xPropertySet->getPropertySetInfo(); + if (xPropInfo->hasPropertyByName(u"EdgeKind"_ustr)) + { + ConnectorType aConnectorType; + xPropertySet->getPropertyValue(u"EdgeKind"_ustr) >>= aConnectorType; + if (aConnectorType == ConnectorType_STANDARD) + lcl_SetEdgeLineValue(xConnector, pConnector); + } } - maConnectorShapeId.clear(); } } diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx index 93d95f66ea97..b2f3e6ecf131 100644 --- a/package/inc/ZipFile.hxx +++ b/package/inc/ZipFile.hxx @@ -90,7 +90,8 @@ class ZipFile void recover(); static void readExtraFields(MemoryByteGrabber& aMemGrabber, sal_Int16 nExtraLen, sal_uInt64& nSize, sal_uInt64& nCompressedSize, - sal_uInt64* nOffset); + sal_uInt64* nOffset, + OUString const* pCENFilenameToCheck); public: diff --git a/package/qa/cppunit/data/pass/ofz56826-1.zip b/package/qa/cppunit/data/fail/ofz56826-1.zip similarity index 100% rename from package/qa/cppunit/data/pass/ofz56826-1.zip rename to package/qa/cppunit/data/fail/ofz56826-1.zip diff --git a/package/source/zipapi/MemoryByteGrabber.hxx b/package/source/zipapi/MemoryByteGrabber.hxx index d474be40cda5..dd876d66ebfa 100644 --- a/package/source/zipapi/MemoryByteGrabber.hxx +++ b/package/source/zipapi/MemoryByteGrabber.hxx @@ -49,6 +49,14 @@ public: mnCurrent += nBytesToSkip; } + sal_Int8 ReadUInt8() + { + if (mnCurrent + 1 > mnEnd) + return 0; + sal_uInt8 nInt8 = mpBuffer[mnCurrent++]; + return nInt8; + } + // XSeekable chained... sal_Int16 ReadInt16() { diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 793b5f9c40fe..fa8d74b37b80 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -1076,6 +1077,7 @@ sal_Int32 ZipFile::readCEN() ZipEntry aEntry; sal_Int16 nCommentLen; + sal_Int64 nMinOffset{nEndPos}; aEntries.reserve(nTotal); for (nCount = 0 ; nCount < nTotal; nCount++) @@ -1132,7 +1134,7 @@ sal_Int32 ZipFile::readCEN() if (aEntry.nExtraLen>0) { - readExtraFields(aMemGrabber, aEntry.nExtraLen, nSize, nCompressedSize, &nOffset); + readExtraFields(aMemGrabber, aEntry.nExtraLen, nSize, nCompressedSize, &nOffset, &aEntry.sPath); } aEntry.nCompressedSize = nCompressedSize; aEntry.nSize = nSize; @@ -1140,6 +1142,7 @@ sal_Int32 ZipFile::readCEN() if (o3tl::checked_add(aEntry.nOffset, nLocPos, aEntry.nOffset)) throw ZipException(u"Integer-overflow"_ustr); + nMinOffset = std::min(nMinOffset, aEntry.nOffset); if (o3tl::checked_multiply(aEntry.nOffset, -1, aEntry.nOffset)) throw ZipException(u"Integer-overflow"_ustr); @@ -1153,11 +1156,23 @@ sal_Int32 ZipFile::readCEN() continue; // This is a directory entry, not a stream - skip it } - aEntries[aEntry.sPath] = aEntry; + if (auto it = aEntries.find(aEntry.sPath); it == aEntries.end()) + { + aEntries[aEntry.sPath] = aEntry; + } + else + { + SAL_INFO("package", "Duplicate CEN entry: \"" << aEntry.sPath << "\""); + throw ZipException(u"Duplicate CEN entry"_ustr); + } } if (nCount != nTotal) throw ZipException(u"Count != Total"_ustr ); + if (nMinOffset != 0) + { + throw ZipException(u"Extra bytes at beginning of zip file"_ustr); + } } catch ( IllegalArgumentException & ) { @@ -1168,7 +1183,8 @@ sal_Int32 ZipFile::readCEN() } void ZipFile::readExtraFields(MemoryByteGrabber& aMemGrabber, sal_Int16 nExtraLen, - sal_uInt64& nSize, sal_uInt64& nCompressedSize, sal_uInt64* nOffset) + sal_uInt64& nSize, sal_uInt64& nCompressedSize, + sal_uInt64* nOffset, OUString const*const pCENFilenameToCheck) { while (nExtraLen > 0) // Extensible data fields { @@ -1193,6 +1209,35 @@ void ZipFile::readExtraFields(MemoryByteGrabber& aMemGrabber, sal_Int16 nExtraLe if (dataSize > nReadSize) aMemGrabber.skipBytes(dataSize - nReadSize); } + // Info-ZIP Unicode Path Extra Field - pointless as we expect UTF-8 in CEN already + else if (nheaderID == 0x7075 && pCENFilenameToCheck) // ignore in recovery mode + { + if (aMemGrabber.remainingSize() < dataSize) + { + SAL_INFO("package", "Invalid Info-ZIP Unicode Path Extra Field: invalid TSize"); + throw ZipException(u"Invalid Info-ZIP Unicode Path Extra Field"_ustr); + } + auto const nVersion = aMemGrabber.ReadUInt8(); + if (nVersion != 1) + { + SAL_INFO("package", "Invalid Info-ZIP Unicode Path Extra Field: unexpected Version"); + throw ZipException(u"Invalid Info-ZIP Unicode Path Extra Field"_ustr); + } + // this CRC32 is actually of the pCENFilenameToCheck + // so it's pointless to check it if we require the UnicodeName + // to be equal to the CEN name anyway (and pCENFilenameToCheck + // is already converted to UTF-16 here) + (void) aMemGrabber.ReadUInt32(); + // this is required to be UTF-8 + OUString const unicodePath(reinterpret_cast(aMemGrabber.getCurrentPos()), + dataSize - 5, RTL_TEXTENCODING_UTF8); + aMemGrabber.skipBytes(dataSize - 5); + if (unicodePath != *pCENFilenameToCheck) + { + SAL_INFO("package", "Invalid Info-ZIP Unicode Path Extra Field: unexpected UnicodeName"); + throw ZipException(u"Invalid Info-ZIP Unicode Path Extra Field"_ustr); + } + } else { aMemGrabber.skipBytes(dataSize); @@ -1260,7 +1305,7 @@ void ZipFile::HandlePK34(std::span data, sal_Int64 dataOffset, s MemoryByteGrabber aMemGrabberExtra(aExtraBuffer); if (aEntry.nExtraLen > 0) { - readExtraFields(aMemGrabberExtra, aEntry.nExtraLen, nSize, nCompressedSize, nullptr); + readExtraFields(aMemGrabberExtra, aEntry.nExtraLen, nSize, nCompressedSize, nullptr, nullptr); } } diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 907ed1b4112e..2cb267734b9f 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -626,7 +626,11 @@ void ZipPackage::getZipFileContents() if ( !pCurrent->hasByName( sTemp ) ) { rtl::Reference pPkgFolder = new ZipPackageFolder(m_xContext, m_nFormat, m_bAllowRemoveOnInsert); - pPkgFolder->setName( sTemp ); + try { + pPkgFolder->setName( sTemp ); + } catch (uno::RuntimeException const& e) { + throw css::packages::zip::ZipIOException(e.Message); + } pPkgFolder->doSetParent( pCurrent ); pCurrent = pPkgFolder.get(); } diff --git a/pyuno/Module_pyuno.mk b/pyuno/Module_pyuno.mk index 71d7b48e8b8b..fac159e2ced3 100644 --- a/pyuno/Module_pyuno.mk +++ b/pyuno/Module_pyuno.mk @@ -46,11 +46,10 @@ endif endif # SYSTEM_PYTHON -ifneq ($(OS),MACOSX) $(eval $(call gb_Module_add_check_targets,pyuno, \ PythonTest_pyuno_pytests_testssl \ + PythonTest_pyuno_pytests_testbz2 \ )) -endif $(eval $(call gb_Module_add_subsequentcheck_targets,pyuno, \ PythonTest_pyuno_pytests_testcollections \ diff --git a/pyuno/PythonTest_pyuno_pytests_testbz2.mk b/pyuno/PythonTest_pyuno_pytests_testbz2.mk new file mode 100644 index 000000000000..0f881068c541 --- /dev/null +++ b/pyuno/PythonTest_pyuno_pytests_testbz2.mk @@ -0,0 +1,16 @@ +# -*- 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_PythonTest_PythonTest,pyuno_pytests_testbz2)) + +$(eval $(call gb_PythonTest_add_modules,pyuno_pytests_testbz2,$(SRCDIR)/pyuno/qa/pytests,\ + testbz2 \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/pyuno/qa/pytests/testbz2.py b/pyuno/qa/pytests/testbz2.py new file mode 100644 index 000000000000..12a44e14bb09 --- /dev/null +++ b/pyuno/qa/pytests/testbz2.py @@ -0,0 +1,14 @@ +import os +import unittest + +# tdf#116412: make sure importing bz2 works on all platforms +class BZ2Test(unittest.TestCase): + def test_bz2_import(self): + import bz2 + + # use imported bz2 module for pyflakes + with open(os.devnull, "w") as devnull: + print(str(bz2), file=devnull) + +if __name__ == '__main__': + unittest.main() diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx index f01d33acfb86..355ff2f8b828 100644 --- a/pyuno/source/module/pyuno_util.cxx +++ b/pyuno/source/module/pyuno_util.cxx @@ -36,10 +36,10 @@ PyRef ustring2PyUnicode( const OUString & str ) PyRef ret; #if Py_UNICODE_SIZE == 2 #ifdef MACOSX - ret = PyRef( PyUnicode_FromUnicode( reinterpret_cast(str.getStr()), str.getLength() ), SAL_NO_ACQUIRE ); + ret = PyRef( PyUnicode_FromWideChar( reinterpret_cast(str.getStr()), str.getLength() ), SAL_NO_ACQUIRE ); #else static_assert(sizeof (wchar_t) == Py_UNICODE_SIZE, "bad assumption"); - ret = PyRef( PyUnicode_FromUnicode( reinterpret_cast(str.getStr()), str.getLength() ), SAL_NO_ACQUIRE ); + ret = PyRef( PyUnicode_FromWideChar( reinterpret_cast(str.getStr()), str.getLength() ), SAL_NO_ACQUIRE ); #endif #else OString sUtf8(OUStringToOString(str, RTL_TEXTENCODING_UTF8)); @@ -59,11 +59,11 @@ OUString pyString2ustring( PyObject *pystr ) OUString ret; if( PyUnicode_Check( pystr ) ) { + Py_ssize_t size(0); #if Py_UNICODE_SIZE == 2 ret = OUString( - reinterpret_cast(PyUnicode_AS_UNICODE( pystr )) ); + reinterpret_cast(PyUnicode_AsWideCharString( pystr, &size )) ); #else - Py_ssize_t size(0); char const *pUtf8(PyUnicode_AsUTF8AndSize(pystr, &size)); ret = OUString(pUtf8, size, RTL_TEXTENCODING_UTF8); #endif diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java index c78e450ae721..997ee34e1ef2 100644 --- a/qadevOOo/runner/util/DesktopTools.java +++ b/qadevOOo/runner/util/DesktopTools.java @@ -258,51 +258,6 @@ public class DesktopTools return oDoc; } - /** - * loads a document of from a given path using an input stream - * - * @param xMSF the MultiServiceFactory - * @param filePath the path of the document to load. - * @return the XComponent Interface of the document - */ - public static XComponent loadDocUsingStream(XMultiServiceFactory xMSF, String filePath) - { - XInputStream inputStream = null; - try { - final InputStream inputFile = new BufferedInputStream( - new FileInputStream(filePath)); - try { - final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - final byte[] byteBuffer = new byte[4096]; - int byteBufferLength = 0; - while ((byteBufferLength = inputFile.read(byteBuffer)) > 0) - bytes.write(byteBuffer, 0, byteBufferLength); - inputStream = new ByteArrayToXInputStreamAdapter( - bytes.toByteArray()); - } finally { - inputFile.close(); - } - } catch (java.io.IOException e) { - e.printStackTrace(); - } - - PropertyValue[] loadProps = new PropertyValue[1]; - loadProps[0] = new PropertyValue(); - loadProps[0].Name = "InputStream"; - loadProps[0].Value = inputStream; - - XComponent oDoc = null; - try - { - oDoc = getCLoader(xMSF).loadComponentFromURL("private:stream", "_blank", 0, loadProps); - } - catch (com.sun.star.uno.Exception e) - { - throw new IllegalArgumentException("Document could not be loaded", e); - } - return oDoc; - } - /** * closes a given document * @param DocumentToClose the document to close diff --git a/qadevOOo/tests/java/ifc/util/_XReplaceDescriptor.java b/qadevOOo/tests/java/ifc/util/_XReplaceDescriptor.java index 98249a9dbffa..bc6e2ff97c5a 100644 --- a/qadevOOo/tests/java/ifc/util/_XReplaceDescriptor.java +++ b/qadevOOo/tests/java/ifc/util/_XReplaceDescriptor.java @@ -35,7 +35,7 @@ import com.sun.star.util.XReplaceDescriptor; public class _XReplaceDescriptor extends MultiMethodTest { // oObj filled by MultiMethodTest - public XReplaceDescriptor oObj = null; + private XReplaceDescriptor oObj = null; /** * Test calls the method.

diff --git a/readlicense_oo/license/license.xml b/readlicense_oo/license/license.xml index d74285e18a57..2fbbd9397981 100644 --- a/readlicense_oo/license/license.xml +++ b/readlicense_oo/license/license.xml @@ -2306,6 +2306,13 @@


Fonts

+

Agdasima

+

The following software may be included in this product: Agdasima fonts. Use of any of this software is governed + by the terms of the license below:

+

Copyright 2023 The Agdasima Project Authors (https://github.com/docrepair-fonts/agdasima-fonts).

+

This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, + and is also available with a FAQ at: http://scripts.sil.org/OFL

+

Jump to SIL Open Font License, Version 1.1

Alef

Copyright (c) 2012, HaGilda & Mushon Zer-Aviv (<http://hagilda.com|info@hagilda.com>), with Reserved Font Name Alef Regular.

@@ -2317,10 +2324,33 @@

Copyright (c) 2010-2017, Khaled Hosny (<khaledhosny@eglug.org>)

This Font Software is licensed under the SIL Open Font License, Version 1.1 as shown below.

Jump to SIL Open Font License, Version 1.1

+

Bacasime Antique

+

The following software may be included in this product: Bacasime Antique fonts. Use of any of this software is governed + by the terms of the license below:

+

Copyright 2023 The Bacasime Antique Project Authors (https://github.com/docrepair-fonts/bacasime-antique-fonts), + with Reserved Font Name "Playfair".

+

This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, + and is also available with a FAQ at: http://scripts.sil.org/OFL

+

Jump to SIL Open Font License, Version 1.1

+

Belanosima

+

The following software may be included in this product: Belanosima fonts. Use of any of this software is governed + by the terms of the license below:

+

Copyright 2023 The Belanosima Project Authors (https://github.com/docrepair-fonts/belanosima-fonts), + with Reserved Font Name "Josefin Sans".

+

This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, + and is also available with a FAQ at: http://scripts.sil.org/OFL

+

Jump to SIL Open Font License, Version 1.1

Caladea

Copyright (c) 2012 Huerta Tipográfica

This Font Software is licensed under the Apache License, Version 2.0 as shown below.

Jump to Apache License Version 2.0

+

Caprasimo

+

The following software may be included in this product: Caprasimo fonts. Use of any of this software is governed + by the terms of the license below:

+

Copyright 2023 The Caprasimo Project Authors (https://github.com/docrepair-fonts/caprasimo-fonts).

+

This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, + and is also available with a FAQ at: http://scripts.sil.org/OFL

+

Jump to SIL Open Font License, Version 1.1

Carlito

Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic with Reserved Font Name "Carlito".

This Font Software is licensed under the SIL Open Font License, Version 1.1 as shown below.

@@ -2629,6 +2659,27 @@

This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL

Jump to SIL Open Font License, Version 1.1

+

Lugrasimo

+

The following software may be included in this product: Lugrasimo fonts. Use of any of this software is governed + by the terms of the license below:

+

Copyright 2023 The Lugrasimo Project Authors (https://github.com/docrepair-fonts/lugrasimo-fonts).

+

This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, + and is also available with a FAQ at: http://scripts.sil.org/OFL

+

Jump to SIL Open Font License, Version 1.1

+

Lumanosimo

+

The following software may be included in this product: Lumanosimo fonts. Use of any of this software is governed + by the terms of the license below:

+

Copyright 2023 The Lumanosimo Project Authors (https://github.com/docrepair-fonts/lumanosimo-fonts).

+

This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, + and is also available with a FAQ at: http://scripts.sil.org/OFL

+

Jump to SIL Open Font License, Version 1.1

+

Lunasima

+

The following software may be included in this product: Lunasima fonts. Use of any of this software is governed + by the terms of the license below:

+

Copyright 2023 The Lunasima Project Authors (https://github.com/docrepair-fonts/lunasima-fonts).

+

This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, + and is also available with a FAQ at: http://scripts.sil.org/OFL

+

Jump to SIL Open Font License, Version 1.1

Noto

The following software may be included in this product: Google Noto fonts. Use of any of this software is governed by the terms of the license below:

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 2f67225bf8ec..15f1720142fb 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1359,6 +1359,8 @@ public: // This also includes e.g. notes. Use IsEmptyData() for cell data only. bool IsBlockEmpty( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const; + bool IsNotesBlockEmpty( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const; bool IsPrintEmpty( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bLeftIsEmpty = false, diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index fb47d86c74a4..44b7e370bf32 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -102,13 +102,16 @@ class SC_DLLPUBLIC CellAttributeHolder final const ScPatternAttr* mpScPatternAttr; public: - CellAttributeHolder(const ScPatternAttr* pScPatternAttr = nullptr, bool bPassingOwnership = false); + CellAttributeHolder() : mpScPatternAttr(nullptr) {} + CellAttributeHolder(const ScPatternAttr* pScPatternAttr, bool bPassingOwnership = false); CellAttributeHolder(const CellAttributeHolder& rHolder); - CellAttributeHolder(CellAttributeHolder&& rHolder) noexcept; + CellAttributeHolder(CellAttributeHolder&& rHolder) noexcept + : mpScPatternAttr(rHolder.mpScPatternAttr) + { rHolder.mpScPatternAttr = nullptr; } ~CellAttributeHolder(); CellAttributeHolder& operator=(const CellAttributeHolder& rHolder); - CellAttributeHolder& operator=(CellAttributeHolder&& rHolder); + CellAttributeHolder& operator=(CellAttributeHolder&& rHolder) { std::swap(mpScPatternAttr, rHolder.mpScPatternAttr); return *this; } bool operator==(const CellAttributeHolder& rHolder) const; const ScPatternAttr* getScPatternAttr() const { return mpScPatternAttr; } diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 8ddc5cdc3b09..7da55e4cb3ee 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -426,6 +426,7 @@ public: // This also includes e.g. notes. Use IsEmptyData() for cell data only. bool IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const; + bool IsNotesBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const; bool SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString, const ScSetStringParam * pParam = nullptr ); diff --git a/sc/qa/uitest/pasteSpecial/tdf158110.py b/sc/qa/uitest/pasteSpecial/tdf158110.py index 9b0dba6ed8cd..9d775226c030 100644 --- a/sc/qa/uitest/pasteSpecial/tdf158110.py +++ b/sc/qa/uitest/pasteSpecial/tdf158110.py @@ -12,6 +12,7 @@ from uitest.framework import UITestCase from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.calc.paste_special import reset_default_values +from uitest.uihelper.common import get_state_as_dict class tdf158110(UITestCase): def test_tdf158110_paste_special_multiple_cells(self): @@ -45,4 +46,41 @@ class tdf158110(UITestCase): # i.e., the comment was not copied self.assertEqual("Comment 1", get_cell_by_position(document, 0, 1, 0).Annotation.String) + def test_tdf158110_paste_special_overwrite_comments(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + # Insert a comments + targetCells = ["A1", "A2", "B3", "D2"] + for targetCell in targetCells: + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": targetCell})) + xArgs = mkPropertyValues({"Text": "Comment 1"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + # Copy cell range A1:B3 to clipboard + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B3"})) + self.xUITest.executeCommand(".uno:Copy") + + # Paste data using special options (check only comments), i.e., overwrite comment in D2 + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg: + reset_default_values(self, xPasteSpecialDlg) + xDateTimeChkBox = xPasteSpecialDlg.getChild("datetime") + xDateTimeChkBox.executeAction("CLICK", tuple()) + xTextChkBox = xPasteSpecialDlg.getChild("text") + xTextChkBox.executeAction("CLICK", tuple()) + xNumbersChkBox = xPasteSpecialDlg.getChild("numbers") + xNumbersChkBox.executeAction("CLICK", tuple()) + xCommentsChkBox = xPasteSpecialDlg.getChild("comments") + xCommentsChkBox.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'CheckWarningDialog' != '' + # i.e., the warning dialog was not shown + xCheckWarningDlg = self.xUITest.getTopFocusWindow() + self.assertEqual("CheckWarningDialog", get_state_as_dict(xCheckWarningDlg)["ID"]) + if get_state_as_dict(xCheckWarningDlg)["ID"] == "CheckWarningDialog": + xYesBtn = xCheckWarningDlg.getChild("yes") + xYesBtn.executeAction("CLICK", tuple()) + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/unit/data/fods/tdf161483_CellTextRotation.fods b/sc/qa/unit/data/fods/tdf161483_CellTextRotation.fods new file mode 100644 index 000000000000..59b26532ee62 --- /dev/null +++ b/sc/qa/unit/data/fods/tdf161483_CellTextRotation.fods @@ -0,0 +1,372 @@ + + + + + LOmyBuild/25.2.0.0.alpha0$Windows_X86_64 LibreOffice_project/9877ab0b5ebadf70a138db582f298bf0e5d1cd9e + + Metric + Regina Henschel + 2024-06-29T21:00:31 + Regina Henschel + 2024-07-02T15:12:42 + + + + + 0 + 0 + 9998 + 3000 + + + view1 + + + 3 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 100 + 60 + true + false + false + false + false + + + Sheet1 + 1273 + 0 + 100 + 60 + false + true + true + true + false + true + 12632256 + 1 + true + true + true + false + false + true + 500 + 500 + 4 + 4 + true + false + false + false + false + + + + + true + true + true + 0 + true + true + false + true + false + + + en + US + + + + + + 12632256 + true + true + 0 + false + false + true + true + false + 3 + false + false + true + 500 + 500 + 4 + 4 + true + false + false + true + true + true + true + true + 7 + true + + + Sheet1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ??? + + + + + Page 1 + + + + + + + + ???(???) + + + 00.00.0000, 00:00:00 + + + + + + Page 1/ 99 + + + + + + + + + + + + + The angle is without unit, when LibreOffice writes it out. + + + For this text angle is given in degrees in file format. + + + Here the rotation angle is given in radians + + + This is given in special engineering unit “grad”. + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sc/qa/unit/subsequent_filters_test4.cxx b/sc/qa/unit/subsequent_filters_test4.cxx index 90eb7915f389..f227abb1942f 100644 --- a/sc/qa/unit/subsequent_filters_test4.cxx +++ b/sc/qa/unit/subsequent_filters_test4.cxx @@ -2032,6 +2032,29 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testRowImportCellStyleIssue) } } +CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testCellTextRotation) +{ + createScDoc("fods/tdf161483_CellTextRotation.fods"); + ScDocument* pDoc = getScDoc(); + + CPPUNIT_ASSERT_EQUAL(SCTAB(1), pDoc->GetTableCount()); + + // Without the fix, angles with decimals were imported as 0 and angle units were ignored. + // A1=32.67, B1=32.67deg, C1=0.570119066626548rad, D1=36.3rad + // All four angles have to convert to 3267. + Degree100 nExpectedAngle = 3267_deg100; // RotateAngle has data type long, meaning Degree100 + + Degree100 nActualAngle = 0_deg100; + nActualAngle = pDoc->GetAttr(0, 0, 0, ATTR_ROTATE_VALUE)->GetValue(); // col, row, tab, whichId + CPPUNIT_ASSERT_EQUAL_MESSAGE("without unit", nExpectedAngle.get(), nActualAngle.get()); + nActualAngle = pDoc->GetAttr(1, 0, 0, ATTR_ROTATE_VALUE)->GetValue(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("degrees", nExpectedAngle.get(), nActualAngle.get()); + nActualAngle = pDoc->GetAttr(2, 0, 0, ATTR_ROTATE_VALUE)->GetValue(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("radians", nExpectedAngle.get(), nActualAngle.get()); + nActualAngle = pDoc->GetAttr(3, 0, 0, ATTR_ROTATE_VALUE)->GetValue(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("grad", nExpectedAngle.get(), nActualAngle.get()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 6f27650509d3..233b12249917 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -183,6 +183,7 @@ interface CellSelection SID_PASTE_TEXTIMPORT_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_EXTERNAL_SOURCE [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] + SID_COPY_HYPERLINK_LOCATION [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] FID_MERGE_ON [ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_OFF [ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_TOGGLE [ ExecMethod = Execute; StateMethod = GetState; ] diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx index f118ca7d063e..409f7aa0a6a0 100644 --- a/sc/source/core/data/attrib.cxx +++ b/sc/source/core/data/attrib.cxx @@ -751,7 +751,7 @@ void ScCondFormatItem::dumpAsXml(xmlTextWriterPtr pWriter) const } ScRotateValueItem::ScRotateValueItem(Degree100 nAngle) - : SdrAngleItem(ATTR_ROTATE_VALUE, nAngle) + : SdrAngleItem(ATTR_ROTATE_VALUE, nAngle, SfxItemType::ScRotateValueItemType) { } @@ -772,7 +772,7 @@ bool ScRotateValueItem::GetPresentation(SfxItemPresentation ePresentation, } ScShrinkToFitCell::ScShrinkToFitCell(bool bShrink) - : SfxBoolItem(ATTR_SHRINKTOFIT, bShrink) + : SfxBoolItem(ATTR_SHRINKTOFIT, bShrink, SfxItemType::ScShrinkToFitCellType) { } @@ -792,7 +792,7 @@ bool ScShrinkToFitCell::GetPresentation(SfxItemPresentation, } ScVerticalStackCell::ScVerticalStackCell(bool bStack) - : SfxBoolItem(ATTR_STACKED, bStack) + : SfxBoolItem(ATTR_STACKED, bStack, SfxItemType::ScVerticalStackCellType) { } @@ -812,7 +812,7 @@ bool ScVerticalStackCell::GetPresentation(SfxItemPresentation, } ScLineBreakCell::ScLineBreakCell(bool bStack) - : SfxBoolItem(ATTR_LINEBREAK, bStack) + : SfxBoolItem(ATTR_LINEBREAK, bStack, SfxItemType::ScLineBreakCellType) { } @@ -832,7 +832,7 @@ bool ScLineBreakCell::GetPresentation(SfxItemPresentation, } ScHyphenateCell::ScHyphenateCell(bool bHyphenate) - : SfxBoolItem(ATTR_HYPHENATE, bHyphenate) + : SfxBoolItem(ATTR_HYPHENATE, bHyphenate, SfxItemType::ScHyphenateCellType) { } @@ -852,7 +852,7 @@ bool ScHyphenateCell::GetPresentation(SfxItemPresentation, } ScIndentItem::ScIndentItem(sal_uInt16 nIndent) - : SfxUInt16Item(ATTR_INDENT, nIndent) + : SfxUInt16Item(ATTR_INDENT, nIndent, SfxItemType::ScIndentItemType) { } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 51d636c588af..78f36e0bc462 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -5308,6 +5308,15 @@ void ScDocument::GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab, *ppBottom = pBottomLine; } +bool ScDocument::IsNotesBlockEmpty(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + SCTAB nTab) const +{ + if (HasTable(nTab)) + return maTabs[nTab]->IsNotesBlockEmpty(nStartCol, nStartRow, nEndCol, nEndRow); + OSL_FAIL("wrong table number"); + return false; +} + bool ScDocument::IsBlockEmpty(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const { diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 5169ca412875..da278bd53c30 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -302,12 +302,6 @@ CellAttributeHolder::CellAttributeHolder(const CellAttributeHolder& rHolder) suppress_fun_call_w_exception(mpScPatternAttr = rHolder.getScPatternAttr()->getCellAttributeHelper().registerAndCheck(*rHolder.getScPatternAttr(), false)); } -CellAttributeHolder::CellAttributeHolder(CellAttributeHolder&& rHolder) noexcept -: mpScPatternAttr(rHolder.mpScPatternAttr) -{ - rHolder.mpScPatternAttr = nullptr; -} - CellAttributeHolder::~CellAttributeHolder() { if (nullptr != mpScPatternAttr) @@ -328,20 +322,6 @@ CellAttributeHolder& CellAttributeHolder::operator=(const CellAttributeHolder& r return *this; } -CellAttributeHolder& CellAttributeHolder::operator=(CellAttributeHolder&& rHolder) -{ - if (nullptr != mpScPatternAttr) - { - mpScPatternAttr->getCellAttributeHelper().doUnregister(*mpScPatternAttr); - mpScPatternAttr = nullptr; - } - - std::swap(mpScPatternAttr, rHolder.mpScPatternAttr); - assert(!rHolder.mpScPatternAttr); - - return *this; -} - bool CellAttributeHolder::operator==(const CellAttributeHolder& rHolder) const { // here we have registered entries, so no need to test for equality diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index aa51bec2d727..4629ce8036d1 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2396,6 +2396,20 @@ void ScTable::SetMergedCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ApplyFlags(nCol1+1, nRow1+1, nCol2, nRow2, ScMF::Hor | ScMF::Ver); } +bool ScTable::IsNotesBlockEmpty(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const +{ + if (!(ValidCol(nCol1) && ValidCol(nCol2))) + { + OSL_FAIL("ScTable::IsBlockEmptyNotes: invalid column number"); + return false; + } + nCol2 = ClampToAllocatedColumns(nCol2); + bool bEmpty = true; + for (SCCOL i = nCol1; i <= nCol2 && bEmpty; i++) + bEmpty = aCol[i].IsNotesEmptyBlock(nRow1, nRow2); + return bEmpty; +} + bool ScTable::IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const { if (!(ValidCol(nCol1) && ValidCol(nCol2))) diff --git a/sc/source/filter/inc/xelink.hxx b/sc/source/filter/inc/xelink.hxx index a4bef778b991..b975bc4d15dc 100644 --- a/sc/source/filter/inc/xelink.hxx +++ b/sc/source/filter/inc/xelink.hxx @@ -62,7 +62,7 @@ struct XclExpSBIndex void Set( sal_uInt16 nSupbook, sal_uInt16 nSBTab ) { mnSupbook = nSupbook; mnSBTab = nSBTab; } XclExpSBIndex( sal_uInt16 nSupbook, sal_uInt16 nSBTab ) : mnSupbook(nSupbook), mnSBTab(nSBTab) {} - XclExpSBIndex() {} + XclExpSBIndex() : mnSupbook(0), mnSBTab(0) {} }; /** Stores the correct Excel sheet index for each Calc sheet. diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx index 13abd8808d01..f58c25f376a1 100644 --- a/sc/source/filter/xml/XMLStylesExportHelper.cxx +++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx @@ -647,13 +647,11 @@ ScMyFormatRange::ScMyFormatRange() bool ScMyFormatRange::operator<(const ScMyFormatRange& rRange) const { - if (aRangeAddress.StartRow < rRange.aRangeAddress.StartRow) + if (aRangeAddress.Sheet < rRange.aRangeAddress.Sheet) return true; - else - if (aRangeAddress.StartRow == rRange.aRangeAddress.StartRow) - return (aRangeAddress.StartColumn < rRange.aRangeAddress.StartColumn); - else - return false; + if (aRangeAddress.Sheet > rRange.aRangeAddress.Sheet) + return false; + return aRangeAddress.StartRow < rRange.aRangeAddress.StartRow; } ScFormatRangeStyles::ScFormatRangeStyles() @@ -665,16 +663,6 @@ ScFormatRangeStyles::~ScFormatRangeStyles() { } -void ScFormatRangeStyles::AddNewTable(const sal_Int32 nTable) -{ - sal_Int32 nSize = aTables.size() - 1; - if (nTable > nSize) - for (sal_Int32 i = nSize; i < nTable; ++i) - { - aTables.emplace_back(); - } -} - bool ScFormatRangeStyles::AddStyleName(OUString const & rString, sal_Int32& rIndex, const bool bIsAutoStyle) { if (bIsAutoStyle) @@ -759,12 +747,17 @@ sal_Int32 ScFormatRangeStyles::GetIndexOfStyleName(std::u16string_view rString, sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nColumn, const sal_Int32 nRow, bool& bIsAutoStyle) const { - OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table"); + ScMyFormatRange aNeedle; + aNeedle.aRangeAddress.Sheet = nTable; + aNeedle.aRangeAddress.StartRow = nRow; bIsAutoStyle = false; - if (o3tl::make_unsigned(nTable) >= aTables.size()) - return -1; - for (const ScMyFormatRange & rFormatRange : aTables[nTable]) + for (auto it = maFormatRanges.lower_bound(aNeedle); it != maFormatRanges.end(); ++it) { + const ScMyFormatRange& rFormatRange = *it; + if (rFormatRange.aRangeAddress.Sheet > nTable) + break; + if (rFormatRange.aRangeAddress.StartRow > nRow) + break; if ((rFormatRange.aRangeAddress.StartColumn <= nColumn) && (rFormatRange.aRangeAddress.EndColumn >= nColumn) && (rFormatRange.aRangeAddress.StartRow <= nRow) && @@ -780,18 +773,16 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nColumn, const sal_Int32 nRow, bool& bIsAutoStyle, sal_Int32& nValidationIndex, sal_Int32& nNumberFormat, const sal_Int32 nRemoveBeforeRow) { - OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table"); - if (o3tl::make_unsigned(nTable) >= aTables.size()) - return -1; - ScMyFormatRangeAddresses& rFormatRanges(aTables[nTable]); - ScMyFormatRangeAddresses::iterator aItr(rFormatRanges.begin()); - ScMyFormatRangeAddresses::iterator aEndItr(rFormatRanges.end()); - while (aItr != aEndItr) + ScMyFormatRange aNeedle; + aNeedle.aRangeAddress.Sheet = nTable; + for (auto aItr = maFormatRanges.lower_bound(aNeedle); aItr != maFormatRanges.end(); ) { - if (((*aItr).aRangeAddress.StartColumn <= nColumn) && - ((*aItr).aRangeAddress.EndColumn >= nColumn) && - ((*aItr).aRangeAddress.StartRow <= nRow) && - ((*aItr).aRangeAddress.EndRow >= nRow)) + if (aItr->aRangeAddress.Sheet > nTable) + break; + if ((aItr->aRangeAddress.StartColumn <= nColumn) && + (aItr->aRangeAddress.EndColumn >= nColumn) && + (aItr->aRangeAddress.StartRow <= nRow) && + (aItr->aRangeAddress.EndRow >= nRow)) { bIsAutoStyle = aItr->bIsAutoStyle; nValidationIndex = aItr->nValidationIndex; @@ -808,7 +799,7 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const s else { if ((*aItr).aRangeAddress.EndRow < nRemoveBeforeRow) - aItr = rFormatRanges.erase(aItr); + aItr = maFormatRanges.erase(aItr); else ++aItr; } @@ -820,13 +811,15 @@ void ScFormatRangeStyles::GetFormatRanges(const sal_Int32 nStartColumn, const sa const sal_Int32 nTable, ScRowFormatRanges* pRowFormatRanges) { sal_Int32 nTotalColumns(nEndColumn - nStartColumn + 1); - OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table"); - ScMyFormatRangeAddresses& rFormatRanges(aTables[nTable]); - ScMyFormatRangeAddresses::iterator aItr(rFormatRanges.begin()); - ScMyFormatRangeAddresses::iterator aEndItr(rFormatRanges.end()); sal_Int32 nColumns = 0; - while (aItr != aEndItr && nColumns < nTotalColumns) + ScMyFormatRange aNeedle; + aNeedle.aRangeAddress.Sheet = nTable; + for (auto aItr = maFormatRanges.lower_bound(aNeedle); aItr != maFormatRanges.end(); ) { + if (aItr->aRangeAddress.Sheet > nTable) + break; + if (nColumns >= nTotalColumns) + break; if (((*aItr).aRangeAddress.StartRow <= nRow) && ((*aItr).aRangeAddress.EndRow >= nRow)) { @@ -871,7 +864,7 @@ void ScFormatRangeStyles::GetFormatRanges(const sal_Int32 nStartColumn, const sa } else if(aItr->aRangeAddress.EndRow < nRow) - aItr = rFormatRanges.erase(aItr); + aItr = maFormatRanges.erase(aItr); else ++aItr; } @@ -888,9 +881,7 @@ void ScFormatRangeStyles::AddRangeStyleName(const table::CellRangeAddress& rCell aFormatRange.nValidationIndex = nValidationIndex; aFormatRange.nNumberFormat = nNumberFormat; aFormatRange.bIsAutoStyle = bIsAutoStyle; - OSL_ENSURE(o3tl::make_unsigned(rCellRangeAddress.Sheet) < aTables.size(), "wrong table"); - ScMyFormatRangeAddresses& rFormatRanges(aTables[rCellRangeAddress.Sheet]); - rFormatRanges.push_back(aFormatRange); + maFormatRanges.insert(aFormatRange); } OUString & ScFormatRangeStyles::GetStyleNameByIndex(const sal_Int32 nIndex, const bool bIsAutoStyle) @@ -901,12 +892,6 @@ OUString & ScFormatRangeStyles::GetStyleNameByIndex(const sal_Int32 nIndex, cons return aStyleNames[nIndex]; } -void ScFormatRangeStyles::Sort() -{ - for (auto & rTable : aTables) - rTable.sort(); -} - ScColumnRowStylesBase::ScColumnRowStylesBase() { } diff --git a/sc/source/filter/xml/XMLStylesExportHelper.hxx b/sc/source/filter/xml/XMLStylesExportHelper.hxx index c404e8154004..dbfc12be1e70 100644 --- a/sc/source/filter/xml/XMLStylesExportHelper.hxx +++ b/sc/source/filter/xml/XMLStylesExportHelper.hxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -158,10 +159,7 @@ struct ScMyFormatRange class ScFormatRangeStyles { - typedef std::list ScMyFormatRangeAddresses; - typedef std::vector ScMyFormatRangeListVec; - - ScMyFormatRangeListVec aTables; + std::multiset maFormatRanges; std::vector aStyleNames; std::vector aAutoStyleNames; const ScMyDefaultStyleList* pColDefaults; @@ -171,7 +169,6 @@ public: ~ScFormatRangeStyles(); void SetColDefaults(const ScMyDefaultStyleList* pDefaults) { pColDefaults = pDefaults; } - void AddNewTable(const sal_Int32 nTable); bool AddStyleName(const OUString& rString, sal_Int32& rIndex, const bool bIsAutoStyle = true); sal_Int32 GetIndexOfStyleName(std::u16string_view rString, std::u16string_view rPrefix, bool& bIsAutoStyle); // does not delete ranges @@ -185,7 +182,6 @@ public: void AddRangeStyleName(const css::table::CellRangeAddress& rCellRangeAddress, const sal_Int32 nStringIndex, const bool bIsAutoStyle, const sal_Int32 nValidationIndex, const sal_Int32 nNumberFormat); OUString& GetStyleNameByIndex(const sal_Int32 nIndex, const bool bIsAutoStyle); - void Sort(); }; class ScColumnRowStylesBase diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 00231fc4ae38..e57df86477af 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -498,8 +498,6 @@ void ScXMLExport::CollectSharedData(SCTAB& nTableCount, sal_Int32& nShapesCount) if (!pSharedData) pSharedData.reset(new ScMySharedData(nTableCount)); - pCellStyles->AddNewTable(nTableCount - 1); - for (SCTAB nTable = 0; nTable < nTableCount; ++nTable) { nCurrentTable = sal::static_int_cast(nTable); @@ -1908,7 +1906,6 @@ void ScXMLExport::ExportContent_() ScMyDetectiveOpContainer aDetectiveOpContainer; GetDetectiveOpList( aDetectiveOpContainer ); - pCellStyles->Sort(); pMergedRangesContainer->Sort(); pSharedData->GetDetectiveObjContainer()->Sort(); @@ -2515,7 +2512,6 @@ void ScXMLExport::collectAutoStyles() CollectSharedData(nTableCount, nShapesCount); } sal_Int32 nTableCount(xIndex->getCount()); - pCellStyles->AddNewTable(nTableCount - 1); CollectShapesAutoStyles(nTableCount); for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable, IncrementProgressBar(false)) { diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx index ddcdd5440082..debba9ad8e04 100644 --- a/sc/source/filter/xml/xmlstyle.cxx +++ b/sc/source/filter/xml/xmlstyle.cxx @@ -1512,10 +1512,10 @@ bool XmlScPropHdl_RotateAngle::importXML( { bool bRetval(false); - sal_Int32 nValue; - if (::sax::Converter::convertNumber(nValue, rStrImpValue) && !o3tl::checked_multiply(nValue, 100, nValue)) + double fValue; + if (::sax::Converter::convertAngle(fValue, rStrImpValue, 100)) { - rValue <<= nValue; + rValue <<= static_cast(basegfx::fround(fValue)); // It is already 0<=fValue<36000. bRetval = true; } diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 1dba14884dbc..79f725011804 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -1354,7 +1354,7 @@ VclPtr ScAbstractDialogFactory_Impl::CreateScHFEditDlg( we break; } - return xDlg ? VclPtr::Create(std::move(xDlg)) : nullptr; + return VclPtr::Create(std::move(xDlg)); } VclPtr ScAbstractDialogFactory_Impl::CreateScStyleDlg(weld::Window* pParent, diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 24a64345b759..c01145f38886 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -744,7 +744,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, aOptions ) ); if ( nVersion != 0 ) pSet->Put( SfxInt16Item( SID_VERSION, nVersion ) ); - pMed = new SfxMedium( aFileName, StreamMode::STD_READ, pFilter, std::move(pSet) ); + pMed = new SfxMedium( aFileName, StreamMode::STD_READ, std::move(pFilter), std::move(pSet) ); } else { diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index ab3e5748bd45..d0fdb360e4bb 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -2093,8 +2093,7 @@ void ScTabViewObj::RangeSelChanged( const OUString& rText ) aEvent.RangeDescriptor = rText; // copy on the stack because listener could remove itself - auto const listener(aRangeChgListeners); - + const std::vector> listener(aRangeChgListeners); for (const auto& rListener : listener) rListener->descriptorChanged( aEvent ); } diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 351868f3e95f..f1ff35b5a379 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -294,6 +294,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) break; case SID_COPY: // copy + case SID_COPY_HYPERLINK_LOCATION: // not editable because of matrix only? Do not damage matrix //! is not called, when protected AND matrix, we will have //! to live with this... is caught in Copy-Routine, otherwise diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 995d0cd2dfff..55b65bce1979 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -3212,6 +3213,29 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; + case SID_COPY_HYPERLINK_LOCATION: + { + ScViewData& rData = GetViewData(); + ScGridWindow* pWindow = rData.GetActiveWin(); + const SfxInt32Item* pPosX = rReq.GetArg(FN_PARAM_1); + const SfxInt32Item* pPosY = rReq.GetArg(FN_PARAM_2); + if (pWindow && pPosX && pPosY) + { + const Point aPoint(pPosX->GetValue() * rData.GetPPTX(), + pPosY->GetValue() * rData.GetPPTY()); + OUString aName, aUrl; + if (pWindow->GetEditUrl(aPoint, &aName, &aUrl)) + { + uno::Reference xClipboard + = pWindow->GetClipboard(); + vcl::unohelper::TextDataObject::CopyStringTo(aUrl, xClipboard, + rData.GetViewShell()); + rReq.Done(); + } + } + } + break; + default: OSL_FAIL("incorrect slot in ExecuteEdit"); break; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 1eed1390d9d4..0c38afb4f9f8 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2616,7 +2616,9 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) OString aCursor = pViewShell->GetViewData().describeCellCursorAt(nPosX, nPosY); double fPPTX = pViewShell->GetViewData().GetPPTX(); int mouseX = aPos.X() / fPPTX; - OString aMsg(aUrl.toUtf8() + " coordinates: " + aCursor + ", " + OString::number(mouseX)); + int mouseY = aPos.Y() / fPPTX; + OString aMsg(aUrl.toUtf8() + " coordinates: " + aCursor + ", " + + OString::number(mouseX) + ", " + OString::number(mouseY)); pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aMsg); } else ScGlobal::OpenURL(aUrl, aTarget); @@ -2741,9 +2743,10 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) if (pViewShell && nPosX == m_nDownPosX && nPosY == m_nDownPosY && GetEditUrl(aPos, &aName, &aUrl, &aTarget)) { - OString aMsg(aUrl.toUtf8() + " coordinates: " + - pViewShell->GetViewData().describeCellCursorAt(nPosX, nPosY) + ", " + - OString::number(aPos.X() / pViewShell->GetViewData().GetPPTX())); + OString aMsg(aUrl.toUtf8() + " coordinates: " + + pViewShell->GetViewData().describeCellCursorAt(nPosX, nPosY) + ", " + + OString::number(aPos.X() / pViewShell->GetViewData().GetPPTX()) + ", " + + OString::number(aPos.Y() / pViewShell->GetViewData().GetPPTY())); pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aMsg); } } @@ -6622,7 +6625,8 @@ void ScGridWindow::UpdateCursorOverlay() mrViewData.GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); // tdf#143733 Make cell outline wider than the cell - const double nAdjustBorder(2 + mrViewData.GetZoomX()); + const double fZoom(mrViewData.GetZoomX()); + const sal_uInt16 nAdjustBorder(2 + fZoom / 2); aScrPos.AdjustX(-nAdjustBorder); aScrPos.AdjustY(-nAdjustBorder); @@ -6687,15 +6691,35 @@ void ScGridWindow::UpdateCursorOverlay() // tdf#143733, tdf#145080 - improve border visibility // constants picked for maximum consistency at 100% and adequate response on zoom // line width = 1.5 at 100% (0.75 left +/- 0.75 right), 50% = 1, 200% = 1.25, 400% = 2.25 - const double MinSize = 0.25 * GetDPIScaleFactor(); - double fZoom(mrViewData.GetZoomX() * 0.5); - for(const tools::Rectangle & rRA : aPixelRects) - { - basegfx::B2DRange aRB(rRA.Left() - MinSize - fZoom, rRA.Top() - MinSize - fZoom, - rRA.Right() + MinSize + fZoom, rRA.Bottom() + MinSize + fZoom); - aRB.transform(aTransform); - aRanges.push_back(aRB); - } + const double fCurZoom(mrViewData.GetZoomX()); + const double fMinSize = 0.25 * GetDPIScaleFactor(); + const double fAdjust(fMinSize + mrViewData.GetZoomX() * 0.5); + int nAdjustPixel(o3tl::convert(fAdjust, o3tl::Length::pt, o3tl::Length::px)); + // If zoom level is 50% or greater the rectangles must be at least 1 pixel thick + if (fCurZoom >= 0.5) + nAdjustPixel = std::max(1, nAdjustPixel); + + // Below each rectangle is adjusted so that they have thickness of nAdjustPixel + // Left rectangle + basegfx::B2DRange aRBLeft(aPixelRects[0].Left() - nAdjustPixel, aPixelRects[0].Top() - nAdjustPixel, + aPixelRects[0].Right(), aPixelRects[0].Bottom() + nAdjustPixel); + aRBLeft.transform(aTransform); + aRanges.push_back(aRBLeft); + // Right rectangle + basegfx::B2DRange aRBRight(aPixelRects[1].Left(), aPixelRects[1].Top() - nAdjustPixel, + aPixelRects[1].Right() + nAdjustPixel, aPixelRects[1].Bottom() + nAdjustPixel); + aRBRight.transform(aTransform); + aRanges.push_back(aRBRight); + // Top rectangle + basegfx::B2DRange aRBTop(aPixelRects[2].Left() - nAdjustPixel, aPixelRects[2].Top() - nAdjustPixel, + aPixelRects[2].Right() + nAdjustPixel, aPixelRects[2].Bottom()); + aRBTop.transform(aTransform); + aRanges.push_back(aRBTop); + // Bottom rectangle + basegfx::B2DRange aRBBottom(aPixelRects[3].Left() - nAdjustPixel, aPixelRects[3].Top(), + aPixelRects[3].Right() + nAdjustPixel, aPixelRects[3].Bottom() + nAdjustPixel); + aRBBottom.transform(aTransform); + aRanges.push_back(aRBBottom); std::unique_ptr pOverlay(new sdr::overlay::OverlaySelection( sdr::overlay::OverlayType::Solid, @@ -6934,7 +6958,7 @@ void ScGridWindow::UpdateAutoFillOverlay() nY2 += pMerge->GetRowMerge() - 1; } if (nX == nX2 && nY == nY2) - nAdjustBorder = 2 + static_cast(mrViewData.GetZoomX()); + nAdjustBorder = std::round(2 + static_cast(mrViewData.GetZoomX()) / 2); if (bLayoutRTL && !comphelper::LibreOfficeKit::isActive()) aFillPos.AdjustX( -(nSizeXPix + nAdjustBorder + (aFillHandleSize.Width() / 2)) ); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index f9ded7171687..d3e40076187a 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -852,13 +852,18 @@ bool checkDestRangeForOverwrite(InsertDeleteFlags nFlags, const ScRangeList& rDe { bool bIsEmpty = true; size_t nRangeSize = rDestRanges.size(); + for (const auto& rTab : rMark) { for (size_t i = 0; i < nRangeSize && bIsEmpty; ++i) { const ScRange& rRange = rDestRanges[i]; - if (nFlags & InsertDeleteFlags::ADDNOTES) - bIsEmpty = !rDoc.HasNote(rRange.aStart) && !rDoc.HasNote(rRange.aEnd); + // tdf#158110 - check if just the ADDNOTES flag is present without any other content + if ((nFlags & InsertDeleteFlags::ADDNOTES) == InsertDeleteFlags::ADDNOTES + && (nFlags & (InsertDeleteFlags::CONTENTS & ~InsertDeleteFlags::NOTE)) + == InsertDeleteFlags::NONE) + bIsEmpty = rDoc.IsNotesBlockEmpty(rRange.aStart.Col(), rRange.aStart.Row(), + rRange.aEnd.Col(), rRange.aEnd.Row(), rTab); else bIsEmpty = rDoc.IsBlockEmpty(rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row(), rTab); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index b207f7677282..7bc0a6482836 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -449,7 +449,7 @@ namespace } namespace { - void runAutoCorrectQueryAsync(std::shared_ptr context); + void runAutoCorrectQueryAsync(const std::shared_ptr& context); void performAutoFormatAndUpdate(std::u16string_view rString, const ScMarkData& rMark, SCCOL nCol, SCROW nRow, SCTAB nTab, bool bNumFmtChanged, bool bRecord, @@ -480,7 +480,7 @@ namespace lcl_PostRepaintSparkLine(rDoc.GetSparklineList(nTab), ScRange(nCol, nRow, nTab), pDocSh); } - void finalizeFormulaProcessing(std::shared_ptr context) + void finalizeFormulaProcessing(const std::shared_ptr& context) { // to be used in multiple tabs, the formula must be compiled anew // via ScFormulaCell copy-ctor because of RangeNames, @@ -636,7 +636,7 @@ namespace finalizeFormulaProcessing(context); } - void runAutoCorrectQueryAsync(std::shared_ptr context) + void runAutoCorrectQueryAsync(const std::shared_ptr& context) { auto aQueryBox = std::make_shared(context->GetViewData().GetDialogParent(), context->aCorrectedFormula); weld::DialogController::runAsync(aQueryBox, [context] (int nResult) diff --git a/sd/qa/unit/AnnotationTest.cxx b/sd/qa/unit/AnnotationTest.cxx index 563fb2122018..b4c80f51081e 100644 --- a/sd/qa/unit/AnnotationTest.cxx +++ b/sd/qa/unit/AnnotationTest.cxx @@ -26,6 +26,7 @@ #include #include #include +#include using namespace css; @@ -124,12 +125,12 @@ CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationDelete) CPPUNIT_ASSERT_EQUAL(size_t(3), pPage->GetObjCount()); - sal_uInt32 nID = pPage->getAnnotations().front()->GetId(); + sal_uInt64 nID = pPage->getAnnotations().front()->GetId(); CPPUNIT_ASSERT_EQUAL(size_t(3), pPage->getAnnotations().size()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 1), pPage->getAnnotations().at(1)->GetId()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 2), pPage->getAnnotations().at(2)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 1), pPage->getAnnotations().at(1)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 2), pPage->getAnnotations().at(2)->GetId()); auto xAnnotation = pPage->getAnnotations().at(1); @@ -142,8 +143,8 @@ CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationDelete) CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->GetObjCount()); CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->getAnnotations().size()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 2), pPage->getAnnotations().at(1)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 2), pPage->getAnnotations().at(1)->GetId()); } CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationInsertUndoRedo) @@ -164,34 +165,34 @@ CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationInsertUndoRedo) SdrObject* pObject = pPage->GetObj(0); CPPUNIT_ASSERT_EQUAL(SdrObjKind::Annotation, pObject->GetObjIdentifier()); - sal_uInt32 nID = pPage->getAnnotations().front()->GetId(); + sal_uInt64 nID = pPage->getAnnotations().front()->GetId(); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 1), pPage->getAnnotations().at(1)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 1), pPage->getAnnotations().at(1)->GetId()); dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount()); CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->getAnnotations().size()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId()); dispatchCommand(mxComponent, u".uno:Redo"_ustr, {}); CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->GetObjCount()); CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->getAnnotations().size()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 1), pPage->getAnnotations().at(1)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 1), pPage->getAnnotations().at(1)->GetId()); dispatchCommand(mxComponent, u".uno:DeleteAnnotation"_ustr, {}); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount()); CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->getAnnotations().size()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId()); dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->GetObjCount()); CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->getAnnotations().size()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId()); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 1), pPage->getAnnotations().at(1)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 1), pPage->getAnnotations().at(1)->GetId()); } CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationPositionUpdate) @@ -223,7 +224,7 @@ CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationPositionUpdate) CPPUNIT_ASSERT(pAnnotationData); // Remember the annotation ID - sal_Int32 nID = pAnnotationData->mxAnnotation->GetId(); + sal_uInt64 nID = pAnnotationData->mxAnnotation->GetId(); // Current annotation position CPPUNIT_ASSERT_EQUAL(tools::Long(0), pObject->GetLogicRect().Left()); @@ -259,6 +260,173 @@ CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationPositionUpdate) CPPUNIT_ASSERT_EQUAL(tools::Long(25400), pObject->GetLogicRect().Top()); } +CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationDuplicatePage) +{ + // Check the annotation object is properly cloned when duplicating the page. + + createSdDrawDoc(); + + auto pXImpressDocument = dynamic_cast(mxComponent.get()); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + CPPUNIT_ASSERT(pViewShell); + auto* pDrawViewShell = dynamic_cast(pViewShell); + CPPUNIT_ASSERT(pDrawViewShell); + + SdDrawDocument* pDocument = pXImpressDocument->GetDocShell()->GetDoc(); + CPPUNIT_ASSERT(pDocument); + + // 1 Page + CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pDocument->GetSdPageCount(PageKind::Standard)); + + // No objects yet + SdrPage* pPage1 = pDrawViewShell->GetActualPage(); + CPPUNIT_ASSERT_EQUAL(size_t(0), pPage1->GetObjCount()); + + // Inserted new annotation + uno::Sequence aArgs; + + aArgs = comphelper::InitPropertySequence({ + { "Text", uno::Any(u"Comment"_ustr) }, + }); + dispatchCommand(mxComponent, u".uno:InsertAnnotation"_ustr, aArgs); + + // Check state + { + // 1 Annotation in the page + CPPUNIT_ASSERT_EQUAL(size_t(1), pPage1->getAnnotations().size()); + + // 1 Object in the page + CPPUNIT_ASSERT_EQUAL(size_t(1), pPage1->GetObjCount()); + + // And the object is an annotation + SdrObject* pObject = pPage1->GetObj(0); + CPPUNIT_ASSERT_EQUAL(SdrObjKind::Annotation, pObject->GetObjIdentifier()); + CPPUNIT_ASSERT(pObject->isAnnotationObject()); + auto& rAnnotationData = pObject->getAnnotationData(); + + // Get the annotation from the page 1 + auto xAnnotation = pPage1->getAnnotations().at(0); + + // Annotation in the object is the same as the one in the page + CPPUNIT_ASSERT_EQUAL(xAnnotation.get(), rAnnotationData->mxAnnotation.get()); + + // Check text of the annotation + CPPUNIT_ASSERT_EQUAL(u"Comment"_ustr, xAnnotation->GetText()); + } + + // Let's duplicate the page + dispatchCommand(mxComponent, u".uno:DuplicatePage"_ustr, {}); + + // 2 Pages + CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), pDocument->GetSdPageCount(PageKind::Standard)); + + // Let's switch to the 2nd page + CPPUNIT_ASSERT_EQUAL(true, pDrawViewShell->SwitchPage(1)); + + // Check state + { + // Get the current page + SdrPage* pPage2 = pDrawViewShell->GetActualPage(); + + // Should not be the same page as previous page + CPPUNIT_ASSERT(pPage2 != pPage1); + + // 1 Annotation in the page + CPPUNIT_ASSERT_EQUAL(size_t(1), pPage2->getAnnotations().size()); + + // 1 Object in the page + CPPUNIT_ASSERT_EQUAL(size_t(1), pPage2->GetObjCount()); + + // And the object is an annotation + SdrObject* pObject = pPage2->GetObj(0); + CPPUNIT_ASSERT_EQUAL(SdrObjKind::Annotation, pObject->GetObjIdentifier()); + CPPUNIT_ASSERT(pObject->isAnnotationObject()); + auto& rAnnotationData = pObject->getAnnotationData(); + + // Get the annotation from the page 2 + auto xAnnotation = pPage2->getAnnotations().at(0); + + // Annotation in the object is the same as the one in the page + CPPUNIT_ASSERT_EQUAL(xAnnotation.get(), rAnnotationData->mxAnnotation.get()); + + // Check text of the annotation + CPPUNIT_ASSERT_EQUAL(u"Comment"_ustr, xAnnotation->GetText()); + + // Annotation in page 1 is not the same instance as annotation in page 2 + // We verify the annotation was copied + CPPUNIT_ASSERT(pPage1->getAnnotations().at(0).get() + != pPage2->getAnnotations().at(0).get()); + } +} + +CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationTextUpdate) +{ + createSdDrawDoc(); + + auto pXImpressDocument = dynamic_cast(mxComponent.get()); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + + // Check current page + SdPage* pPage = pViewShell->GetActualPage(); + + // Should have no objects yet + CPPUNIT_ASSERT_EQUAL(size_t(0), pPage->GetObjCount()); + + // Should have no annotations yet + CPPUNIT_ASSERT_EQUAL(size_t(0), pPage->getAnnotations().size()); + + // New free text annotation + rtl::Reference xAnnotation = pPage->createAnnotation(); + xAnnotation->setAuthor(u"B"_ustr); + + uno::Reference xText(xAnnotation->getTextRange()); + xText->setString(u"XXX"_ustr); + + xAnnotation->setPosition(geometry::RealPoint2D(1000.0, 1000.0)); + xAnnotation->setSize(geometry::RealSize2D(5000.0, 2000.0)); + + sdr::annotation::CreationInfo aInfo; + aInfo.meType = sdr::annotation::AnnotationType::FreeText; + xAnnotation->setCreationInfo(aInfo); + + pPage->addAnnotation(xAnnotation, -1); + + CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->getAnnotations().size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount()); + + SdrObject* pObject = pPage->GetObj(0); + CPPUNIT_ASSERT_EQUAL(SdrObjKind::Text, pObject->GetObjIdentifier()); + + SdrTextObj* pTextObject = static_cast(pObject); + + { + OUString sText = pTextObject->GetOutlinerParaObject()->GetTextObject().GetText(0); + CPPUNIT_ASSERT_EQUAL(u"XXX"_ustr, sText); + + CPPUNIT_ASSERT_EQUAL(u"XXX"_ustr, xAnnotation->GetText()); + } + + SdrView* pView = pViewShell->GetView(); + pView->SdrBeginTextEdit(pTextObject); + CPPUNIT_ASSERT_EQUAL(true, pView->IsTextEdit()); + + auto* pOutlinerView = pView->GetTextEditOutlinerView(); + CPPUNIT_ASSERT(pOutlinerView); + auto& rEditView = pOutlinerView->GetEditView(); + rEditView.SetSelection(ESelection::All()); + rEditView.InsertText(u"ABC"_ustr); + + pView->SdrEndTextEdit(); + CPPUNIT_ASSERT_EQUAL(false, pView->IsTextEdit()); + + { + OUString sText = pTextObject->GetOutlinerParaObject()->GetTextObject().GetText(0); + CPPUNIT_ASSERT_EQUAL(u"ABC"_ustr, sText); + + CPPUNIT_ASSERT_EQUAL(u"ABC"_ustr, pPage->getAnnotations().at(0)->GetText()); + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/data/pptx/glue_point_leaving_directions.pptx b/sd/qa/unit/data/pptx/glue_point_leaving_directions.pptx new file mode 100644 index 000000000000..9972238159f1 Binary files /dev/null and b/sd/qa/unit/data/pptx/glue_point_leaving_directions.pptx differ diff --git a/sd/qa/unit/data/xml/n820786_0.xml b/sd/qa/unit/data/xml/n820786_0.xml index 1dedb61faa17..4b2e06b3f347 100644 --- a/sd/qa/unit/data/xml/n820786_0.xml +++ b/sd/qa/unit/data/xml/n820786_0.xml @@ -128,6 +128,7 @@ + @@ -211,6 +212,7 @@ + diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index 7493b24d3162..6afd99813242 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -319,7 +319,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf115005) // additional checks of the output file uno::Reference xNameAccess - = packages::zip::ZipFileAccess::createWithURL(mxComponentContext, maTempFile.GetURL()); + = packages::zip::ZipFileAccess::createWithURL(m_xContext, maTempFile.GetURL()); // check that the document contains original vector images const uno::Sequence names = xNameAccess->getElementNames(); @@ -352,7 +352,7 @@ int SdOOXMLExportTest3::testTdf115005_FallBack_Images(bool bAddReplacementImages // additional checks of the output file uno::Reference xNameAccess - = packages::zip::ZipFileAccess::createWithURL(mxComponentContext, maTempFile.GetURL()); + = packages::zip::ZipFileAccess::createWithURL(m_xContext, maTempFile.GetURL()); // check that the document contains original vector images const uno::Sequence names = xNameAccess->getElementNames(); diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index d2ae920a0071..4d9aaa1e6ed8 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -385,40 +385,12 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, testTdf152434) CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount()); } -CPPUNIT_TEST_FIXTURE(SdImportTest, testStandardConnectors) -{ - createSdImpressDoc("pptx/standardConnectors.pptx"); - - sal_Int32 aEdgeValue[] = { -1352, -2457, 3977, -2900, -1261, 4611, -1431, -2643, 3830, 3438 }; - - sal_Int32 nCount = 0; - sal_Int32 nEdgeLine = 0; - for (size_t i = 0; i < 10; i++) - { - uno::Reference xConnector(getShapeFromPage(i, 0)); - bool bConnector = xConnector->getPropertySetInfo()->hasPropertyByName(u"EdgeKind"_ustr); - if (bConnector) - { - nEdgeLine = xConnector->getPropertyValue(u"EdgeLine1Delta"_ustr).get(); - CPPUNIT_ASSERT_EQUAL(aEdgeValue[nCount], nEdgeLine); - nCount++; - - nEdgeLine = xConnector->getPropertyValue(u"EdgeLine2Delta"_ustr).get(); - if (nEdgeLine != 0) - { - CPPUNIT_ASSERT_EQUAL(aEdgeValue[nCount], nEdgeLine); - nCount++; - } - } - } -} - CPPUNIT_TEST_FIXTURE(SdImportTest, testConnectors) { createSdImpressDoc("pptx/connectors.pptx"); sal_Int32 aEdgeValue[] = { -1167, -1167, -1591, 1476, 1356, -1357, 1604, -1540, - 607, 1296, -1638, -1060, -522, 1578, -1291, 333 }; + 607, 1296, -1638, -1060, 2402, 3313, -1834, 333 }; sal_Int32 nCount = 0; for (size_t i = 0; i < 18; i++) @@ -574,6 +546,34 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, testTdf89449) CPPUNIT_ASSERT_EQUAL(sal_Int32(2), nEndGlueId); } +CPPUNIT_TEST_FIXTURE(SdImportTest, testGluePointLeavingDirections) +{ + createSdImpressDoc("pptx/glue_point_leaving_directions.pptx"); + uno::Reference xEllipseShape(getShapeFromPage(0, 0)); + uno::Sequence aProps; + xEllipseShape->getPropertyValue(u"CustomShapeGeometry"_ustr) >>= aProps; + + uno::Sequence aPathProps; + for (beans::PropertyValue const& rProp : aProps) + { + if (rProp.Name == "Path") + aPathProps = rProp.Value.get>(); + } + + uno::Sequence seqGluePointLeavingDirections; + for (beans::PropertyValue const& rProp : aPathProps) + { + if (rProp.Name == "GluePointLeavingDirections") + { + rProp.Value >>= seqGluePointLeavingDirections; + } + } + + sal_Int32 nCountGluePointLeavingDirections = seqGluePointLeavingDirections.getLength(); + // The ellipse has 8 glue point leaving directions + CPPUNIT_ASSERT_EQUAL(sal_Int32(8), nCountGluePointLeavingDirections); +} + CPPUNIT_TEST_FIXTURE(SdImportTest, testTdf147459) { createSdImpressDoc("pptx/tdf147459.pptx"); @@ -1165,8 +1165,7 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, testFdo72998) CPPUNIT_ASSERT(pObj); const SdrCustomShapeGeometryItem& rGeometryItem = pObj->GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY); - const css::uno::Any* pViewBox = const_cast(rGeometryItem) - .GetPropertyValueByName(u"ViewBox"_ustr); + const css::uno::Any* pViewBox = rGeometryItem.GetPropertyValueByName(u"ViewBox"_ustr); CPPUNIT_ASSERT_MESSAGE("Missing ViewBox", pViewBox); css::awt::Rectangle aViewBox; CPPUNIT_ASSERT((*pViewBox >>= aViewBox)); diff --git a/sd/sdi/NotesPanelView.sdi b/sd/sdi/NotesPanelView.sdi index 2fca90c56fdc..933ef9922401 100644 --- a/sd/sdi/NotesPanelView.sdi +++ b/sd/sdi/NotesPanelView.sdi @@ -492,10 +492,14 @@ interface NotesPanelView ExecMethod = FuTemporary ; StateMethod = GetMenuState ; ] + FID_SEARCH_NOW // ole : ?, status : ? + [ + ExecMethod = Execute ; + StateMethod = GetState ; + GroupId = SfxGroupId::Document ; + ] } -include "drtxtob.sdi" - shell NotesPanelViewShell { import NotesPanelView; diff --git a/sd/sdi/drviewsh.sdi b/sd/sdi/drviewsh.sdi index 84fa9bfa8471..ac7e44ab1a37 100644 --- a/sd/sdi/drviewsh.sdi +++ b/sd/sdi/drviewsh.sdi @@ -203,6 +203,12 @@ interface ImpressEditView : DrawView ExecMethod = FuTemporary ; StateMethod = GetMenuState ; ] + FID_SEARCH_NOW + [ + ExecMethod = Execute ; + StateMethod = GetState ; + GroupId = SfxGroupId::Document ; + ] } shell DrawViewShell diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 1d0f242c20b1..1d7d564de8f6 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -1054,7 +1054,10 @@ void PPTWriter::ImplExportComments( const uno::Reference< drawing::XDrawPage >& : xAnnotation->getAuthor() ); uno::Reference< text::XText > xText( xAnnotation->getTextRange() ); OUString sText( xText->getString() ); - OUString sInitials( GetInitials( sAuthor ) ); + OUString sInitials( + bRemoveCommentAuthorDates + ? "A" + OUString::number(mpAuthorIDs->GetInfoID(xAnnotation->getAuthor())) + : xAnnotation->getInitials()); util::DateTime aEmptyDateTime; util::DateTime aDateTime(bRemoveCommentAuthorDates ? aEmptyDateTime : xAnnotation->getDateTime()); diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx index 18199210cc6b..70bcd3a4b6ce 100644 --- a/sd/source/filter/eppt/epptbase.hxx +++ b/sd/source/filter/eppt/epptbase.hxx @@ -379,7 +379,6 @@ protected: ::tools::Rectangle MapRectangle( const css::awt::Rectangle& ); bool ContainsOtherShapeThanPlaceholders(); - static OUString GetInitials(std::u16string_view sName); public: PPTWriterBase(); diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx index 9646afb865d8..072d16601c97 100644 --- a/sd/source/filter/eppt/epptooxml.hxx +++ b/sd/source/filter/eppt/epptooxml.hxx @@ -109,7 +109,7 @@ private: sal_uInt32 GetNewSlideId() { return mnSlideIdMax ++; } sal_uInt32 GetNewSlideMasterId() { return mnSlideMasterIdMax ++; } - sal_Int32 GetAuthorIdAndLastIndex( const OUString& sAuthor, sal_Int32& nLastIndex ); + sal_Int32 GetAuthorIdAndLastIndex( const OUString& sAuthor, const OUString& sInitials, sal_Int32& nLastIndex ); // Write docProps/core.xml and docprops/custom.xml and docprops/app.xml void writeDocumentProperties(); @@ -165,6 +165,17 @@ private: struct AuthorComments { sal_Int32 nId; sal_Int32 nLastIndex; + OUString sInitials; + + AuthorComments() + { + } + AuthorComments(sal_Int32 nId_, sal_Int32 nLastIndex_, OUString sInitials_) + : nId(nId_) + , nLastIndex(nLastIndex_) + , sInitials(sInitials_) + { + } }; typedef std::unordered_map< OUString, struct AuthorComments > AuthorsMap; AuthorsMap maAuthors; diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx index fe9444865797..eebf01410c15 100644 --- a/sd/source/filter/eppt/pptx-epptbase.cxx +++ b/sd/source/filter/eppt/pptx-epptbase.cxx @@ -998,24 +998,4 @@ bool PPTWriterBase::ContainsOtherShapeThanPlaceholders() return bOtherThanPlaceHolders; } -OUString PPTWriterBase::GetInitials(std::u16string_view sName) -{ - OUStringBuffer sRet; - - if (!sName.empty()) - { - sRet.append(sName[0]); - size_t nStart = 0, nOffset; - - while ((nOffset = sName.find(' ', nStart)) != std::u16string_view::npos) - { - if (nOffset + 1 < sName.size()) - sRet.append(sName[ nOffset + 1 ]); - nStart = nOffset + 1; - } - } - - return sRet.makeStringAndClear(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index f7379a3cd68e..eb5a790cc156 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -1036,7 +1036,7 @@ void PowerPointExport::WriteAuthors() pFS->singleElementNS(XML_p, XML_cmAuthor, XML_id, OString::number(i.second.nId), XML_name, i.first, - XML_initials, GetInitials(i.first), + XML_initials, i.second.sInitials, XML_lastIdx, OString::number(i.second.nLastIndex), XML_clrIdx, OString::number(i.second.nId)); } @@ -1046,17 +1046,12 @@ void PowerPointExport::WriteAuthors() pFS->endDocument(); } -sal_Int32 PowerPointExport::GetAuthorIdAndLastIndex(const OUString& sAuthor, sal_Int32& nLastIndex) +sal_Int32 PowerPointExport::GetAuthorIdAndLastIndex(const OUString& sAuthor, + const OUString& sInitials, + sal_Int32& nLastIndex) { if (maAuthors.count(sAuthor) <= 0) - { - struct AuthorComments aAuthorComments; - - aAuthorComments.nId = maAuthors.size(); - aAuthorComments.nLastIndex = 0; - - maAuthors[ sAuthor ] = aAuthorComments; - } + maAuthors.emplace(sAuthor, AuthorComments(maAuthors.size(), 0, sInitials)); nLastIndex = ++maAuthors[ sAuthor ].nLastIndex; @@ -1172,7 +1167,10 @@ bool PowerPointExport::WriteComments(sal_uInt32 nPageNum) ? "Author" + OUString::number(GetInfoID(xAnnotation->getAuthor())) : xAnnotation->getAuthor()); - sal_Int32 nId = GetAuthorIdAndLastIndex(sAuthor, nLastIndex); + OUString sInitials(bRemoveCommentAuthorDates + ? "A" + OUString::number(GetInfoID(xAnnotation->getAuthor())) + : xAnnotation->getInitials()); + sal_Int32 nId = GetAuthorIdAndLastIndex(sAuthor, sInitials, nLastIndex); char cDateTime[sizeof("-32768-65535-65535T65535:65535:65535.4294967295")]; // reserve enough space for hypothetical max length diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 58e2dfead82f..22229e6597ce 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -59,6 +59,9 @@ bool SdPdfFilter::Import() mrDocument.setLock(true); const bool bSavedUndoEnabled = mrDocument.IsUndoEnabled(); mrDocument.EnableUndo(false); + mrDocument.setPDFDocument(true); + + SdrModel& rModel = mrDocument; // Add as many pages as we need up-front. mrDocument.CreateFirstPages(); @@ -83,8 +86,6 @@ bool SdPdfFilter::Import() // Make the page size match the rendered image. pPage->SetSize(aSizeHMM); - SdrModel& rModel = pPage->getSdrModelFromSdrPage(); - rtl::Reference pSdrGrafObj = new SdrGrafObj(rModel, rGraphic, tools::Rectangle(Point(), aSizeHMM)); diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index b07a79932b5d..940c763f73cc 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -1108,7 +1108,7 @@ void AnnotationManagerImpl::SyncAnnotationObjects() applyAnnotationProperties(*pNewObject, rInfo); } - pNewObject->SetLogicRect(aRectangle); + pNewObject->SetRelativePos(aRectangle.TopLeft()); pView->InsertObjectAtView(pNewObject.get(), *pView->GetSdrPageView()); diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx index 076c09753409..8c8fc850648c 100644 --- a/sd/source/ui/func/fuolbull.cxx +++ b/sd/source/ui/func/fuolbull.cxx @@ -124,6 +124,8 @@ void FuBulletAndPosition::SetCurrentBulletsNumbering(SfxRequest& rReq) } const SfxUInt16Item* pItem = rReq.GetArgs()->GetItem(SID_ATTR_BULLET_INDEX); + if (!pItem) // tdf#161653 + pItem = rReq.GetArg(nSId); if ( !pItem ) { rReq.Done(); diff --git a/sd/source/ui/func/fusearch.cxx b/sd/source/ui/func/fusearch.cxx index 73a112bf44c6..4856dd20bece 100644 --- a/sd/source/ui/func/fusearch.cxx +++ b/sd/source/ui/func/fusearch.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include class SfxRequest; @@ -78,6 +79,19 @@ void FuSearch::DoExecute( SfxRequest& ) m_bOwnOutliner = false; m_pSdOutliner = mpDoc->GetOutliner(); } + else if ( dynamic_cast< const NotesPanelViewShell *>( mpViewShell ) != nullptr ) + { + if( mpViewShell->GetViewShellBase().GetMainViewShell()->GetShellType() == ViewShell::ST_OUTLINE ) + { + m_bOwnOutliner = false; + m_pSdOutliner = mpDoc->GetOutliner(); + } + if( mpViewShell->GetViewShellBase().GetMainViewShell()->GetShellType() == ViewShell::ST_IMPRESS ) + { + m_bOwnOutliner = true; + m_pSdOutliner = new SdOutliner( mpDoc, OutlinerMode::TextObject ); + } + } if (m_pSdOutliner) m_pSdOutliner->PrepareSpelling(); diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 80543adebac2..f6da30194224 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -250,7 +250,7 @@ public: void ResetActualPage(); void ResetActualLayer(); - bool SwitchPage(sal_uInt16 nPage, bool bAllowChangeFocus = true); + SD_DLLPUBLIC bool SwitchPage(sal_uInt16 nPage, bool bAllowChangeFocus = true); bool IsSwitchPageAllowed() const; /** diff --git a/sd/source/ui/inc/OutlinerIteratorImpl.hxx b/sd/source/ui/inc/OutlinerIteratorImpl.hxx index 84b11e47b636..485f2b89eaec 100644 --- a/sd/source/ui/inc/OutlinerIteratorImpl.hxx +++ b/sd/source/ui/inc/OutlinerIteratorImpl.hxx @@ -155,63 +155,19 @@ private: IteratorImplBase& operator= (const IteratorImplBase& rIterator); }; -/** Iterator for iteration over all objects in a single view. On reaching - the last object on the last page (or the first object on the first page) - the view is *not* switched. Further calls to the - GotoNextObject() method will be ignored. +/** Iterator for iteration over all objects in all views. It switches views when + appropriate. + + Iterates in the following pattern + 1-) Alternating Normal View and Notes View for each page + 2-) Master Pages + 3-) Notes Masters + 4-) The Handout Master

For documentation of the methods please refer to the base class IteratorImplBase.

*/ -class ViewIteratorImpl : public IteratorImplBase -{ -public: - ViewIteratorImpl ( - sal_Int32 nPageIndex, - SdDrawDocument* pDocument, - const std::weak_ptr& rpViewShellWeak, - bool bDirectionIsForward); - ViewIteratorImpl ( - sal_Int32 nPageIndex, - SdDrawDocument* pDocument, - const std::weak_ptr& rpViewShellWeak, - bool bDirectionIsForward, - PageKind ePageKind, - EditMode eEditMode); - virtual ~ViewIteratorImpl() override; - - virtual void GotoNextText() override; - virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) const override; - virtual void Reverse() override; - -protected: - /** Set up page pointer and object list iterator for the specified - page. - @param nPageIndex - Index of the new page. It may lie outside the valid range for - page indices. - */ - void SetPage (sal_Int32 nPageIndex); - -private: - /// Indicates whether a page changed occurred on switching to current page. - bool mbPageChangeOccurred; - /// Pointer to the page associated with the current page index. May be NULL. - SdPage* mpPage; - /// Iterator of all objects on the current page. - std::optional moObjectIterator; - - // Don't use this operator. - ViewIteratorImpl& operator= (const ViewIteratorImpl&) = delete; -}; - -/** Iterator for iteration over all objects in all views. It automatically - switches views when reaching the end/beginning of a view. - -

For documentation of the methods please refer to the base class - IteratorImplBase.

-*/ -class DocumentIteratorImpl final : public ViewIteratorImpl +class DocumentIteratorImpl final : public IteratorImplBase { public: DocumentIteratorImpl ( @@ -225,8 +181,23 @@ public: virtual void GotoNextText() override; virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) const override; + virtual void Reverse() override; private: + /** Set up page pointer and object list iterator for the specified + page. + @param nPageIndex + Index of the new page. It may lie outside the valid range for + page indices. + */ + void SetPage (sal_Int32 nPageIndex); + + /// Iterator of all objects on the current page. + std::optional moObjectIterator; + + /// Pointer to the page associated with the current page index. May be NULL. + SdPage* mpPage; + /// Number of pages in the view that is specified by maPosition. sal_Int32 mnPageCount; diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index a4dc13e775f7..28bd323dd8d4 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -287,6 +287,9 @@ public: /// @see vcl::ITiledRenderable::getViewRenderState(). SD_DLLPUBLIC OString getViewRenderState(SfxViewShell* pViewShell = nullptr) override; + /// @see vcl::ITiledRenderable::getPresentationInfo(). + OString getPresentationInfo() const override; + // XComponent /** This dispose implementation releases the resources held by the diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 96a4e1c07100..3c0fead65b92 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -21,6 +21,7 @@ #include +#include #include #include #include @@ -79,6 +80,8 @@ #include #include #include +#include +#include // Support creation of GraphicStorageHandler and EmbeddedObjectResolver #include @@ -191,8 +194,120 @@ private: SdrModel* mpModel; }; +class SlideBackgroundInfo +{ +public: + SlideBackgroundInfo(const uno::Reference& xDrawPage, + const uno::Reference& xMasterPage); + bool slideHasOwnBackground() const { return mbIsCustom; } + bool hasBackground() const { return bHasBackground; } + bool isSolidColor() const { return mbIsSolidColor; } + ::Color getFillColor() const; + sal_Int32 getFillTransparency() const; + OString getFillColorAsRGBA() const; +private: + bool getFillStyleImpl(const uno::Reference& xDrawPage); +private: + uno::Reference mxDrawPage; + uno::Reference mxMasterPage; + uno::Reference mxBackground; + bool mbIsCustom; + bool bHasBackground; + bool mbIsSolidColor; + drawing::FillStyle maFillStyle; +}; + +SlideBackgroundInfo::SlideBackgroundInfo( + const uno::Reference& xDrawPage, + const uno::Reference& xMasterPage) + : mxDrawPage(xDrawPage) + , mxMasterPage(xMasterPage) + , mbIsCustom(false) + , bHasBackground(false) + , mbIsSolidColor(false) + , maFillStyle(drawing::FillStyle_NONE) +{ + mbIsCustom = getFillStyleImpl(xDrawPage); + bHasBackground = mbIsCustom; + if (!bHasBackground) + { + bHasBackground = getFillStyleImpl(xMasterPage); + } + if (bHasBackground) + { + if (maFillStyle == drawing::FillStyle_SOLID) + { + OUString sGradientName; + mxBackground->getPropertyValue("FillTransparenceGradientName") >>= sGradientName; + if (sGradientName.isEmpty()) + { + mbIsSolidColor = true; + } + } + } } +sal_Int32 SlideBackgroundInfo::getFillTransparency() const +{ + if (!mxBackground.is()) + return 0; + sal_Int32 nFillTransparency = 0; + mxBackground->getPropertyValue("FillTransparence") >>= nFillTransparency; + return nFillTransparency; +} + +::Color SlideBackgroundInfo::getFillColor() const +{ + if (!mxBackground.is()) + return {}; + if (sal_Int32 nFillColor; mxBackground->getPropertyValue("FillColor") >>= nFillColor) + { + return ::Color(ColorTransparency, nFillColor & 0xffffff); + } + return {}; +} + +OString SlideBackgroundInfo::getFillColorAsRGBA() const +{ + ::Color aColor = getFillColor(); + OString sColor = aColor.AsRGBHEXString().toUtf8(); + sal_uInt32 nAlpha = std::round((100 - getFillTransparency()) * 255 / 100.0); + std::stringstream ss; + ss << std::hex << std::uppercase << std::setfill ('0') << std::setw(2) << nAlpha; + sColor += ss.str().c_str(); + return sColor; +} + +bool SlideBackgroundInfo::getFillStyleImpl(const uno::Reference& xDrawPage) +{ + if( xDrawPage.is() ) + { + uno::Reference< beans::XPropertySet > xPropSet( xDrawPage, uno::UNO_QUERY ); + if( xPropSet.is() ) + { + uno::Reference< beans::XPropertySet > xBackground; + if (xPropSet->getPropertySetInfo()->hasPropertyByName("Background")) + xPropSet->getPropertyValue( "Background" ) >>= xBackground; + if( xBackground.is() ) + { + drawing::FillStyle aFillStyle; + if( xBackground->getPropertyValue( "FillStyle" ) >>= aFillStyle ) + { + maFillStyle = aFillStyle; + if (aFillStyle != drawing::FillStyle_NONE) + { + mxBackground = xBackground; + return true; + } + } + } + } + } + return false; +} + +} // end anonymous namespace + SdUnoForbiddenCharsTable::SdUnoForbiddenCharsTable( SdrModel* pModel ) : SvxUnoForbiddenCharsTable( pModel->GetForbiddenCharsTable() ), mpModel( pModel ) { @@ -2485,7 +2600,8 @@ OUString SdXImpressDocument::getPartHash(int nPart) return OUString(); } - return OUString::number(pPage->GetHashCode()); + uno::Reference xDrawPage(pPage->getUnoPage(), uno::UNO_QUERY); + return OUString::fromUtf8(GetInterfaceHash(xDrawPage)); } bool SdXImpressDocument::isMasterViewMode() @@ -2596,7 +2712,7 @@ void SdXImpressDocument::getPostIts(::tools::JsonWriter& rJsonWriter) rJsonWriter.put("dateTime", utl::toISO8601(xAnnotation->getDateTime())); uno::Reference xText(xAnnotation->getTextRange()); rJsonWriter.put("text", xText->getString()); - rJsonWriter.put("parthash", pPage->GetHashCode()); + rJsonWriter.put("parthash", pPage->GetUniqueID()); geometry::RealPoint2D const & rPoint = xAnnotation->getPosition(); geometry::RealSize2D const & rSize = xAnnotation->getSize(); ::tools::Rectangle aRectangle(Point(rPoint.X * 100.0, rPoint.Y * 100.0), Size(rSize.Width * 100.0, rSize.Height * 100.0)); @@ -2891,6 +3007,90 @@ void SdXImpressDocument::initializeDocument() } } +OString SdXImpressDocument::getPresentationInfo() const +{ + ::tools::JsonWriter aJsonWriter; + + try + { + uno::Reference xSlides(mxDrawPagesAccess.get(), uno::UNO_QUERY_THROW); + if (xSlides.is()) + { + // size in twips + Size aDocSize = const_cast(this)->getDocumentSize(); + aJsonWriter.put("docWidth", aDocSize.getWidth()); + aJsonWriter.put("docHeight", aDocSize.getHeight()); + + auto aSlideList = aJsonWriter.startArray("slides"); + sal_Int32 nSlideCount = xSlides->getCount(); + for (sal_Int32 i = 0; i < nSlideCount; ++i) + { + uno::Reference xSlide(xSlides->getByIndex(i), uno::UNO_QUERY_THROW); + if (xSlide.is()) + { + uno::Reference xPropSet(xSlide, uno::UNO_QUERY); + if (xPropSet.is()) + { + bool bIsVisible = true; // default visible + xPropSet->getPropertyValue("Visible") >>= bIsVisible; + if (bIsVisible) + { + auto aSlideNode = aJsonWriter.startStruct(); + std::string sSlideHash = GetInterfaceHash(xSlide); + aJsonWriter.put("hash", sSlideHash); + aJsonWriter.put("index", i); + + uno::Reference xSlideShapes(xSlide, uno::UNO_QUERY_THROW); + bool bIsDrawPageEmpty = true; + if (xSlideShapes.is()) { + bIsDrawPageEmpty = xSlideShapes->getCount() == 0; + } + aJsonWriter.put("empty", bIsDrawPageEmpty); + + uno::Reference xMasterPage; + uno::Reference xMasterPageTarget(xSlide, uno::UNO_QUERY); + if (xMasterPageTarget.is()) + { + xMasterPage = xMasterPageTarget->getMasterPage(); + if (xMasterPage.is()) + { + std::string sMPHash = GetInterfaceHash(xMasterPage); + aJsonWriter.put("masterPage", sMPHash); + + bool bBackgroundObjectsVisibility = true; // default visible + xPropSet->getPropertyValue("IsBackgroundObjectsVisible") >>= bBackgroundObjectsVisibility; + aJsonWriter.put("masterPageObjectsVisible", bBackgroundObjectsVisibility); + } + } + + bool bBackgroundVisibility = true; // default visible + xPropSet->getPropertyValue("IsBackgroundVisible") >>= bBackgroundVisibility; + if (bBackgroundVisibility) + { + SlideBackgroundInfo aSlideBackgroundInfo(xSlide, xMasterPage); + if (aSlideBackgroundInfo.hasBackground()) + { + auto aBackgroundNode = aJsonWriter.startNode("background"); + aJsonWriter.put("isCustom", aSlideBackgroundInfo.slideHasOwnBackground()); + if (aSlideBackgroundInfo.isSolidColor()) + { + aJsonWriter.put("fillColor", aSlideBackgroundInfo.getFillColorAsRGBA()); + } + } + } + } + } + } + } + } + } + catch (uno::Exception& ) + { + TOOLS_WARN_EXCEPTION( "sd", "SdXImpressDocument::getSlideShowInfo ... maybe some property can't be retrieved" ); + } + return aJsonWriter.finishAndGetAsOString(); +} + SdrModel& SdXImpressDocument::getSdrModelFromUnoModel() const { OSL_ENSURE(GetDoc(), "No SdrModel in draw/Impress, should not happen"); diff --git a/sd/source/ui/view/NotesPanelViewShell.cxx b/sd/source/ui/view/NotesPanelViewShell.cxx index a13daeb9f6f0..5a5c9ec1407b 100644 --- a/sd/source/ui/view/NotesPanelViewShell.cxx +++ b/sd/source/ui/view/NotesPanelViewShell.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -568,6 +569,7 @@ void NotesPanelViewShell::GetState(SfxItemSet& rSet) { switch (nWhich) { + case FID_SEARCH_NOW: case SID_SEARCH_ITEM: case SID_SEARCH_OPTIONS: // Call common (old) implementation in the document shell. @@ -1331,15 +1333,49 @@ void NotesPanelViewShell::FuSupport(SfxRequest& rReq) void NotesPanelViewShell::Execute(SfxRequest& rReq) { - bool bForwardCall = true; - switch (rReq.GetSlot()) { + case FID_SEARCH_NOW: + { + const SfxItemSet* pReqArgs = rReq.GetArgs(); + + sd::View* pView = nullptr; + if (auto pMainViewSh = GetViewShellBase().GetMainViewShell()) + pView = pMainViewSh->GetView(); + + if (pReqArgs) + { + if (pView) + { + rtl::Reference& xFuSearch + = pView->getSearchContext().getFunctionSearch(); + + if (!xFuSearch.is()) + { + xFuSearch = rtl::Reference(FuSearch::createPtr( + this, this->GetActiveWindow(), pView, GetDoc(), rReq)); + + pView->getSearchContext().setSearchFunction(xFuSearch); + } + + if (xFuSearch.is()) + { + const SvxSearchItem& rSearchItem = pReqArgs->Get(SID_SEARCH_ITEM); + + SD_MOD()->SetSearchItem( + std::unique_ptr(rSearchItem.Clone())); + xFuSearch->SearchAndReplace(&rSearchItem); + } + } + } + rReq.Done(); + } + break; + case SID_SEARCH_ITEM: // Forward this request to the common (old) code of the // document shell. GetDocSh()->Execute(rReq); - bForwardCall = false; break; case SID_SPELL_DIALOG: @@ -1355,16 +1391,12 @@ void NotesPanelViewShell::Execute(SfxRequest& rReq) pViewFrame->GetBindings().Invalidate(SID_SPELL_DIALOG); rReq.Done(); - bForwardCall = false; } break; default: break; } - - if (bForwardCall) - TextObjectBar::ExecuteImpl(this, mpView, rReq, nullptr); } void NotesPanelViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 4d00939fc53e..8f33f1edbde7 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -49,10 +49,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -62,6 +64,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -127,6 +130,30 @@ sd::ViewShellBase* getViewShellBase() return dynamic_cast(SfxViewShell::Current()); } +OutlinerView* lclGetNotesPaneOutliner(const std::shared_ptr& pViewShell) +{ + if (!pViewShell) + return nullptr; + + // request the notes pane + sd::ViewShellBase& rBase = pViewShell->GetViewShellBase(); + + sd::framework::FrameworkHelper::Instance(rBase)->RequestView( + sd::framework::FrameworkHelper::msNotesPanelViewURL, + sd::framework::FrameworkHelper::msBottomImpressPaneURL); + + auto pInstance = sd::framework::FrameworkHelper::Instance(rBase); + pInstance->RequestSynchronousUpdate(); + + std::shared_ptr pNotesPaneShell( + pInstance->GetViewShell(sd::framework::FrameworkHelper::msBottomImpressPaneURL)); + + if (!pNotesPaneShell) + return nullptr; + + return static_cast(pNotesPaneShell->GetView())->GetOutlinerView(); +} + } // end anonymous namespace SdOutliner::SdOutliner( SdDrawDocument* pDoc, OutlinerMode nMode ) @@ -896,6 +923,14 @@ bool SdOutliner::SearchAndReplaceOnce(std::vector* pSelecti if (mpSearchItem->GetCommand() != SvxSearchCmd::REPLACE_ALL) { nMatchCount = getOutlinerView()->StartSearchAndReplace(*mpSearchItem); + if (nMatchCount && maCurrentPosition.meEditMode == EditMode::Page + && maCurrentPosition.mePageKind == PageKind::Notes) + { + if(auto pNotesPaneOutliner = lclGetNotesPaneOutliner(pViewShell)) + { + pNotesPaneOutliner->SetSelection(getOutlinerView()->GetSelection()); + } + } } } @@ -917,14 +952,25 @@ bool SdOutliner::SearchAndReplaceOnce(std::vector* pSelecti // necessary anymore. DBG_ASSERT(GetEditEngine().HasView(&getOutlinerView()->GetEditView() ), "SearchAndReplace without valid view!" ); - if ( ! GetEditEngine().HasView( &getOutlinerView()->GetEditView() ) ) + if ( ! GetEditEngine().HasView( &getOutlinerView()->GetEditView() ) + && maCurrentPosition.mePageKind != PageKind::Notes ) { mpDrawDocument->GetDocSh()->SetWaitCursor( false ); return true; } if (meMode == SEARCH) - getOutlinerView()->StartSearchAndReplace(*mpSearchItem); + { + auto nMatch = getOutlinerView()->StartSearchAndReplace(*mpSearchItem); + if (nMatch && maCurrentPosition.meEditMode == EditMode::Page + && maCurrentPosition.mePageKind == PageKind::Notes) + { + if(auto pNotesPaneOutliner = lclGetNotesPaneOutliner(pViewShell)) + { + pNotesPaneOutliner->SetSelection(getOutlinerView()->GetSelection()); + } + } + } } } } @@ -972,10 +1018,30 @@ void SdOutliner::DetectChange() std::shared_ptr pDrawViewShell ( std::dynamic_pointer_cast(pViewShell)); + std::shared_ptr pOverridingViewShell{}; + if(sd::ViewShellBase* pBase = getViewShellBase()) + { + if (const std::shared_ptr& pViewShellManager = pBase->GetViewShellManager()) + pOverridingViewShell = pViewShellManager->GetOverridingMainShell(); + } + + bool bViewChanged = false; + + if( pDrawViewShell ) + { + if( !pOverridingViewShell ) + bViewChanged = (aPosition.meEditMode != pDrawViewShell->GetEditMode() || aPosition.mePageKind != pDrawViewShell->GetPageKind()); + else + { + auto pPage = pOverridingViewShell->getCurrentPage(); + auto ePageKind = pPage ? pPage->GetPageKind() : PageKind::Standard; + auto eEditMode = EditMode::Page; + bViewChanged = (aPosition.meEditMode != eEditMode || aPosition.mePageKind != ePageKind); + } + } + // Detect whether the view has been switched from the outside. - if (pDrawViewShell != nullptr - && (aPosition.meEditMode != pDrawViewShell->GetEditMode() - || aPosition.mePageKind != pDrawViewShell->GetPageKind())) + if( bViewChanged ) { // Either the edit mode or the page kind has changed. SetStatusEventHdl(Link()); @@ -1527,12 +1593,20 @@ void SdOutliner::PrepareSearchAndReplace() EnterEditMode(false); - mpDrawDocument->GetDocSh()->SetWaitCursor( false ); - // Start search at the right end of the current object's text - // depending on the search direction. + mpDrawDocument->GetDocSh()->SetWaitCursor(false); + OutlinerView* pOutlinerView = getOutlinerView(); if (pOutlinerView != nullptr) + { pOutlinerView->SetSelection (GetSearchStartPosition ()); + if (lclIsValidTextObject(maCurrentPosition) && maCurrentPosition.mePageKind == PageKind::Notes) + { + if (auto pNotesPaneOutliner = lclGetNotesPaneOutliner(mpWeakViewShell.lock())) + { + pNotesPaneOutliner->SetSelection(getOutlinerView()->GetSelection()); + } + } + } } void SdOutliner::SetViewMode (PageKind ePageKind) @@ -1660,8 +1734,43 @@ void SdOutliner::EnterEditMode (bool bGrabFocus) // Turn on the edit mode for the text object. SetUpdateLayout(true); - mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this, - pOutlinerView, true, true, bGrabFocus); + + if(maCurrentPosition.mePageKind == PageKind::Notes + && maCurrentPosition.meEditMode == EditMode::Page) + { + sd::ViewShellBase& rBase = pViewShell->GetViewShellBase(); + + sd::framework::FrameworkHelper::Instance(rBase)->RequestView( + sd::framework::FrameworkHelper::msNotesPanelViewURL, + sd::framework::FrameworkHelper::msBottomImpressPaneURL); + + auto pInstance = sd::framework::FrameworkHelper::Instance(rBase); + pInstance->RequestSynchronousUpdate(); + + std::shared_ptr pNotesPaneShell(pInstance->GetViewShell(sd::framework::FrameworkHelper::msBottomImpressPaneURL)); + if(pNotesPaneShell) + { + pNotesPaneShell->GetParentWindow()->GrabFocus(); + pNotesPaneShell->GetContentWindow()->GrabFocus(); + } + } + else + { + std::shared_ptr pOverridingViewShell{}; + sd::ViewShellBase* pBase = getViewShellBase(); + if (auto pViewShellManager = pBase->GetViewShellManager()) + pOverridingViewShell = pViewShellManager->GetOverridingMainShell(); + + if (pOverridingViewShell) + { + getViewShellBase()->GetMainViewShell()->GetParentWindow()->GrabFocus(); + getViewShellBase()->GetMainViewShell()->GetContentWindow()->GrabFocus(); + bGrabFocus = true; + } + + mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this, pOutlinerView, + true, true, bGrabFocus); + } mbFoundObject = true; } @@ -1733,8 +1842,25 @@ bool SdOutliner::HandleFailedSearch() SdrObject* SdOutliner::SetObject ( const sd::outliner::IteratorPosition& rPosition) { - SetViewMode (rPosition.mePageKind); - SetPage (rPosition.meEditMode, static_cast(rPosition.mnPageIndex)); + if(rPosition.meEditMode == EditMode::Page && rPosition.mePageKind == PageKind::Notes) + { + std::shared_ptr pViewShell (mpWeakViewShell.lock()); + if (std::shared_ptr pDrawViewShell = + std::dynamic_pointer_cast(pViewShell)) + { + if (pDrawViewShell->GetEditMode() != EditMode::Page + || pDrawViewShell->GetCurPagePos() != rPosition.mnPageIndex) + SetPage(EditMode::Page, static_cast(rPosition.mnPageIndex)); + } + mnText = rPosition.mnText; + return rPosition.mxObject.get().get(); + } + else + { + SetViewMode(rPosition.mePageKind); + SetPage(rPosition.meEditMode, static_cast(rPosition.mnPageIndex)); + } + mnText = rPosition.mnText; return rPosition.mxObject.get().get(); } diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx index a7cd6cf66bf2..492880e9bf7c 100644 --- a/sd/source/ui/view/OutlinerIterator.cxx +++ b/sd/source/ui/view/OutlinerIterator.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include namespace sd::outliner { @@ -149,6 +151,11 @@ Iterator OutlinerContainer::current() Iterator OutlinerContainer::CreateIterator (IteratorLocation aLocation) { + std::shared_ptr pOverridingShell{}; + if (auto pBase = dynamic_cast(SfxViewShell::Current())) + if (auto pViewShellManager = pBase->GetViewShellManager()) + pOverridingShell = pViewShellManager->GetOverridingMainShell(); + // Decide on certain features of the outliner which kind of iterator to // use. if (mpOutliner->mbRestrictSearchToSelection) @@ -156,6 +163,7 @@ Iterator OutlinerContainer::CreateIterator (IteratorLocation aLocation) return CreateSelectionIterator ( mpOutliner->maMarkListCopy, mpOutliner->mpDrawDocument, + pOverridingShell ? pOverridingShell : mpOutliner->mpWeakViewShell.lock(), mpOutliner->mbDirectionIsForward, aLocation); @@ -163,6 +171,7 @@ Iterator OutlinerContainer::CreateIterator (IteratorLocation aLocation) // Search in the whole document. return CreateDocumentIterator ( mpOutliner->mpDrawDocument, + pOverridingShell ? pOverridingShell : mpOutliner->mpWeakViewShell.lock(), mpOutliner->mbDirectionIsForward, aLocation); @@ -258,7 +267,8 @@ Iterator OutlinerContainer::CreateDocumentIterator ( } else { - ePageKind = PageKind::Standard; + auto pPage = rpViewShell->getCurrentPage(); + ePageKind = pPage ? pPage->GetPageKind() : PageKind::Standard; eEditMode = EditMode::Page; } break; @@ -502,144 +512,35 @@ bool SelectionIteratorImpl::IsEqualSelection(const IteratorImplBase& rIterator) && mnObjectIndex == pSelectionIterator->mnObjectIndex; } -//===== ViewIteratorImpl ================================================ - -ViewIteratorImpl::ViewIteratorImpl ( - sal_Int32 nPageIndex, - SdDrawDocument* pDocument, - const std::weak_ptr& rpViewShellWeak, - bool bDirectionIsForward) - : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward), - mbPageChangeOccurred(false), - mpPage(nullptr) +void DocumentIteratorImpl::SetPage(sal_Int32 nPageIndex) { - SetPage (nPageIndex); -} + maPosition.mnPageIndex = nPageIndex; -ViewIteratorImpl::ViewIteratorImpl ( - sal_Int32 nPageIndex, - SdDrawDocument* pDocument, - const std::weak_ptr& rpViewShellWeak, - bool bDirectionIsForward, - PageKind ePageKind, - EditMode eEditMode) - : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward, ePageKind, eEditMode), - mbPageChangeOccurred(false), - mpPage(nullptr) -{ - SetPage (nPageIndex); -} - -ViewIteratorImpl::~ViewIteratorImpl() -{ -} - -IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const -{ - - ViewIteratorImpl* pIterator = static_cast(pObject); - if (pIterator == nullptr) - pIterator = new ViewIteratorImpl ( - maPosition.mnPageIndex, mpDocument, mpViewShellWeak, mbDirectionIsForward); - - IteratorImplBase::Clone (pObject); - - if (moObjectIterator) - { - pIterator->moObjectIterator.emplace(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward); - - // No direct way to set the object iterator to the current object. - pIterator->maPosition.mxObject = nullptr; - while (pIterator->moObjectIterator->IsMore() && pIterator->maPosition.mxObject.get()!=maPosition.mxObject.get()) - pIterator->maPosition.mxObject = pIterator->moObjectIterator->Next(); - } + sal_Int32 nPageCount; + if (maPosition.meEditMode == EditMode::Page) + nPageCount = mpDocument->GetSdPageCount(maPosition.mePageKind); else - pIterator->moObjectIterator.reset(); + nPageCount = mpDocument->GetMasterSdPageCount( + maPosition.mePageKind); - return pIterator; -} - -void ViewIteratorImpl::GotoNextText() -{ - SdrTextObj* pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() ); - if( pTextObj ) + // Get page pointer. Here we have three cases: regular pages, + // master pages and invalid page indices. The later ones are not + // errors but the effect of the iterator advancing to the next page + // and going past the last one. This dropping of the rim at the far + // side is detected here and has to be reacted to by the caller. + if (nPageIndex>=0 && nPageIndex < nPageCount) { - if (mbDirectionIsForward) - { - ++maPosition.mnText; - if( maPosition.mnText < pTextObj->getTextCount() ) - return; - } - else - { - --maPosition.mnText; - if( maPosition.mnText >= 0 ) - return; - } - } - - if (moObjectIterator && moObjectIterator->IsMore()) - maPosition.mxObject = moObjectIterator->Next(); - else - maPosition.mxObject = nullptr; - - if (!maPosition.mxObject.get().is() ) - { - if (mbDirectionIsForward) - SetPage (maPosition.mnPageIndex+1); - else - SetPage (maPosition.mnPageIndex-1); - - if (mpPage != nullptr) - moObjectIterator.emplace( mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward ); - if (moObjectIterator && moObjectIterator->IsMore()) - maPosition.mxObject = moObjectIterator->Next(); - else - maPosition.mxObject = nullptr; - } - - maPosition.mnText = 0; - if( !mbDirectionIsForward && maPosition.mxObject.get().is() ) - { - pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() ); - if( pTextObj ) - maPosition.mnText = pTextObj->getTextCount() - 1; - } -} - -void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex) -{ - mbPageChangeOccurred = (maPosition.mnPageIndex!=nPageIndex); - if (mbPageChangeOccurred) - { - maPosition.mnPageIndex = nPageIndex; - - sal_Int32 nPageCount; if (maPosition.meEditMode == EditMode::Page) - nPageCount = mpDocument->GetSdPageCount(maPosition.mePageKind); - else - nPageCount = mpDocument->GetMasterSdPageCount( + mpPage = mpDocument->GetSdPage ( + static_cast(nPageIndex), maPosition.mePageKind); - - // Get page pointer. Here we have three cases: regular pages, - // master pages and invalid page indices. The later ones are not - // errors but the effect of the iterator advancing to the next page - // and going past the last one. This dropping of the rim at the far - // side is detected here and has to be reacted to by the caller. - if (nPageIndex>=0 && nPageIndex < nPageCount) - { - if (maPosition.meEditMode == EditMode::Page) - mpPage = mpDocument->GetSdPage ( - static_cast(nPageIndex), - maPosition.mePageKind); - else - mpPage = mpDocument->GetMasterSdPage ( - static_cast(nPageIndex), - maPosition.mePageKind); - } else - mpPage = nullptr; + mpPage = mpDocument->GetMasterSdPage ( + static_cast(nPageIndex), + maPosition.mePageKind); } + else + mpPage = nullptr; // Set up object list iterator. if (mpPage != nullptr) @@ -663,7 +564,7 @@ void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex) } -void ViewIteratorImpl::Reverse() +void DocumentIteratorImpl::Reverse() { IteratorImplBase::Reverse (); @@ -692,13 +593,14 @@ DocumentIteratorImpl::DocumentIteratorImpl ( SdDrawDocument* pDocument, const std::weak_ptr& rpViewShellWeak, bool bDirectionIsForward) - : ViewIteratorImpl (nPageIndex, pDocument, rpViewShellWeak, bDirectionIsForward, - ePageKind, eEditMode) + : IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward, ePageKind, eEditMode) + , mpPage(nullptr) { if (eEditMode == EditMode::Page) mnPageCount = pDocument->GetSdPageCount (ePageKind); else mnPageCount = pDocument->GetMasterSdPageCount(ePageKind); + SetPage(nPageIndex); } DocumentIteratorImpl::~DocumentIteratorImpl() @@ -712,7 +614,21 @@ IteratorImplBase* DocumentIteratorImpl::Clone (IteratorImplBase* pObject) const maPosition.mnPageIndex, maPosition.mePageKind, maPosition.meEditMode, mpDocument, mpViewShellWeak, mbDirectionIsForward); // Finish the cloning. - return ViewIteratorImpl::Clone (pIterator); + IteratorImplBase::Clone (pObject); + + if (moObjectIterator) + { + pIterator->moObjectIterator.emplace(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward); + + // No direct way to set the object iterator to the current object. + pIterator->maPosition.mxObject = nullptr; + while (pIterator->moObjectIterator->IsMore() && pIterator->maPosition.mxObject.get()!=maPosition.mxObject.get()) + pIterator->maPosition.mxObject = pIterator->moObjectIterator->Next(); + } + else + pIterator->moObjectIterator.reset(); + + return pIterator; } void DocumentIteratorImpl::GotoNextText() @@ -720,7 +636,72 @@ void DocumentIteratorImpl::GotoNextText() bool bSetToOnePastLastPage = false; bool bViewChanged = false; - ViewIteratorImpl::GotoNextText(); + SdrTextObj* pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() ); + if( pTextObj ) + { + if (mbDirectionIsForward) + { + ++maPosition.mnText; + if( maPosition.mnText < pTextObj->getTextCount() ) + return; + } + else + { + --maPosition.mnText; + if( maPosition.mnText >= 0 ) + return; + } + } + + if (moObjectIterator && moObjectIterator->IsMore()) + maPosition.mxObject = moObjectIterator->Next(); + else + maPosition.mxObject = nullptr; + + if (!maPosition.mxObject.get().is() ) + { + if (maPosition.meEditMode == EditMode::Page + && maPosition.mePageKind == PageKind::Standard) + { + maPosition.mePageKind = PageKind::Notes; + if (mbDirectionIsForward) + SetPage(maPosition.mnPageIndex); + else + SetPage(maPosition.mnPageIndex - 1); + } + else if (maPosition.meEditMode == EditMode::Page + && maPosition.mePageKind == PageKind::Notes) + { + maPosition.mePageKind = PageKind::Standard; + if (mbDirectionIsForward) + SetPage(maPosition.mnPageIndex + 1); + else + SetPage(maPosition.mnPageIndex); + } + else + { + if (mbDirectionIsForward) + SetPage(maPosition.mnPageIndex + 1); + else + SetPage(maPosition.mnPageIndex - 1); + } + + if (mpPage != nullptr) + moObjectIterator.emplace( mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward ); + if (moObjectIterator && moObjectIterator->IsMore()) + maPosition.mxObject = moObjectIterator->Next(); + else + maPosition.mxObject = nullptr; + } + + maPosition.mnText = 0; + if( !mbDirectionIsForward && maPosition.mxObject.get().is() ) + { + pTextObj = DynCastSdrTextObj( maPosition.mxObject.get().get() ); + if( pTextObj ) + maPosition.mnText = pTextObj->getTextCount() - 1; + } + if (mbDirectionIsForward) { @@ -732,67 +713,74 @@ void DocumentIteratorImpl::GotoNextText() maPosition.meEditMode = EditMode::MasterPage; SetPage (0); } - // Switch to next view mode. else { if (maPosition.mePageKind == PageKind::Handout) - // Not really necessary but makes things more clear. - bSetToOnePastLastPage = true; - else { - maPosition.meEditMode = EditMode::Page; - if (maPosition.mePageKind == PageKind::Standard) - maPosition.mePageKind = PageKind::Notes; - else if (maPosition.mePageKind == PageKind::Notes) - maPosition.mePageKind = PageKind::Handout; - SetPage (0); + // search wrapped + bSetToOnePastLastPage = true; + } + else if (maPosition.mePageKind == PageKind::Standard) + { + // switch to master notes + maPosition.mePageKind = PageKind::Notes; + SetPage(0); + } + else if (maPosition.mePageKind == PageKind::Notes) + { + // switch to master handout + maPosition.mePageKind = PageKind::Handout; + SetPage(0); } } bViewChanged = true; } } else + { if (maPosition.mnPageIndex < 0) { - // Switch from master pages to draw pages. if (maPosition.meEditMode == EditMode::MasterPage) - { - maPosition.meEditMode = EditMode::Page; - bSetToOnePastLastPage = true; - } - - // Switch to previous view mode. - else { if (maPosition.mePageKind == PageKind::Standard) - SetPage (-1); - else { - maPosition.meEditMode = EditMode::MasterPage; - if (maPosition.mePageKind == PageKind::Handout) - maPosition.mePageKind = PageKind::Notes; - else if (maPosition.mePageKind == PageKind::Notes) - maPosition.mePageKind = PageKind::Standard; + maPosition.meEditMode = EditMode::Page; + maPosition.mePageKind = PageKind::Notes; + bSetToOnePastLastPage = true; + } + else if (maPosition.mePageKind == PageKind::Handout) + { + maPosition.mePageKind = PageKind::Notes; + bSetToOnePastLastPage = true; + } + else if (maPosition.mePageKind == PageKind::Notes) + { + maPosition.mePageKind = PageKind::Standard; bSetToOnePastLastPage = true; } } - bViewChanged = true; + else + { + // search wrapped + SetPage(-1); + } } + bViewChanged = true; + } if (!bViewChanged) return; // Get new page count; - sal_Int32 nPageCount; if (maPosition.meEditMode == EditMode::Page) - nPageCount = mpDocument->GetSdPageCount (maPosition.mePageKind); + mnPageCount = mpDocument->GetSdPageCount (maPosition.mePageKind); else - nPageCount = mpDocument->GetMasterSdPageCount(maPosition.mePageKind); + mnPageCount = mpDocument->GetMasterSdPageCount(maPosition.mePageKind); // Now that we know the number of pages we can set the current page index. if (bSetToOnePastLastPage) - SetPage (nPageCount); + SetPage (mnPageCount); } } // end of namespace ::sd::outliner diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index 5b208c12d9df..94306b973bda 100644 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -261,9 +261,12 @@ void DrawViewShell::ExecBmpMask( SfxRequest const & rReq ) case SID_BMPMASK_EXEC : { + if (!mpDrawView) + return; + SdrGrafObj* pObj = nullptr; const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); - if( mpDrawView && rMarkList.GetMarkCount() ) + if( rMarkList.GetMarkCount() ) pObj = dynamic_cast< SdrGrafObj* >( rMarkList.GetMark(0)->GetMarkedSdrObj() ); if ( pObj && !mpDrawView->IsTextEdit() ) diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 9e1e676427a5..5d6cd9d55aed 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1924,6 +1924,7 @@ void DrawViewShell::GetState (SfxItemSet& rSet) { switch (nWhich) { + case FID_SEARCH_NOW: case SID_SEARCH_ITEM: case SID_SEARCH_OPTIONS: // Forward this request to the common (old) code of the @@ -1949,6 +1950,12 @@ void DrawViewShell::Execute (SfxRequest& rReq) switch (rReq.GetSlot()) { + case FID_SEARCH_NOW: + // Forward this request to the common (old) code of the + // document shell. + GetDocSh()->Execute(rReq); + break; + case SID_SEARCH_ITEM: // Forward this request to the common (old) code of the // document shell. diff --git a/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java b/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java index 5697bba07e20..8e5754a0b981 100644 --- a/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java +++ b/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java @@ -91,7 +91,6 @@ public class DocumentMetadataAccess XURI foo; XURI bar; - XURI baz; static XURI rdf_type; static XURI rdfs_label; @@ -100,11 +99,6 @@ public class DocumentMetadataAccess static XURI pkg_MetadataFile; static XURI odf_ContentFile; static XURI odf_StylesFile; - static XURI odf_Element; - static XBlankNode blank1; - static XBlankNode blank2; - static XBlankNode blank3; - static XBlankNode blank4; static String manifestPath = "manifest.rdf"; static String contentPath = "content.xml"; static String stylesPath = "styles.xml"; @@ -139,17 +133,7 @@ public class DocumentMetadataAccess assertNotNull("foo", foo); bar = URI.create(xContext, "uri:bar"); assertNotNull("bar", bar); - baz = URI.create(xContext, "uri:baz"); - assertNotNull("baz", baz); - blank1 = BlankNode.create(xContext, "_:1"); - assertNotNull("blank1", blank1); - blank2 = BlankNode.create(xContext, "_:2"); - assertNotNull("blank2", blank2); - blank3 = BlankNode.create(xContext, "_:3"); - assertNotNull("blank3", blank3); - blank4 = BlankNode.create(xContext, "_:4"); - assertNotNull("blank4", blank4); rdf_type = URI.createKnown(xContext, URIs.RDF_TYPE); assertNotNull("rdf_type", rdf_type); rdfs_label = URI.createKnown(xContext, URIs.RDFS_LABEL); @@ -164,8 +148,6 @@ public class DocumentMetadataAccess assertNotNull("odf_ContentFile", odf_ContentFile); odf_StylesFile = URI.createKnown(xContext, URIs.ODF_STYLESFILE); assertNotNull("odf_StylesFile", odf_StylesFile); - odf_Element = URI.createKnown(xContext, URIs.ODF_ELEMENT); - assertNotNull("odf_Element", odf_Element); } @After public void after() @@ -596,266 +578,6 @@ public class DocumentMetadataAccess } } - @Test public void checkRDFa() throws Exception - { - XComponent xComp = null; - try { - final String file = TestDocument.getUrl("TESTRDFA.odt"); - xComp = loadRDFa(file); - if (xComp != null) - { - final String sNewFile = tempDir + "TESTRDFA.odt"; - storeRDFa(xComp, sNewFile); - close(xComp); - - xComp = loadRDFa(sNewFile); - } - } finally { - close(xComp); - } - } - - @Test - public void checkTdf123293() throws Exception - { - XComponent xComp = null; - try { - xComp = util.DesktopTools.loadDocUsingStream(xMSF, TestDocument.getPath("TESTRDFA.odt")); - - // Metadata was discarded when loading from stream, make sure it's there now - XRepositorySupplier xRepoSupplier = UnoRuntime.queryInterface(XRepositorySupplier.class, xComp); - assertNotNull("No metadata loaded", xRepoSupplier); - } finally { - close(xComp); - } - } - - private void storeRDFa(XComponent xComp, String file) throws com.sun.star.io.IOException - { - System.out.println("Storing test document..."); - - XStorable xStor = UnoRuntime.queryInterface(XStorable.class, xComp); - - xStor.storeToURL(file, new PropertyValue[0]); - - System.out.println("...done"); - } - - private XComponent loadRDFa(String file) throws Exception - { - XComponent xComp = null; - - System.out.println("Loading test document..."); - - PropertyValue[] loadProps = new PropertyValue[1]; - loadProps[0] = new PropertyValue(); - loadProps[0].Name = "Hidden"; - loadProps[0].Value = true; - - - - xComp = util.DesktopTools.loadDoc(xMSF, file, loadProps); - - XRepositorySupplier xRepoSupplier = UnoRuntime.queryInterface(XRepositorySupplier.class, xComp); - assertTrue("xRS null", null != xRepoSupplier); - - XDocumentRepository xDocRepository = UnoRuntime.queryInterface(XDocumentRepository.class, xRepoSupplier.getRDFRepository()); - assertTrue("xRep null", null != xDocRepository); - - XTextDocument xTextDoc = UnoRuntime.queryInterface(XTextDocument.class, xComp); - - XText xText = xTextDoc.getText(); - - XEnumerationAccess xEA = UnoRuntime.queryInterface(XEnumerationAccess.class, xText); - XEnumeration xEnum = xEA.createEnumeration(); - - System.out.println("...done"); - - System.out.println("Checking RDFa in loaded test document..."); - - XMetadatable xPara; - Pair result; - - Statement x_FooBarLit1 = new Statement(foo, bar, mkLit("1"), null); - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 1", - !result.Second && - eq(result.First, new Statement[] { - x_FooBarLit1 - })); - - Statement x_FooBarLit2 = new Statement(foo, bar, mkLit("2"), null); - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 2", - !result.Second && - eq(result.First, new Statement[] { - x_FooBarLit2 - })); - - Statement x_BlankBarLit3 = - new Statement(blank1, bar, mkLit("3"), null); - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 3", - !result.Second && - eq(result.First, new Statement[] { - x_BlankBarLit3 - })); - XBlankNode b3 = UnoRuntime.queryInterface(XBlankNode.class, result.First[0].Subject); - - Statement x_BlankBarLit4 = - new Statement(blank2, bar, mkLit("4"), null); - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 4", - !result.Second && - eq(result.First, new Statement[] { - x_BlankBarLit4 - })); - XBlankNode b4 = UnoRuntime.queryInterface(XBlankNode.class, result.First[0].Subject); - - Statement x_BlankBarLit5 = - new Statement(blank1, bar, mkLit("5"), null); - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 5", - !result.Second && - eq(result.First, new Statement[] { - x_BlankBarLit5 - })); - XBlankNode b5 = UnoRuntime.queryInterface(XBlankNode.class, result.First[0].Subject); - - assertTrue("RDFa: 3 != 4", - !b3.getStringValue().equals(b4.getStringValue())); - assertTrue("RDFa: 3 == 5", - b3.getStringValue().equals(b5.getStringValue())); - - Statement x_FooBarLit6 = new Statement(foo, bar, mkLit("6"), null); - Statement x_FooBazLit6 = new Statement(foo, baz, mkLit("6"), null); - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 6", - !result.Second && - eq(result.First, new Statement[] { - x_FooBarLit6, x_FooBazLit6 - })); - - Statement x_FooBarLit7 = new Statement(foo, bar, mkLit("7"), null); - Statement x_FooBazLit7 = new Statement(foo, baz, mkLit("7"), null); - Statement x_FooFooLit7 = new Statement(foo, foo, mkLit("7"), null); - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 7", - !result.Second && - eq(result.First, new Statement[] { - x_FooBarLit7, x_FooBazLit7, x_FooFooLit7 - })); - - XNode lit = mkLit("a fooish bar"); - XNode lit_type= mkLit("a fooish bar", bar); - Statement x_FooBarLit = new Statement(foo, bar, lit, null); - Statement x_FooBarLittype = new Statement(foo, bar, lit_type, null); - - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 8", - result.Second && - eq(result.First, new Statement[] { - x_FooBarLit - })); - - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 9", - result.Second && - eq(result.First, new Statement[] { - x_FooBarLit - })); - - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 10", - result.Second && - eq(result.First, new Statement[] { - x_FooBarLittype - })); - - Statement x_FooBarLit11 - = new Statement(foo, bar, mkLit("11", bar), null); - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 11", - !result.Second && - eq(result.First, new Statement[] { - x_FooBarLit11 - })); - - XURI xFile = URI.createNS(xContext, file, "/" + contentPath); - Statement x_FileBarLit12 = - new Statement(xFile, bar, mkLit("12"), null); - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 12", - !result.Second && - eq(result.First, new Statement[] { - x_FileBarLit12 - })); - - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 13", - result.Second && - eq(result.First, new Statement[] { - x_FooBarLit - })); - - new Statement(foo, rdfs_label, mkLit("14"), null); - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 14", - result.Second && - eq(result.First, new Statement[] { - /* x_FooLabelLit14 */ x_FooBarLit - })); - - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 15", eq(result.First, new Statement[] { } )); - - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 16", eq(result.First, new Statement[] { } )); - - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 17", eq(result.First, new Statement[] { } )); - - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 18", eq(result.First, new Statement[] { } )); - - xPara = UnoRuntime.queryInterface(XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 19", eq(result.First, new Statement[] { } )); - - xPara = UnoRuntime.queryInterface( - XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 20", eq(result.First, new Statement[] { } )); - - xPara = UnoRuntime.queryInterface( - XMetadatable.class, xEnum.nextElement()); - result = xDocRepository.getStatementRDFa(xPara); - assertTrue("RDFa: 21", eq(result.First, new Statement[] { } )); - - System.out.println("...done"); - - return xComp; - } - - // utilities ------------------------------------------------------------- static void close(XComponent i_comp) diff --git a/sfx2/qa/complex/sfx2/testdocuments/TESTRDFA.odt b/sfx2/qa/cppunit/data/TESTRDFA.odt similarity index 100% rename from sfx2/qa/complex/sfx2/testdocuments/TESTRDFA.odt rename to sfx2/qa/cppunit/data/TESTRDFA.odt diff --git a/sfx2/qa/cppunit/misc/hello.odt b/sfx2/qa/cppunit/data/hello.odt similarity index 100% rename from sfx2/qa/cppunit/misc/hello.odt rename to sfx2/qa/cppunit/data/hello.odt diff --git a/sfx2/qa/cppunit/test_misc.cxx b/sfx2/qa/cppunit/test_misc.cxx index 47c663a0246b..28067357b3b5 100644 --- a/sfx2/qa/cppunit/test_misc.cxx +++ b/sfx2/qa/cppunit/test_misc.cxx @@ -15,29 +15,32 @@ #endif #include -#include -#include -#include - +#include #include #include #include #include #include #include +#include +#include +#include +#include +#include +#include #include #include +#include #include +#include #include #include #include - using namespace ::com::sun::star; - namespace { class MiscTest @@ -45,7 +48,7 @@ class MiscTest { public: MiscTest() - : UnoApiXmlTest(u"/sfx2/qa/cppunit/misc/"_ustr) + : UnoApiXmlTest(u"/sfx2/qa/cppunit/data/"_ustr) { } @@ -194,6 +197,275 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testOverwrite) } } +std::vector +sortStatementsByPredicate(const uno::Sequence& rStatements) +{ + std::vector aStatements + = comphelper::sequenceToContainer>(rStatements); + std::sort(aStatements.begin(), aStatements.end(), + [](const rdf::Statement& a, const rdf::Statement& b) { + return a.Predicate->getStringValue() < b.Predicate->getStringValue(); + }); + return aStatements; +} + +CPPUNIT_TEST_FIXTURE(MiscTest, testRDFa) +{ + auto verify = [this](bool bIsExport) { + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xParaEnumAccess(xTextDocument->getText(), + uno::UNO_QUERY); + uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); + + uno::Reference xDocumentMetadataAccess(mxComponent, + uno::UNO_QUERY); + uno::Reference xRepo = xDocumentMetadataAccess->getRDFRepository(); + uno::Reference xDocRepo(xRepo, uno::UNO_QUERY); + CPPUNIT_ASSERT(xDocRepo); + + { + // RDFa: 1 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[0].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("1"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(!xResult.Second); + } + { + // RDFa: 2 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[0].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("2"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(!xResult.Second); + } + + OUString aSubject3; + OUString aSubject4; + OUString aSubject5; + { + // RDFa: 3 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + aSubject3 = aStatements[0].Subject->getStringValue(); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("3"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(!xResult.Second); + } + { + // RDFa: 4 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + aSubject4 = aStatements[0].Subject->getStringValue(); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("4"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(!xResult.Second); + } + { + // RDFa: 5 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + aSubject5 = aStatements[0].Subject->getStringValue(); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("5"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(!xResult.Second); + } + + CPPUNIT_ASSERT(aSubject3 != aSubject4); + CPPUNIT_ASSERT_EQUAL(aSubject3, aSubject5); + + { + // RDFa: 6 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + + std::vector aStatements = sortStatementsByPredicate(xResult.First); + CPPUNIT_ASSERT_EQUAL(size_t(2), aStatements.size()); + + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[0].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("6"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[1].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:baz"), aStatements[1].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("6"), aStatements[1].Object->getStringValue()); + CPPUNIT_ASSERT(!xResult.Second); + } + { + // RDFa: 7 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + std::vector aStatements = sortStatementsByPredicate(xResult.First); + CPPUNIT_ASSERT_EQUAL(size_t(3), aStatements.size()); + + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[0].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("7"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[1].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:baz"), aStatements[1].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("7"), aStatements[1].Object->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[2].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[2].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("7"), aStatements[2].Object->getStringValue()); + CPPUNIT_ASSERT(!xResult.Second); + } + { + // RDFa: 8 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[0].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("a fooish bar"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(xResult.Second); + } + { + // RDFa: 9 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[0].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("a fooish bar"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(xResult.Second); + } + { + // RDFa: 10 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[0].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("a fooish bar^^uri:bar"), + aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(xResult.Second); + } + { + // RDFa: 11 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[0].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("11^^uri:bar"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(!xResult.Second); + } + { + // RDFa: 12 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + OUString aSubject; + if (bIsExport) + aSubject = maTempFile.GetURL() + "/content.xml"; + else + aSubject = createFileURL(u"TESTRDFA.odt") + "/content.xml"; + CPPUNIT_ASSERT_EQUAL(aSubject, aStatements[0].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("12"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(!xResult.Second); + } + { + // RDFa: 13 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[0].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("a fooish bar"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(xResult.Second); + } + { + // RDFa: 14 + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aStatements.getLength()); + + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatements[0].Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatements[0].Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("a fooish bar"), aStatements[0].Object->getStringValue()); + CPPUNIT_ASSERT(xResult.Second); + } + + // Remaining rdfs should be empty + do + { + uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + ::beans::Pair, sal_Bool> xResult + = xDocRepo->getStatementRDFa(xPara); + uno::Sequence aStatements = xResult.First; + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aStatements.getLength()); + } while (xParaEnum->hasMoreElements()); + }; + + loadFromFile(u"TESTRDFA.odt"); + verify(/*bIsExport*/ false); + saveAndReload(u"writer8"_ustr); + verify(/*bIsExport*/ true); +} + +CPPUNIT_TEST_FIXTURE(MiscTest, testTdf123293) +{ + const uno::Reference xContext(comphelper::getProcessComponentContext(), + css::uno::UNO_SET_THROW); + const uno::Reference xFileAccess( + xContext->getServiceManager()->createInstanceWithContext( + u"com.sun.star.ucb.SimpleFileAccess"_ustr, xContext), + uno::UNO_QUERY_THROW); + const uno::Reference xInputStream(xFileAccess->openFileRead(createFileURL(u"TESTRDFA.odt") ), + uno::UNO_SET_THROW); + uno::Sequence aLoadArgs{ comphelper::makePropertyValue( + "InputStream", xInputStream) }; + mxComponent = mxDesktop->loadComponentFromURL(u"private:stream"_ustr, u"_blank"_ustr, 0, aLoadArgs); + CPPUNIT_ASSERT(mxComponent.is()); + uno::Reference xDocumentMetadataAccess(mxComponent, uno::UNO_QUERY); + uno::Reference xRepo = xDocumentMetadataAccess->getRDFRepository(); + uno::Reference xDocRepo(xRepo, uno::UNO_QUERY); + CPPUNIT_ASSERT(xDocRepo); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 737635ddf2c0..c9c37f554a96 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -497,7 +497,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) { SfxObjectShell* pNxtObjSh = SfxObjectShell::GetNext(*pObjSh); // can close immediately - if (!pObjSh->IsModified() || pObjSh->isSaveLocked()) + if (!pObjSh->IsModified()) { // don't close the last remaining frame for close dispatch if (pNxtObjSh || !bClosedAll) @@ -1352,10 +1352,8 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) rSet.DisableItem(nWhich); return; } - Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); Reference< XIndexAccess > xTasks = xDesktop->getFrames(); - if ( !xTasks.is() || !xTasks->getCount() ) rSet.DisableItem(nWhich); break; diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 4d166d61f424..ee2e4459cf63 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -196,8 +196,9 @@ BackingWindow::BackingWindow(vcl::Window* i_pParent) // tdf#161796 make the extension button show the donation page if (officecfg::Office::Common::Misc::ShowDonation::get()) { - mxExtensionsButton->set_label(SfxResId(STR_DONATE_BUTTON)); - mxExtensionsButton->set_from_icon_name(BMP_DONATE); + OUString test = SfxResId(STR_DONATE_BUTTON); + mxExtensionsButton->set_from_icon_name(BMP_DONATE); // icon first needed on gtk3 to apply the label + mxExtensionsButton->set_label(test); } mxDropTarget = mxAllRecentThumbnails->GetDropTarget(); diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index c8bda80385f0..ca2f96b5c810 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -81,7 +81,7 @@ SfxTabDialogItem::SfxTabDialogItem( const SfxTabDialogItem& rAttr, SfxItemPool* } SfxTabDialogItem::SfxTabDialogItem( sal_uInt16 nId, const SfxItemSet& rItemSet ) - : SfxSetItem( nId, rItemSet ) + : SfxSetItem( nId, rItemSet, SfxItemType::SfxTabDialogItemType ) { } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 397b13c6bccc..60594554b80a 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -962,6 +962,12 @@ void SfxObjectShell::BreakMacroSign_Impl( bool bBreakMacroSign ) void SfxObjectShell::CheckSecurityOnLoading_Impl() { + if (GetErrorCode() == ERRCODE_IO_BROKENPACKAGE) + { // safety first: don't run any macros from broken package. + pImpl->aMacroMode.disallowMacroExecution(); + return; // do not get signature status - needs to be done after RepairPackage + } + // make sure LO evaluates the macro signatures, so it can be preserved GetScriptingSignatureState(); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 428e4d2d9d0c..555e57492801 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -49,7 +49,6 @@ #include #include #include -#include #include #include @@ -733,7 +732,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if (!rReq.IsSynchronCall()) { std::shared_ptr xReq = std::make_shared(rReq); - SfxTabDialogController::runAsync(xDlg, [xReq=std::move(xReq), aFunc](sal_Int32 nResult) + SfxTabDialogController::runAsync(xDlg, [xReq=std::move(xReq), aFunc=std::move(aFunc)](sal_Int32 nResult) { aFunc(nResult, *xReq); }); @@ -1294,13 +1293,6 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) case SID_CLOSEDOC: { - // cancel requests during SfxApplication is closing or quitting. - SfxAppData_Impl* pAppData = SfxGetpApp()->Get_Impl(); - if (pAppData && (pAppData->bInQuit || pAppData->bClosingDocs)) - { - return; - } - // Evaluate Parameter const SfxBoolItem* pSaveItem = rReq.GetArg(SID_CLOSEDOC_SAVE); const SfxStringItem* pNameItem = rReq.GetArg(SID_CLOSEDOC_FILENAME); @@ -1917,6 +1909,13 @@ SignatureState SfxObjectShell::ImplGetSignatureState( bool bScriptingContent ) uno::Sequence< security::DocumentSignatureInformation > aInfos = GetDocumentSignatureInformation( bScriptingContent ); *pState = DocumentSignatures::getSignatureState(aInfos); + + // repaired package cannot be trusted + if (*pState != SignatureState::NOSIGNATURES + && GetMedium()->IsRepairPackage()) + { + *pState = SignatureState::BROKEN; + } } if ( *pState == SignatureState::OK || *pState == SignatureState::NOTVALIDATED diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index efc60481c7e5..86717c1f428a 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -402,6 +402,8 @@ void SfxObjectShell::PrepareSecondTryLoad_Impl() // only for internal use pImpl->m_xDocStorage.clear(); pImpl->mxObjectContainer.reset(); + pImpl->nDocumentSignatureState = SignatureState::UNKNOWN; + pImpl->nScriptingSignatureState = SignatureState::UNKNOWN; pImpl->m_bIsInit = false; ResetError(); } @@ -3392,17 +3394,17 @@ bool SfxObjectShell::PreDoSaveAs_Impl(const OUString& rFileName, const OUString& for(int i = 0 ; i< rArgs.getLength() ; ++i) { - auto aProp = rArgs[i]; - if(aProp.Name == "EncryptFile") + const auto& rProp = rArgs[i]; + if (rProp.Name == "EncryptFile") { - pSaveToFilterDataOptions[0].Name = aProp.Name; - pSaveToFilterDataOptions[0].Value = aProp.Value; + pSaveToFilterDataOptions[0].Name = rProp.Name; + pSaveToFilterDataOptions[0].Value = rProp.Value; bRet = true; } - if(aProp.Name == "DocumentOpenPassword") + else if (rProp.Name == "DocumentOpenPassword") { - pSaveToFilterDataOptions[1].Name = aProp.Name; - pSaveToFilterDataOptions[1].Value = aProp.Value; + pSaveToFilterDataOptions[1].Name = rProp.Name; + pSaveToFilterDataOptions[1].Value = rProp.Value; bRet = true; } } diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx index 57e59f96b6f0..e4e10744b2a4 100644 --- a/shell/source/win32/SysShExec.cxx +++ b/shell/source/win32/SysShExec.cxx @@ -266,12 +266,12 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa + ") failed", {}, 0); } - SHFILEINFOW info; - if (SHGetFileInfoW(path, 0, &info, sizeof info, SHGFI_EXETYPE) != 0) + if (SHGetFileInfoW(path, 0, nullptr, 0, SHGFI_EXETYPE) != 0) { throw css::security::AccessControlException( "XSystemShellExecute.execute, cannot process <" + aCommand + ">", {}, {}); } + SHFILEINFOW info; if (SHGetFileInfoW(path, 0, &info, sizeof info, SHGFI_ATTRIBUTES) == 0) { throw css::lang::IllegalArgumentException( @@ -281,49 +281,26 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa if ((info.dwAttributes & SFGAO_LINK) == 0) { break; } - sal::systools::COMReference link; try { - link.CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER); + sal::systools::COMReference link(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER); + sal::systools::COMReference file(link, sal::systools::COM_QUERY_THROW); + sal::systools::ThrowIfFailed(file->Load(path, STGM_READ), + "IPersistFile.Load failed"); + sal::systools::ThrowIfFailed(link->Resolve(nullptr, SLR_UPDATE | SLR_NO_UI), + "IShellLink.Resolve failed"); + sal::systools::ThrowIfFailed(link->GetPath(path, std::size(path), nullptr, SLGP_RAWPATH), + "IShellLink.GetPath failed"); } catch (sal::systools::ComError& e) { throw css::lang::IllegalArgumentException( - ("XSystemShellExecute.execute, CoCreateInstance failed with " + ("XSystemShellExecute.execute, " + o3tl::runtimeToOUString(e.what()) + + " at " + o3tl::runtimeToOUString(e.GetLocation().file_name()) + ":" + + OUString::number(e.GetLocation().line()) + " error " + OUString::number(e.GetHresult())), {}, 0); } - sal::systools::COMReference file; - try { - file = link.QueryInterface(sal::systools::COM_QUERY_THROW); - } catch(sal::systools::ComError & e3) { - throw css::lang::IllegalArgumentException( - ("XSystemShellExecute.execute, QueryInterface failed with: " - + o3tl::runtimeToOUString(e3.what())), - {}, 0); - } - HRESULT e2 = file->Load(path, STGM_READ); - if (FAILED(e2)) { - throw css::lang::IllegalArgumentException( - ("XSystemShellExecute.execute, IPersistFile.Load failed with " - + OUString::number(e2)), - {}, 0); - } - e2 = link->Resolve(nullptr, SLR_UPDATE | SLR_NO_UI); - if (FAILED(e2)) { - throw css::lang::IllegalArgumentException( - ("XSystemShellExecute.execute, IShellLink.Resolve failed with " - + OUString::number(e2)), - {}, 0); - } - WIN32_FIND_DATAW wfd; - e2 = link->GetPath(path, SAL_N_ELEMENTS(path), &wfd, SLGP_RAWPATH); - if (FAILED(e2)) { - throw css::lang::IllegalArgumentException( - ("XSystemShellExecute.execute, IShellLink.GetPath failed with " - + OUString::number(e2)), - {}, 0); - } // Fail at some arbitrary nesting depth, to avoid an infinite loop: if (i == 30) { throw css::lang::IllegalArgumentException( @@ -331,15 +308,15 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa {}, 0); } } - pathname = o3tl::toU(path); + std::u16string_view resulting_path(o3tl::toU(path)); // ShellExecuteExW appears to ignore trailing dots, so remove them: - while (pathname.endsWith(".", &pathname)) {} - auto const n = pathname.lastIndexOf('.'); - if (n > pathname.lastIndexOf('\\')) { - auto const ext = pathname.copy(n + 1); - if (!ext.isEmpty()) { + while (o3tl::ends_with(resulting_path, u".", &resulting_path)) {} + auto const n = resulting_path.find_last_of('.'); + if (n != std::u16string_view::npos && n > resulting_path.find_last_of('\\')) { + auto const ext = resulting_path.substr(n + 1); + if (!ext.empty()) { OUString env; - if (osl_getEnvironment(OUString("PATHEXT").pData, &env.pData) + if (osl_getEnvironment(u"PATHEXT"_ustr.pData, &env.pData) != osl_Process_E_None) { SAL_INFO("shell", "osl_getEnvironment(PATHEXT) failed"); diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in index 98d42674d517..28f673ad9b9f 100644 --- a/solenv/flatpak-manifest.in +++ b/solenv/flatpak-manifest.in @@ -620,6 +620,55 @@ "dest": "external/tarballs", "dest-filename": "@FONT_SCHEHERAZADE_TARBALL@" }, + { + "url": "https://dev-www.libreoffice.org/src/@FONT_AGDASIMA_TARBALL@", + "sha256": "@FONT_AGDASIMA_SHA256SUM@", + "type": "file", + "dest": "external/tarballs", + "dest-filename": "@FONT_AGDASIMA_TARBALL@" + }, + { + "url": "https://dev-www.libreoffice.org/src/@FONT_BACASIME_ANTIQUE_TARBALL@", + "sha256": "@FONT_BACASIME_ANTIQUE_SHA256SUM@", + "type": "file", + "dest": "external/tarballs", + "dest-filename": "@FONT_BACASIME_ANTIQUE_TARBALL@" + }, + { + "url": "https://dev-www.libreoffice.org/src/@FONT_BELANOSIMA_TARBALL@", + "sha256": "@FONT_BELANOSIMA_SHA256SUM@", + "type": "file", + "dest": "external/tarballs", + "dest-filename": "@FONT_BELANOSIMA_TARBALL@" + }, + { + "url": "https://dev-www.libreoffice.org/src/@FONT_CAPRASIMO_TARBALL@", + "sha256": "@FONT_CAPRASIMO_SHA256SUM@", + "type": "file", + "dest": "external/tarballs", + "dest-filename": "@FONT_CAPRASIMO_TARBALL@" + }, + { + "url": "https://dev-www.libreoffice.org/src/@FONT_LUGRASIMO_TARBALL@", + "sha256": "@FONT_LUGRASIMO_SHA256SUM@", + "type": "file", + "dest": "external/tarballs", + "dest-filename": "@FONT_LUGRASIMO_TARBALL@" + }, + { + "url": "https://dev-www.libreoffice.org/src/@FONT_LUMANOSIMO_TARBALL@", + "sha256": "@FONT_LUMANOSIMO_SHA256SUM@", + "type": "file", + "dest": "external/tarballs", + "dest-filename": "@FONT_LUMANOSIMO_TARBALL@" + }, + { + "url": "https://dev-www.libreoffice.org/src/@FONT_LUNASIMA_TARBALL@", + "sha256": "@FONT_LUNASIMA_SHA256SUM@", + "type": "file", + "dest": "external/tarballs", + "dest-filename": "@FONT_LUNASIMA_TARBALL@" + }, { "url": "https://dev-www.libreoffice.org/src/@BSH_TARBALL@", "sha256": "@BSH_SHA256SUM@", diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index 30f2fbe3b21e..2a2f89cf8f45 100644 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -70,8 +70,6 @@ include $(GBUILDDIR)/Helper.mk include $(GBUILDDIR)/Conditions.mk -include $(SRCDIR)/solenv/inc/langlist.mk - # optional extensions that should never be essential ifneq ($(wildcard $(GBUILDDIR)/extensions/pre_*.mk),) include $(wildcard $(GBUILDDIR)/extensions/pre_*.mk) @@ -176,6 +174,7 @@ endif include $(GBUILDDIR)/ExternalExecutable.mk include $(GBUILDDIR)/TargetLocations.mk +include $(SRCDIR)/solenv/inc/langlist.mk define gb_var2file $(file >$(1),$(2))$(1) diff --git a/solenv/vs/LibreOffice.natvis b/solenv/vs/LibreOffice.natvis index 4ce4fcbfd198..8cfedffb93de 100644 --- a/solenv/vs/LibreOffice.natvis +++ b/solenv/vs/LibreOffice.natvis @@ -57,30 +57,50 @@ typelib_TypeClass_CONSTANTS = 30, typelib_TypeClass_SINGLETON = 31, --> - {*((wchar_t*)pData),c} (CHAR) - {*((bool*)pData),d} (BOOLEAN) - {*((unsigned char*)pData),d} (BYTE) - {*((short*)pData),d} (SHORT) - {*((unsigned short*)pData),d} (UNSIGNED_SHORT) - {*((int*)pData),d} (LONG) - {*((unsigned int*)pData),d} (UNSIGNED_LONG) - {*((__int64*)pData),d} (HYPER) - {*((unsigned __int64*)pData),d} (UNSIGNED_HYPER) - {*((float*)pData)} (FLOAT) - {*((double*)pData)} (DOUBLE) - {*((rtl::OUString*)pData)} (STRING) - {*((com::sun::star::uno::Type*)pData)} (TYPE) - {*((_uno_Any*)pData)} (ANY) - {*((sal_Int32*)pData),d} (ENUM) - {*((com::sun::star::uno::Exception *)pData)} (EXCEPTION) - {*((uno_Sequence **)pData)} (SEQUENCE) - {*((com::sun::star::uno::BaseReference *)pData)} (INTERFACE) - {pType->eTypeClass,en} - - (com::sun::star::uno::Exception *)pData - *(uno_Sequence **)pData - (com::sun::star::uno::BaseReference *)pData - pData + {*((sal_Unicode*)pData),c} ({*pType->pTypeName,sub}) + {*((bool*)pData),d} ({*pType->pTypeName,sub}) + {*((sal_Int8*)pData),d} ({*pType->pTypeName,sub}) + {*((sal_Int16*)pData),d} ({*pType->pTypeName,sub}) + {*((sal_uInt16*)pData),d} ({*pType->pTypeName,sub}) + {*((sal_Int32*)pData),d} ({*pType->pTypeName,sub}) + {*((sal_uInt32*)pData),d} ({*pType->pTypeName,sub}) + {*((sal_Int64*)pData),d} ({*pType->pTypeName,sub}) + {*((sal_uInt64*)pData),d} ({*pType->pTypeName,sub}) + {*((float*)pData)} ({*pType->pTypeName,sub}) + {*((double*)pData)} ({*pType->pTypeName,sub}) + {*((rtl::OUString*)pData)} ({*pType->pTypeName,sub}) + {*((com::sun::star::uno::Type*)pData)} ({*pType->pTypeName,sub}) + {*((_uno_Any*)pData)} ({*pType->pTypeName,sub}) + {*((sal_Int32*)pData),d} ({*pType->pTypeName,sub}) + {*((com::sun::star::uno::Exception*)pData)} ({*pType->pTypeName,sub}) + {**((uno_Sequence**)pData)} ({*pType->pTypeName,sub}) + {*(com::sun::star::uno::BaseReference*)pData} ({*pType->pTypeName,sub}) + {*((com::sun::star::uno::BaseReference*)pData)->_pInterface} ({*pType->pTypeName,sub}) + {pType->eTypeClass,en} ({*pType->pTypeName,sub}) + + pType + + (sal_Unicode*)pData + (bool*)pData + (sal_Int8*)pData + (sal_Int16*)pData + (sal_uInt16*)pData + (sal_Int32*)pData + (sal_uInt32*)pData + (sal_Int64*)pData + (sal_uInt64*)pData + (float*)pData + (double*)pData + (rtl::OUString*)pData + (com::sun::star::uno::Type*)pData + (_uno_Any*)pData + (sal_Int32*)pData + (com::sun::star::uno::Exception*)pData + (uno_Sequence**)pData + (com::sun::star::uno::BaseReference*)pData + pData + + pReserved @@ -490,13 +510,22 @@ (SwLayoutFrame&)(*this) + + {{Follow {m_rThis,view(min)nd}}} + {{{m_rThis,view(min)nd}}} + - {{Follow {(SwFrame&)*this,view(min)}}} - {(SwFrame&)*this} + {(SwFlowFrame&)*this} (SwLayoutFrame&)(*this) + + {(SwFlowFrame&)*this} + + (SwFrame&)(*this) + + Optional not set {*reinterpret_cast<$T1 *>(m_storage.dummy_.data)} diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 485142240871..e1822b52088f 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1551,7 +1551,7 @@ namespace svgio::svgreader if(readSvgStringVector(aContent, aSvgStringVector, ',')) { - maFontFamily = aSvgStringVector; + maFontFamily = std::move(aSvgStringVector); } break; } diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx index e5e53e18d0b7..2ff149592fd0 100644 --- a/svl/source/items/cenumitm.cxx +++ b/svl/source/items/cenumitm.cxx @@ -83,83 +83,14 @@ bool SfxEnumItemInterface::GetBoolValue() const void SfxEnumItemInterface::SetBoolValue(bool) {} -typedef std::unordered_map> SfxBoolItemMap; - -namespace +bool SfxBoolItem::isHashable() const { - class SfxBoolItemInstanceManager : public ItemInstanceManager - { - SfxBoolItemMap maRegistered; - - public: - SfxBoolItemInstanceManager() - : ItemInstanceManager(typeid(SfxBoolItem).hash_code()) - { - } - - private: - // standard interface, accessed exclusively - // by implCreateItemEntry/implCleanupItemEntry - virtual const SfxPoolItem* find(const SfxPoolItem&) const override; - virtual void add(const SfxPoolItem&) override; - virtual void remove(const SfxPoolItem&) override; - }; - - const SfxPoolItem* SfxBoolItemInstanceManager::find(const SfxPoolItem& rItem) const - { - SfxBoolItemMap::const_iterator aHit(maRegistered.find(rItem.Which())); - if (aHit == maRegistered.end()) - return nullptr; - - const SfxBoolItem& rSfxBoolItem(static_cast(rItem)); - if (rSfxBoolItem.GetValue()) - return aHit->second.first; - return aHit->second.second; - } - - void SfxBoolItemInstanceManager::add(const SfxPoolItem& rItem) - { - SfxBoolItemMap::iterator aHit(maRegistered.find(rItem.Which())); - const SfxBoolItem& rSfxBoolItem(static_cast(rItem)); - - if (aHit == maRegistered.end()) - { - if (rSfxBoolItem.GetValue()) - maRegistered.insert({rItem.Which(), std::make_pair(&rItem, nullptr)}); - else - maRegistered.insert({rItem.Which(), std::make_pair(nullptr, &rItem)}); - } - else - { - if (rSfxBoolItem.GetValue()) - aHit->second.first = &rItem; - else - aHit->second.second = &rItem; - } - } - - void SfxBoolItemInstanceManager::remove(const SfxPoolItem& rItem) - { - SfxBoolItemMap::iterator aHit(maRegistered.find(rItem.Which())); - const SfxBoolItem& rSfxBoolItem(static_cast(rItem)); - - if (aHit != maRegistered.end()) - { - if (rSfxBoolItem.GetValue()) - aHit->second.first = nullptr; - else - aHit->second.second = nullptr; - - if (aHit->second.first == nullptr && aHit->second.second == nullptr) - maRegistered.erase(aHit); - } - } + return true; } -ItemInstanceManager* SfxBoolItem::getItemInstanceManager() const +size_t SfxBoolItem::hashCode() const { - static SfxBoolItemInstanceManager aInstanceManager; - return &aInstanceManager; + return size_t(GetValue()); } void SfxBoolItem::SetValue(bool const bTheValue) diff --git a/svl/source/items/custritm.cxx b/svl/source/items/custritm.cxx index 0d68b6d4559f..4cd125f1b37f 100644 --- a/svl/source/items/custritm.cxx +++ b/svl/source/items/custritm.cxx @@ -23,6 +23,11 @@ #include #include +// not all of the subclasses are hashable, so we only define the shared hashcode function here +size_t CntUnencodedStringItem::hashCode() const +{ + return m_aValue.hashCode(); +} // virtual bool CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const @@ -53,6 +58,7 @@ bool CntUnencodedStringItem::QueryValue(css::uno::Any& rVal, sal_uInt8) const bool CntUnencodedStringItem::PutValue(const css::uno::Any& rVal, sal_uInt8) { + ASSERT_CHANGE_REFCOUNTED_ITEM; OUString aTheValue; if (rVal >>= aTheValue) { diff --git a/svl/source/items/globalnameitem.cxx b/svl/source/items/globalnameitem.cxx index 6cd1ece098ee..311b5f4389fc 100644 --- a/svl/source/items/globalnameitem.cxx +++ b/svl/source/items/globalnameitem.cxx @@ -26,6 +26,7 @@ #include #include +#include SfxPoolItem* SfxGlobalNameItem::CreateDefault() { return new SfxGlobalNameItem; } @@ -46,6 +47,20 @@ SfxGlobalNameItem::~SfxGlobalNameItem() { } +bool SfxGlobalNameItem::isHashable() const +{ + return true; +} + +size_t SfxGlobalNameItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_aName.GetCLSID().Data1); + o3tl::hash_combine(seed, m_aName.GetCLSID().Data2); + o3tl::hash_combine(seed, m_aName.GetCLSID().Data3); + return seed; +} + bool SfxGlobalNameItem::operator==( const SfxPoolItem& rItem ) const { return SfxPoolItem::operator==(rItem) && @@ -60,6 +75,7 @@ SfxGlobalNameItem* SfxGlobalNameItem::Clone(SfxItemPool *) const // virtual bool SfxGlobalNameItem::PutValue( const css::uno::Any& rVal, sal_uInt8 ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; css::uno::Reference < css::script::XTypeConverter > xConverter ( css::script::Converter::create( ::comphelper::getProcessComponentContext() )); css::uno::Sequence< sal_Int8 > aSeq; diff --git a/svl/source/items/globalpool.cxx b/svl/source/items/globalpool.cxx index 66bc650a2791..d2de3b40bc16 100644 --- a/svl/source/items/globalpool.cxx +++ b/svl/source/items/globalpool.cxx @@ -19,12 +19,15 @@ #include #include +#include #include #include +#include +#include +#include +#include -static bool g_bDisableItemInstanceManager(getenv("SVL_DISABLE_ITEM_INSTANCE_MANAGER")); -static bool g_bShareImmediately(getenv("SVL_SHARE_ITEMS_GLOBALLY_INSTANTLY")); -#define NUMBER_OF_UNSHARED_INSTANCES (50) +// Classes that implement global SfxPoolItem sharing. #ifdef DBG_UTIL @@ -77,173 +80,118 @@ void listSfxPoolItemsWithHighestUsage(sal_uInt16 nNum) #endif -void DefaultItemInstanceManager::add(const SfxPoolItem& rItem) +namespace { - maRegistered[rItem.Which()].insert(&rItem); -} - -void DefaultItemInstanceManager::remove(const SfxPoolItem& rItem) +// basic Interface definition +struct ItemInstanceManager { - maRegistered[rItem.Which()].erase(&rItem); -} + virtual ~ItemInstanceManager() {} + // standard interface, accessed exclusively + // by implCreateItemEntry/implCleanupItemEntry + virtual const SfxPoolItem* find(const SfxPoolItem&) const = 0; + virtual bool add(const SfxPoolItem&) = 0; + virtual void remove(const SfxPoolItem&) = 0; +}; -// Class that implements global Item sharing. It uses rtti to -// associate every Item-derivation with a possible incarnation -// of a DefaultItemInstanceManager. This is the default, it will -// give direct implementations at the Items that overload -// getItemInstanceManager() preference. These are expected to -// return static instances of a derived implementation of a -// ItemInstanceManager. -// All in all there are now the following possibilities to support -// this for individual Item derivations: -// (1) Do nothing: -// In that case, if the Item is shareable, the new mechanism -// will kick in: It will start sharing the Item globally, -// but not immediately: After a defined amount of allowed -// non-shared occurrences (look for NUMBER_OF_UNSHARED_INSTANCES) -// an instance of the default ItemInstanceManager, a -// DefaultItemInstanceManager, will be incarnated and used. -// NOTE: Mixing shared/unshared instances is not a problem (we -// might even implement a kind of 're-hash' when this kicks in, -// but is not really needed). -// (2) Overload getItemInstanceManager for SfxPoolItem in a class -// derived from SfxPoolItem and... -// (2a) Return a static incarnation of DefaultItemInstanceManager to -// immediately start global sharing of that Item derivation. -// (2b) Implement and return your own implementation and static -// incarnation of ItemInstanceManager to do something better/ -// faster that the default implementation can do. Example: -// SvxFontItem, uses hashing now. -// There are two supported ENVVARs to use: -// (a) SVL_DISABLE_ITEM_INSTANCE_MANAGER: -// This disables the mechanism of global Item sharing completely. -// This can be used to test/check speed/memory needs compared with -// using it, but also may come in handy to check if evtl. errors/ -// regressions have to do with it. -// (b) SVL_SHARE_ITEMS_GLOBALLY_INSTANTLY: -// This internally forces the NUMBER_OF_UNSHARED_INSTANCES to be -// ignored and start sharing ALL Item derivations instantly. -class InstanceManagerHelper +// offering a default implementation that can be use for +// each SfxPoolItem (except when !isShareable()). It just +// uses an unordered_set holding ptrs to SfxPoolItems added +// and SfxPoolItem::operator== to linearly search for one. +// Thus this is not the fastest, but as fast as old 'poooled' +// stuff - better use an intelligent, pro-Item implementation +// that does e.g. hashing or whatever might be feasible for +// that specific Item (see other derivations) +struct DefaultItemInstanceManager : public ItemInstanceManager { - typedef std::unordered_map> - managerTypeMap; - managerTypeMap maManagerPerType; + // This workload is very read-heavy, and we want to scan the candidates often, so + // a vector-based data structure is faster. + o3tl::sorted_vector maRegistered; -public: - InstanceManagerHelper() {} - ~InstanceManagerHelper() + virtual const SfxPoolItem* find(const SfxPoolItem& rItem) const override { - for (auto& rCandidate : maManagerPerType) - if (nullptr != rCandidate.second.second) - delete rCandidate.second.second; - } - - ItemInstanceManager* getOrCreateItemInstanceManager(const SfxPoolItem& rItem) - { - // deactivated? - if (g_bDisableItemInstanceManager) - return nullptr; - - // Item cannot be shared? - if (!rItem.isShareable()) - return nullptr; - - // Prefer getting an ItemInstanceManager directly from - // the Item: These are the extra implemented (and thus - // hopefully fastest) incarnations - ItemInstanceManager* pManager(rItem.getItemInstanceManager()); - - // Check for correct hash, there may be derivations of that class. - // Note that Managers from the Items are *not* added to local list, - // they are expected to be static instances at the Items - const std::size_t aHash(typeid(rItem).hash_code()); - if (nullptr != pManager && pManager->getClassHash() == aHash) - return pManager; - - // check local memory for existing entry - managerTypeMap::iterator aHit(maManagerPerType.find(aHash)); - - // no instance yet - if (aHit == maManagerPerType.end()) - { - // create a default one to start usage-counting - if (g_bShareImmediately) - { - // create, insert locally and immediately start sharing - DefaultItemInstanceManager* pNew(new DefaultItemInstanceManager(aHash)); - maManagerPerType.insert({ aHash, std::make_pair(0, pNew) }); - return pNew; - } - - // start countdown from NUMBER_OF_UNSHARED_INSTANCES until zero is reached - maManagerPerType.insert( - { aHash, std::make_pair(NUMBER_OF_UNSHARED_INSTANCES, nullptr) }); - return nullptr; - } - - // if there is already an ItemInstanceManager incarnated, return it - if (nullptr != aHit->second.second) - return aHit->second.second; - - if (aHit->second.first > 0) - { - // still not the needed number of hits, countdown & return nullptr - aHit->second.first--; - return nullptr; - } - - // here the countdown is zero and there is not yet a ItemInstanceManager - // incarnated. Do so, register and return it - assert(nullptr == aHit->second.second); - DefaultItemInstanceManager* pNew(new DefaultItemInstanceManager(aHash)); - aHit->second.second = pNew; - - return pNew; - } - - ItemInstanceManager* getExistingItemInstanceManager(const SfxPoolItem& rItem) - { - // deactivated? - if (g_bDisableItemInstanceManager) - return nullptr; - - // Item cannot be shared? - if (!rItem.isShareable()) - return nullptr; - - // Prefer getting an ItemInstanceManager directly from - // the Item: These are the extra implemented (and thus - // hopefully fastest) incarnations - ItemInstanceManager* pManager(rItem.getItemInstanceManager()); - - // Check for correct hash, there may be derivations of that class. - // Note that Managers from the Items are *not* added to local list, - // they are expected to be static instances at the Items - const std::size_t aHash(typeid(rItem).hash_code()); - if (nullptr != pManager && pManager->getClassHash() == aHash) - return pManager; - - // check local memory for existing entry - managerTypeMap::iterator aHit(maManagerPerType.find(aHash)); - - if (aHit == maManagerPerType.end()) - // no instance yet, return nullptr - return nullptr; - - // if there is already a ItemInstanceManager incarnated, return it - if (nullptr != aHit->second.second) - return aHit->second.second; - - // count-up needed number of hits again if item is released - if (aHit->second.first < NUMBER_OF_UNSHARED_INSTANCES) - aHit->second.first++; - + for (const auto& rCandidate : maRegistered) + if (*rCandidate == rItem) + return rCandidate; return nullptr; } + virtual bool add(const SfxPoolItem& rItem) override + { + return maRegistered.insert(&rItem).second; + } + virtual void remove(const SfxPoolItem& rItem) override + { + bool bSuccess = maRegistered.erase(&rItem); + assert(bSuccess && "removing item but it is already gone"); + (void)bSuccess; + } }; -// the single static instance that takes over that global Item sharing -static InstanceManagerHelper aInstanceManagerHelper; +struct HashableItemInstanceManager : public ItemInstanceManager +{ + struct ItemHash + { + size_t operator()(const SfxPoolItem* pItem) const { return pItem->hashCode(); } + }; + struct ItemEqual + { + bool operator()(const SfxPoolItem* lhs, const SfxPoolItem* rhs) const + { + return *lhs == *rhs; + } + }; + std::unordered_set maRegistered; + + virtual const SfxPoolItem* find(const SfxPoolItem& rItem) const override + { + auto it = maRegistered.find(&rItem); + if (it == maRegistered.end()) + return nullptr; + return *it; + } + virtual bool add(const SfxPoolItem& rItem) override + { + return maRegistered.insert(&rItem).second; + } + virtual void remove(const SfxPoolItem& rItem) override + { + auto it = maRegistered.find(&rItem); + if (it != maRegistered.end()) + { + if (&rItem != *it) + { + SAL_WARN("svl", "erasing wrong object, hash/operator== methods likely bad " + << typeid(rItem).name()); + assert(false && "erasing wrong object, hash/operator== methods likely bad"); + } + maRegistered.erase(it); + } + else + { + SAL_WARN("svl", + "removing item but its already gone, hash/operator== methods likely bad " + << typeid(rItem).name()); + assert(false + && "removing item but its already gone, hash/operator== methods likely bad"); + } + } +}; + +struct PairHash +{ + size_t operator()(const std::pair& rKey) const + { + return (static_cast(rKey.first) << 16) | rKey.second; + } +}; +} +// The single static instance that takes over that global Item sharing +// Maps SfxItemPool sub-classes to a set of shared items. +// +// Noting that the WhichId is part of the key, to simply the implementation of the hashCode() overrides +// in SfxPoolItem sub-classes. +static std::unordered_map, std::unique_ptr, + PairHash> + gInstanceManagerMap; SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, SfxPoolItem const* pSource, bool bPassingOwnership) @@ -326,30 +274,38 @@ SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, SfxPoolItem const* pS return pSource; } - // try to get an ItemInstanceManager for global Item instance sharing - ItemInstanceManager* pManager(aInstanceManagerHelper.getOrCreateItemInstanceManager(*pSource)); - - // check if we can globally share the Item using an ItemInstanceManager - while (nullptr != pManager) + // Item cannot be shared? + SfxItemType nSourceItemType(pSource->ItemType()); + if (pSource->isShareable()) { - const SfxPoolItem* pAlternative(pManager->find(*pSource)); - if (nullptr == pAlternative) - // no already globally shared one found, done - break; + // check if we can globally share the Item using the ItemInstanceManager + auto itemsetIt = gInstanceManagerMap.find({ nSourceItemType, pSource->Which() }); + if (itemsetIt != gInstanceManagerMap.end()) + { + ItemInstanceManager& rItemManager = *(itemsetIt->second); + const SfxPoolItem* pAlternative = rItemManager.find(*pSource); + if (pAlternative) + { + SAL_WARN_IF(typeid(*pAlternative) != typeid(*pSource), "svl", + "wrong item from pool, expected " << typeid(*pSource).name() + << " but got " + << typeid(*pAlternative).name()); + assert(typeid(*pAlternative) == typeid(*pSource) && "wrong item from pool"); + // Here we do *not* need to check if it is an SfxSetItem + // and cannot be shared if they are in/use another pool: + // The SfxItemSet::operator== will check for SfxItemPools + // being equal, thus when found in global share the Pool + // cannot be equal - // Here we do *not* need to check if it is an SfxSetItem - // and cannot be shared if they are in/use another pool: - // The SfxItemSet::operator== will check for SfxItemPools - // being equal, thus when found in global share the Pool - // cannot be equal + // need to delete evtl. handed over ownership change Item + if (bPassingOwnership) + delete pSource; - // need to delete evtl. handed over ownership change Item - if (bPassingOwnership) - delete pSource; - - // If we get here we can share the Item - pAlternative->AddRef(); - return pAlternative; + // If we get here we can share the Item + pAlternative->AddRef(); + return pAlternative; + } + } } // check if the handed over and to be directly used item is a @@ -376,10 +332,15 @@ SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, SfxPoolItem const* pS // bPassingOwnership is given just use the item, else clone it if (!bPassingOwnership) { + auto pPreviousSource = pSource; pSource = pSource->Clone(pMasterPool); #ifdef DBG_UTIL assert(pSource->Which() == nWhich && "ITEM: Clone of Item did NOT copy/set WhichID (!)"); #endif + SAL_WARN_IF(typeid(*pPreviousSource) != typeid(*pSource), "svl", + "wrong item from Clone(), expected " << typeid(*pPreviousSource).name() + << " but got " << typeid(*pSource).name()); + assert(typeid(*pPreviousSource) == typeid(*pSource) && "wrong item from Clone()"); } // increase RefCnt 0->1 @@ -387,8 +348,30 @@ SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, SfxPoolItem const* pS // check if we should register this Item for the global // ItemInstanceManager mechanism (only for shareable Items) - if (nullptr != pManager) - pManager->add(*pSource); + if (pSource->isShareable()) + { + ItemInstanceManager* pManager; + std::pair aManagerKey{ nSourceItemType, pSource->Which() }; + auto it1 = gInstanceManagerMap.find(aManagerKey); + if (it1 != gInstanceManagerMap.end()) + pManager = it1->second.get(); + else + { + if (pSource->isHashable()) + gInstanceManagerMap.insert( + { aManagerKey, std::make_unique() }); + else + gInstanceManagerMap.insert( + { aManagerKey, std::make_unique() }); + it1 = gInstanceManagerMap.find(aManagerKey); + assert(it1 != gInstanceManagerMap.end()); + pManager = it1->second.get(); + } + + bool bSuccess = pManager->add(*pSource); + assert(bSuccess && "failed to add item to pool"); + (void)bSuccess; + } return pSource; } @@ -434,13 +417,14 @@ void implCleanupItemEntry(const SfxPoolItem* pSource) return; } - // try to get an ItemInstanceManager for global Item instance sharing - ItemInstanceManager* pManager(aInstanceManagerHelper.getExistingItemInstanceManager(*pSource)); - // check if we should/can remove this Item from the global // ItemInstanceManager mechanism - if (nullptr != pManager) - pManager->remove(*pSource); + auto itemsetIt = gInstanceManagerMap.find({ pSource->ItemType(), pSource->Which() }); + if (itemsetIt != gInstanceManagerMap.end()) + { + auto& rInstanceManager = *(itemsetIt->second); + rInstanceManager.remove(*pSource); + } // decrease RefCnt before deleting (destructor asserts for it and that's // good to find other errors) diff --git a/svl/source/items/grabbagitem.cxx b/svl/source/items/grabbagitem.cxx index 89c0c0336903..d16dc097296a 100644 --- a/svl/source/items/grabbagitem.cxx +++ b/svl/source/items/grabbagitem.cxx @@ -13,6 +13,8 @@ #include #include #include +#include +#include using namespace com::sun::star; @@ -28,6 +30,20 @@ SfxGrabBagItem::SfxGrabBagItem(sal_uInt16 nWhich) SfxGrabBagItem::~SfxGrabBagItem() = default; +bool SfxGrabBagItem::isHashable() const { return true; } + +size_t SfxGrabBagItem::hashCode() const +{ + std::size_t seed = 0; + for (const auto& pair : m_aMap) + { + o3tl::hash_combine(seed, pair.first); + if (auto oVal = comphelper::anyToHash(pair.second)) + o3tl::hash_combine(seed, *oVal); + } + return seed; +} + bool SfxGrabBagItem::operator==(const SfxPoolItem& rItem) const { return SfxPoolItem::operator==(rItem) @@ -41,6 +57,7 @@ SfxGrabBagItem* SfxGrabBagItem::Clone(SfxItemPool* /*pPool*/) const bool SfxGrabBagItem::PutValue(const uno::Any& rVal, sal_uInt8 /*nMemberId*/) { + ASSERT_CHANGE_REFCOUNTED_ITEM; uno::Sequence aValue; if (rVal >>= aValue) { diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx index adbc324c46ee..90a9c3686d80 100644 --- a/svl/source/items/ilstitem.cxx +++ b/svl/source/items/ilstitem.cxx @@ -23,6 +23,7 @@ #include #include +#include SfxPoolItem* SfxIntegerListItem::CreateDefault() { return new SfxIntegerListItem; } @@ -48,6 +49,19 @@ SfxIntegerListItem::~SfxIntegerListItem() { } +bool SfxIntegerListItem::isHashable() const +{ + return true; +} + +size_t SfxIntegerListItem::hashCode() const +{ + std::size_t seed = 0; + for (auto const & i : m_aList) + o3tl::hash_combine(seed, i); + return seed; +} + bool SfxIntegerListItem::operator==( const SfxPoolItem& rPoolItem ) const { if ( !SfxPoolItem::operator==(rPoolItem) ) @@ -64,6 +78,7 @@ SfxIntegerListItem* SfxIntegerListItem::Clone( SfxItemPool * ) const bool SfxIntegerListItem::PutValue ( const css::uno::Any& rVal, sal_uInt8 ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; css::uno::Reference < css::script::XTypeConverter > xConverter ( css::script::Converter::create(::comphelper::getProcessComponentContext()) ); css::uno::Any aNew; diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx index 7020054d6889..4b5ee5eccc32 100644 --- a/svl/source/items/imageitm.cxx +++ b/svl/source/items/imageitm.cxx @@ -20,6 +20,7 @@ #include #include +#include SfxPoolItem* SfxImageItem::CreateDefault() { return new SfxImageItem; } @@ -44,6 +45,20 @@ SfxImageItem* SfxImageItem::Clone( SfxItemPool* ) const return new SfxImageItem( *this ); } +bool SfxImageItem::isHashable() const +{ + return true; +} + +size_t SfxImageItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, GetValue()); + o3tl::hash_combine(seed, mnAngle.get()); + o3tl::hash_combine(seed, mbMirrored); + return seed; +} + bool SfxImageItem::operator==( const SfxPoolItem& rItem ) const { if (!SfxInt16Item::operator==(rItem)) @@ -64,6 +79,7 @@ bool SfxImageItem::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const bool SfxImageItem::PutValue( const css::uno::Any& rVal, sal_uInt8 ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; css::uno::Sequence< css::uno::Any > aSeq; if (( rVal >>= aSeq ) && ( aSeq.getLength() == 4 )) { diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index 709d7aa64a83..ebc2d08636a9 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -501,20 +501,14 @@ void listAllocatedSfxPoolItems() } #endif -const SfxPoolItem* DefaultItemInstanceManager::find(const SfxPoolItem& rItem) const +bool SfxPoolItem::isHashable() const { return false; } + +size_t SfxPoolItem::hashCode() const { - auto it = maRegistered.find(rItem.Which()); - if (it == maRegistered.end()) - return nullptr; - for (const auto& rCandidate : it->second) - if (*rCandidate == rItem) - return rCandidate; - - return nullptr; + assert(false && "not implemented"); + return 0; } -ItemInstanceManager* SfxPoolItem::getItemInstanceManager() const { return nullptr; } - SfxPoolItem::SfxPoolItem(sal_uInt16 const nWhich, SfxItemType eType) : m_nRefCount(0) , m_nWhich(nWhich) diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx index 71ac1205b682..120786b4b047 100644 --- a/svl/source/items/ptitem.cxx +++ b/svl/source/items/ptitem.cxx @@ -27,6 +27,7 @@ #include #include +#include using namespace ::com::sun::star; @@ -61,6 +62,19 @@ bool SfxPointItem::GetPresentation } +bool SfxPointItem::isHashable() const +{ + return true; +} + +size_t SfxPointItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, aVal.X()); + o3tl::hash_combine(seed, aVal.Y()); + return seed; +} + bool SfxPointItem::operator==( const SfxPoolItem& rItem ) const { assert(SfxPoolItem::operator==(rItem)); @@ -98,6 +112,7 @@ bool SfxPointItem::QueryValue( uno::Any& rVal, bool SfxPointItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; bool bRet = false; diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx index cd9eecdf672a..c2c4774d7920 100644 --- a/svl/source/items/rectitem.cxx +++ b/svl/source/items/rectitem.cxx @@ -25,6 +25,7 @@ #include #include +#include SfxPoolItem* SfxRectangleItem::CreateDefault() { return new SfxRectangleItem; } @@ -60,6 +61,21 @@ bool SfxRectangleItem::GetPresentation } +bool SfxRectangleItem::isHashable() const +{ + return true; +} + +size_t SfxRectangleItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, maVal.Top()); + o3tl::hash_combine(seed, maVal.Left()); + o3tl::hash_combine(seed, maVal.Bottom()); + o3tl::hash_combine(seed, maVal.Right()); + return seed; +} + bool SfxRectangleItem::operator==( const SfxPoolItem& rItem ) const { assert(SfxPoolItem::operator==(rItem)); @@ -99,6 +115,7 @@ bool SfxRectangleItem::QueryValue( css::uno::Any& rVal, bool SfxRectangleItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bRet = false; nMemberId &= ~CONVERT_TWIPS; css::awt::Rectangle aValue; diff --git a/svx/inc/sdgcoitm.hxx b/svx/inc/sdgcoitm.hxx index d49bad207275..570fbd46b8d8 100644 --- a/svx/inc/sdgcoitm.hxx +++ b/svx/inc/sdgcoitm.hxx @@ -32,8 +32,7 @@ class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SdrGrafRedItem final : public SdrSigne { public: - - SdrGrafRedItem( short nRedPercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFRED, nRedPercent ) {} + SdrGrafRedItem( short nRedPercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFRED, nRedPercent, SfxItemType::SdrGrafRedItemType ) {} virtual SdrGrafRedItem* Clone( SfxItemPool* pPool = nullptr ) const override; }; @@ -46,8 +45,7 @@ class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SdrGrafGreenItem final : public SdrSig { public: - - SdrGrafGreenItem( short nGreenPercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFGREEN, nGreenPercent ) {} + SdrGrafGreenItem( short nGreenPercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFGREEN, nGreenPercent, SfxItemType::SdrGrafGreenItemType ) {} virtual SdrGrafGreenItem* Clone( SfxItemPool* pPool = nullptr ) const override; }; @@ -60,8 +58,7 @@ class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SdrGrafBlueItem final : public SdrSign { public: - - SdrGrafBlueItem( short nBluePercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFBLUE, nBluePercent ) {} + SdrGrafBlueItem( short nBluePercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFBLUE, nBluePercent, SfxItemType::SdrGrafBlueItemType ) {} virtual SdrGrafBlueItem* Clone( SfxItemPool* pPool = nullptr ) const override; }; diff --git a/svx/inc/sdginitm.hxx b/svx/inc/sdginitm.hxx index 35cfa3da7865..1f26cb1e4eb0 100644 --- a/svx/inc/sdginitm.hxx +++ b/svx/inc/sdginitm.hxx @@ -30,8 +30,7 @@ class SdrGrafInvertItem final : public SdrOnOffItem { public: - - SdrGrafInvertItem( bool bInvert = false ) : SdrOnOffItem( SDRATTR_GRAFINVERT, bInvert ) {} + SdrGrafInvertItem( bool bInvert = false ) : SdrOnOffItem( SDRATTR_GRAFINVERT, bInvert, SfxItemType::SdrGrafInvertItemType ) {} virtual SdrGrafInvertItem* Clone( SfxItemPool* pPool = nullptr ) const override; }; diff --git a/svx/inc/sdgtritm.hxx b/svx/inc/sdgtritm.hxx index 084ac694493d..0511826bc6ef 100644 --- a/svx/inc/sdgtritm.hxx +++ b/svx/inc/sdgtritm.hxx @@ -32,7 +32,8 @@ class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SdrGrafTransparenceItem final : public { public: - SdrGrafTransparenceItem( sal_uInt16 nTransparencePercent = 0 ) : SdrPercentItem( SDRATTR_GRAFTRANSPARENCE, nTransparencePercent ) {} + SdrGrafTransparenceItem( sal_uInt16 nTransparencePercent = 0 ) + : SdrPercentItem( SDRATTR_GRAFTRANSPARENCE, nTransparencePercent, SfxItemType::SdrGrafTransparenceItemType ) {} virtual SdrGrafTransparenceItem* Clone( SfxItemPool* pPool = nullptr ) const override; }; diff --git a/svx/inc/sxallitm.hxx b/svx/inc/sxallitm.hxx index 144d3bae2b07..0afcd1802a8c 100644 --- a/svx/inc/sxallitm.hxx +++ b/svx/inc/sxallitm.hxx @@ -24,7 +24,7 @@ class SdrAllPositionXItem final : public SdrMetricItem { public: - SdrAllPositionXItem(tools::Long nPosX=0): SdrMetricItem(SDRATTR_ALLPOSITIONX,nPosX) {} + SdrAllPositionXItem(tools::Long nPosX=0): SdrMetricItem(SDRATTR_ALLPOSITIONX, nPosX, SfxItemType::SdrAllPositionXItemType) {} virtual SdrAllPositionXItem* Clone(SfxItemPool*) const override { return new SdrAllPositionXItem(*this); @@ -33,7 +33,7 @@ public: class SdrAllPositionYItem final : public SdrMetricItem { public: - SdrAllPositionYItem(tools::Long nPosY=0): SdrMetricItem(SDRATTR_ALLPOSITIONY,nPosY) {} + SdrAllPositionYItem(tools::Long nPosY=0): SdrMetricItem(SDRATTR_ALLPOSITIONY, nPosY, SfxItemType::SdrAllPositionYItemType) {} virtual SdrAllPositionYItem* Clone(SfxItemPool*) const override { return new SdrAllPositionYItem(*this); @@ -42,7 +42,7 @@ public: class SdrAllSizeWidthItem final : public SdrMetricItem { public: - SdrAllSizeWidthItem(tools::Long nWdt=0): SdrMetricItem(SDRATTR_ALLSIZEWIDTH,nWdt) {} + SdrAllSizeWidthItem(tools::Long nWdt=0): SdrMetricItem(SDRATTR_ALLSIZEWIDTH, nWdt, SfxItemType::SdrAllSizeWidthItemType) {} virtual SdrAllSizeWidthItem* Clone(SfxItemPool*) const override { return new SdrAllSizeWidthItem(*this); @@ -51,7 +51,7 @@ public: class SdrAllSizeHeightItem final : public SdrMetricItem { public: - SdrAllSizeHeightItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_ALLSIZEHEIGHT,nHgt) {} + SdrAllSizeHeightItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_ALLSIZEHEIGHT, nHgt, SfxItemType::SdrAllSizeHeightItemType) {} virtual SdrAllSizeHeightItem* Clone(SfxItemPool*) const override { return new SdrAllSizeHeightItem(*this); diff --git a/svx/inc/sxcaitm.hxx b/svx/inc/sxcaitm.hxx index 26d4a3194329..4aa6b44e910d 100644 --- a/svx/inc/sxcaitm.hxx +++ b/svx/inc/sxcaitm.hxx @@ -36,7 +36,7 @@ class SdrCaptionAngleItem final : public SdrAngleItem { public: SdrCaptionAngleItem(Degree100 nAngle = 0_deg100) - : SdrAngleItem(SDRATTR_CAPTIONANGLE, nAngle) + : SdrAngleItem(SDRATTR_CAPTIONANGLE, nAngle, SfxItemType::SdrCaptionAngleItemType) { } virtual SdrCaptionAngleItem* Clone(SfxItemPool*) const override diff --git a/svx/inc/sxlayitm.hxx b/svx/inc/sxlayitm.hxx index 5c8c42d21c50..e2d753ba9be6 100644 --- a/svx/inc/sxlayitm.hxx +++ b/svx/inc/sxlayitm.hxx @@ -36,8 +36,10 @@ class SdrLayerNameItem final : public SfxStringItem { public: SdrLayerNameItem() : SfxStringItem(SDRATTR_LAYERNAME, SfxItemType::SdrLayerNameItemType) {} - SdrLayerNameItem(const OUString& rStr) : SfxStringItem(SDRATTR_LAYERNAME,rStr) {} + SdrLayerNameItem(const OUString& rStr) + : SfxStringItem(SDRATTR_LAYERNAME, rStr, SfxItemType::SdrLayerNameItemType) {} virtual SdrLayerNameItem* Clone(SfxItemPool* pPool=nullptr) const override; + virtual bool isHashable() const override; // hashCode is defined in CntUnencodedStringItem }; #endif diff --git a/svx/inc/sxlogitm.hxx b/svx/inc/sxlogitm.hxx index 20d61724b303..5fe217b77c62 100644 --- a/svx/inc/sxlogitm.hxx +++ b/svx/inc/sxlogitm.hxx @@ -24,7 +24,7 @@ class SdrLogicSizeWidthItem final : public SdrMetricItem { public: - SdrLogicSizeWidthItem(tools::Long nWdt=0): SdrMetricItem(SDRATTR_LOGICSIZEWIDTH,nWdt) {} + SdrLogicSizeWidthItem(tools::Long nWdt=0): SdrMetricItem(SDRATTR_LOGICSIZEWIDTH, nWdt, SfxItemType::SdrLogicSizeWidthItemType) {} virtual SdrLogicSizeWidthItem* Clone(SfxItemPool*) const override { return new SdrLogicSizeWidthItem(*this); @@ -33,7 +33,7 @@ public: class SdrLogicSizeHeightItem final : public SdrMetricItem { public: - SdrLogicSizeHeightItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_LOGICSIZEHEIGHT,nHgt) {} + SdrLogicSizeHeightItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_LOGICSIZEHEIGHT, nHgt, SfxItemType::SdrLogicSizeHeightItemType) {} virtual SdrLogicSizeHeightItem* Clone(SfxItemPool*) const override { return new SdrLogicSizeHeightItem(*this); diff --git a/svx/inc/sxmfsitm.hxx b/svx/inc/sxmfsitm.hxx index f3d6f0facf9d..70b126cfa0fe 100644 --- a/svx/inc/sxmfsitm.hxx +++ b/svx/inc/sxmfsitm.hxx @@ -31,6 +31,10 @@ public: { return new SdrMeasureFormatStringItem(*this); } + virtual bool isHashable() const override // hashCode is defined in CntUnencodedStringItem + { + return true; + } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/sxmoitm.hxx b/svx/inc/sxmoitm.hxx index f207f7411794..c3f6d5a3dd97 100644 --- a/svx/inc/sxmoitm.hxx +++ b/svx/inc/sxmoitm.hxx @@ -28,7 +28,7 @@ class SdrMeasureOverhangItem final : public SdrMetricItem { public: SdrMeasureOverhangItem(tools::Long nVal) - : SdrMetricItem(SDRATTR_MEASUREOVERHANG, nVal) + : SdrMetricItem(SDRATTR_MEASUREOVERHANG, nVal, SfxItemType::SdrMeasureOverhangItemType) { } virtual SdrMeasureOverhangItem* Clone(SfxItemPool*) const override diff --git a/svx/inc/sxmovitm.hxx b/svx/inc/sxmovitm.hxx index eda423e27c87..4f8be6c545e0 100644 --- a/svx/inc/sxmovitm.hxx +++ b/svx/inc/sxmovitm.hxx @@ -24,7 +24,7 @@ class SdrMoveXItem final : public SdrMetricItem { public: - SdrMoveXItem(): SdrMetricItem(SDRATTR_MOVEX,0) {} + SdrMoveXItem(): SdrMetricItem(SDRATTR_MOVEX, 0, SfxItemType::SdrMoveXItemType) {} SdrMoveXItem* Clone(SfxItemPool*) const override { return new SdrMoveXItem(*this); @@ -33,7 +33,7 @@ public: class SdrMoveYItem final : public SdrMetricItem { public: - SdrMoveYItem(): SdrMetricItem(SDRATTR_MOVEY,0) {} + SdrMoveYItem(): SdrMetricItem(SDRATTR_MOVEY, 0, SfxItemType::SdrMoveYItemType) {} SdrMoveYItem* Clone(SfxItemPool*) const override { return new SdrMoveYItem(*this); diff --git a/svx/inc/sxoneitm.hxx b/svx/inc/sxoneitm.hxx index 424563008bfb..d395d14181f3 100644 --- a/svx/inc/sxoneitm.hxx +++ b/svx/inc/sxoneitm.hxx @@ -24,7 +24,7 @@ class SdrOnePositionXItem final : public SdrMetricItem { public: - SdrOnePositionXItem(tools::Long nPosX=0): SdrMetricItem(SDRATTR_ONEPOSITIONX,nPosX) {} + SdrOnePositionXItem(tools::Long nPosX=0): SdrMetricItem(SDRATTR_ONEPOSITIONX, nPosX, SfxItemType::SdrOnePositionXItemType) {} virtual SdrOnePositionXItem* Clone(SfxItemPool*) const override { return new SdrOnePositionXItem(*this); @@ -33,7 +33,7 @@ public: class SdrOnePositionYItem final : public SdrMetricItem { public: - SdrOnePositionYItem(tools::Long nPosY=0): SdrMetricItem(SDRATTR_ONEPOSITIONY,nPosY) {} + SdrOnePositionYItem(tools::Long nPosY=0): SdrMetricItem(SDRATTR_ONEPOSITIONY, nPosY, SfxItemType::SdrOnePositionYItemType) {} virtual SdrOnePositionYItem* Clone(SfxItemPool*) const override { return new SdrOnePositionYItem(*this); @@ -42,7 +42,7 @@ public: class SdrOneSizeWidthItem final : public SdrMetricItem { public: - SdrOneSizeWidthItem(tools::Long nWdt=0): SdrMetricItem(SDRATTR_ONESIZEWIDTH,nWdt) {} + SdrOneSizeWidthItem(tools::Long nWdt=0): SdrMetricItem(SDRATTR_ONESIZEWIDTH, nWdt, SfxItemType::SdrOneSizeWidthItemType) {} virtual SdrOneSizeWidthItem* Clone(SfxItemPool*) const override { return new SdrOneSizeWidthItem(*this); @@ -51,7 +51,7 @@ public: class SdrOneSizeHeightItem final : public SdrMetricItem { public: - SdrOneSizeHeightItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_ONESIZEHEIGHT,nHgt) {} + SdrOneSizeHeightItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_ONESIZEHEIGHT, nHgt, SfxItemType::SdrOneSizeHeightItemType) {} virtual SdrOneSizeHeightItem* Clone(SfxItemPool*) const override { return new SdrOneSizeHeightItem(*this); diff --git a/svx/inc/sxopitm.hxx b/svx/inc/sxopitm.hxx index cd7d2bb1f599..52389b7331c1 100644 --- a/svx/inc/sxopitm.hxx +++ b/svx/inc/sxopitm.hxx @@ -24,7 +24,8 @@ class SdrObjPrintableItem final : public SdrYesNoItem { public: - SdrObjPrintableItem(bool bOn=false): SdrYesNoItem(SDRATTR_OBJPRINTABLE,bOn) {} + SdrObjPrintableItem(bool bOn=false) + : SdrYesNoItem(SDRATTR_OBJPRINTABLE,bOn, SfxItemType::SdrObjPrintableItemType) {} virtual SdrObjPrintableItem* Clone(SfxItemPool*) const override { return new SdrObjPrintableItem(*this); @@ -33,7 +34,7 @@ public: class SdrObjVisibleItem final : public SdrYesNoItem { public: - SdrObjVisibleItem(bool bOn=true): SdrYesNoItem(SDRATTR_OBJVISIBLE,bOn) {} + SdrObjVisibleItem(bool bOn=true): SdrYesNoItem(SDRATTR_OBJVISIBLE,bOn, SfxItemType::SdrObjVisibleItemType) {} virtual SdrObjVisibleItem* Clone(SfxItemPool*) const override { return new SdrObjVisibleItem(*this); diff --git a/svx/inc/sxroaitm.hxx b/svx/inc/sxroaitm.hxx index 7f1aec1c54e5..02138710ba7c 100644 --- a/svx/inc/sxroaitm.hxx +++ b/svx/inc/sxroaitm.hxx @@ -26,7 +26,7 @@ class SdrRotateAllItem final : public SdrAngleItem { public: SdrRotateAllItem() - : SdrAngleItem(SDRATTR_ROTATEALL, 0_deg100) + : SdrAngleItem(SDRATTR_ROTATEALL, 0_deg100, SfxItemType::SdrRotateAllItemType) { } virtual SdrRotateAllItem* Clone(SfxItemPool*) const override diff --git a/svx/inc/sxrooitm.hxx b/svx/inc/sxrooitm.hxx index f14bcf77f153..a4ad37b2aaf3 100644 --- a/svx/inc/sxrooitm.hxx +++ b/svx/inc/sxrooitm.hxx @@ -24,7 +24,7 @@ class SdrRotateOneItem final : public SdrAngleItem { public: - SdrRotateOneItem(): SdrAngleItem(SDRATTR_ROTATEONE,0_deg100) {} + SdrRotateOneItem(): SdrAngleItem(SDRATTR_ROTATEONE, 0_deg100, SfxItemType::SdrRotateOneItemType) {} SdrRotateOneItem* Clone(SfxItemPool*) const override { return new SdrRotateOneItem(*this); diff --git a/svx/inc/sxsaitm.hxx b/svx/inc/sxsaitm.hxx index 190d66d7b653..f02397ed2ef9 100644 --- a/svx/inc/sxsaitm.hxx +++ b/svx/inc/sxsaitm.hxx @@ -26,7 +26,7 @@ class SdrShearAngleItem final : public SdrAngleItem { public: SdrShearAngleItem(Degree100 nAngle = 0_deg100) - : SdrAngleItem(SDRATTR_SHEARANGLE, nAngle) + : SdrAngleItem(SDRATTR_SHEARANGLE, nAngle, SfxItemType::SdrShearAngleItemType) { } virtual SdrShearAngleItem* Clone(SfxItemPool*) const override diff --git a/svx/inc/sxsalitm.hxx b/svx/inc/sxsalitm.hxx index 304396206ac0..0bf84bd08271 100644 --- a/svx/inc/sxsalitm.hxx +++ b/svx/inc/sxsalitm.hxx @@ -24,7 +24,7 @@ class SdrHorzShearAllItem final : public SdrAngleItem { public: - SdrHorzShearAllItem(): SdrAngleItem(SDRATTR_HORZSHEARALL,0_deg100) {} + SdrHorzShearAllItem(): SdrAngleItem(SDRATTR_HORZSHEARALL, 0_deg100, SfxItemType::SdrHorzShearAllItemType) {} virtual SdrHorzShearAllItem* Clone(SfxItemPool*) const override { return new SdrHorzShearAllItem(*this); @@ -33,7 +33,7 @@ public: class SdrVertShearAllItem final : public SdrAngleItem { public: - SdrVertShearAllItem(): SdrAngleItem(SDRATTR_VERTSHEARALL,0_deg100) {} + SdrVertShearAllItem(): SdrAngleItem(SDRATTR_VERTSHEARALL, 0_deg100, SfxItemType::SdrVertShearAllItemType) {} virtual SdrVertShearAllItem* Clone(SfxItemPool*) const override { return new SdrVertShearAllItem(*this); diff --git a/svx/inc/sxsoitm.hxx b/svx/inc/sxsoitm.hxx index ce5ce237e1ee..a6baf378161b 100644 --- a/svx/inc/sxsoitm.hxx +++ b/svx/inc/sxsoitm.hxx @@ -24,7 +24,7 @@ class SdrHorzShearOneItem final : public SdrAngleItem { public: - SdrHorzShearOneItem(): SdrAngleItem(SDRATTR_HORZSHEARONE,0_deg100) {} + SdrHorzShearOneItem(): SdrAngleItem(SDRATTR_HORZSHEARONE, 0_deg100, SfxItemType::SdrHorzShearOneItemType) {} SdrHorzShearOneItem* Clone(SfxItemPool*) const override { return new SdrHorzShearOneItem(*this); @@ -33,7 +33,7 @@ public: class SdrVertShearOneItem final : public SdrAngleItem { public: - SdrVertShearOneItem(): SdrAngleItem(SDRATTR_VERTSHEARONE,0_deg100) {} + SdrVertShearOneItem(): SdrAngleItem(SDRATTR_VERTSHEARONE, 0_deg100, SfxItemType::SdrVertShearOneItemType) {} SdrVertShearOneItem* Clone(SfxItemPool*) const override { return new SdrVertShearOneItem(*this); diff --git a/svx/inc/sxtraitm.hxx b/svx/inc/sxtraitm.hxx index 2a1fdec4ccca..fadfd67dca4b 100644 --- a/svx/inc/sxtraitm.hxx +++ b/svx/inc/sxtraitm.hxx @@ -24,7 +24,7 @@ class SdrTransformRef1XItem final : public SdrMetricItem { public: - SdrTransformRef1XItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF1X,nHgt) {} + SdrTransformRef1XItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF1X, nHgt, SfxItemType::SdrTransformRef1XItemType) {} virtual SdrTransformRef1XItem* Clone(SfxItemPool*) const override { return new SdrTransformRef1XItem(*this); @@ -33,7 +33,7 @@ public: class SdrTransformRef1YItem final : public SdrMetricItem { public: - SdrTransformRef1YItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF1Y,nHgt) {} + SdrTransformRef1YItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF1Y,nHgt, SfxItemType::SdrTransformRef1YItemType) {} virtual SdrTransformRef1YItem* Clone(SfxItemPool*) const override { return new SdrTransformRef1YItem(*this); @@ -42,7 +42,7 @@ public: class SdrTransformRef2XItem final : public SdrMetricItem { public: - SdrTransformRef2XItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF2X,nHgt) {} + SdrTransformRef2XItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF2X, nHgt, SfxItemType::SdrTransformRef2XItemType) {} virtual SdrTransformRef2XItem* Clone(SfxItemPool*) const override { return new SdrTransformRef2XItem(*this); @@ -51,7 +51,7 @@ public: class SdrTransformRef2YItem final : public SdrMetricItem { public: - SdrTransformRef2YItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF2Y,nHgt) {} + SdrTransformRef2YItem(tools::Long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF2Y, nHgt, SfxItemType::SdrTransformRef2YItemType) {} virtual SdrTransformRef2YItem* Clone(SfxItemPool*) const override { return new SdrTransformRef2YItem(*this); diff --git a/svx/inc/textchain.hxx b/svx/inc/textchain.hxx index 46192852f984..4ff7303ed1cf 100644 --- a/svx/inc/textchain.hxx +++ b/svx/inc/textchain.hxx @@ -46,24 +46,16 @@ class ImpChainLinkProperties protected: friend class TextChain; - ImpChainLinkProperties() - { - aNilChainingEvent = false; - aCursorEvent = CursorChainingEvent::NULL_EVENT; - aPreChainingSel = ESelection(); - aPostChainingSel = ESelection(); - aIsPartOfLastParaInNextLink = false; // XXX: Should come from file - aSwitchingToNextBox = false; - } + ImpChainLinkProperties() = default; private: // NOTE: Remember to set default value in constructor when adding field ESelection aPreChainingSel; ESelection aPostChainingSel; - CursorChainingEvent aCursorEvent; - bool aNilChainingEvent; - bool aIsPartOfLastParaInNextLink; - bool aSwitchingToNextBox; + CursorChainingEvent aCursorEvent = CursorChainingEvent::NULL_EVENT; + bool aNilChainingEvent = false; + bool aIsPartOfLastParaInNextLink = false; + bool aSwitchingToNextBox = false; }; class TextChain diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx index e65ec6528832..8dd5fa0be530 100644 --- a/svx/qa/unit/unodraw.cxx +++ b/svx/qa/unit/unodraw.cxx @@ -60,7 +60,7 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testWriterGraphicExport) // Export it as JPEG. uno::Reference xExportFilter - = drawing::GraphicExportFilter::create(mxComponentContext); + = drawing::GraphicExportFilter::create(m_xContext); // This resulted in a css::lang::IllegalArgumentException for a Writer // picture. xExportFilter->setSourceDocument(xShape); diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 59bae8338825..afb8a60717d7 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -12476,6 +12476,7 @@ SfxVoidItem RemoveHyperlink SID_REMOVE_HYPERLINK ] SfxVoidItem CopyHyperlinkLocation SID_COPY_HYPERLINK_LOCATION +(SfxInt32Item PositionX FN_PARAM_1, SfxInt32Item PositionY FN_PARAM_2) [ AutoUpdate = FALSE, FastCall = FALSE, diff --git a/svx/source/annotation/Annotation.cxx b/svx/source/annotation/Annotation.cxx index bc6cc45324e4..8dfddb57b100 100644 --- a/svx/source/annotation/Annotation.cxx +++ b/svx/source/annotation/Annotation.cxx @@ -44,8 +44,7 @@ OString lcl_LOKGetCommentPayload(CommentNotificationType nType, Annotation& rAnn aJsonWriter.put("dateTime", utl::toISO8601(rAnnotation.GetDateTime())); aJsonWriter.put("text", rAnnotation.GetText()); SdrPage const* pPage = rAnnotation.getPage(); - sal_Int64 nHash = sal::static_int_cast(reinterpret_cast(pPage)); - aJsonWriter.put("parthash", pPage ? OString::number(nHash) : OString()); + aJsonWriter.put("parthash", pPage ? OString::number(pPage->GetUniqueID()) : OString()); geometry::RealPoint2D const& rPoint = rAnnotation.GetPosition(); geometry::RealSize2D const& rSize = rAnnotation.GetSize(); tools::Rectangle aRectangle( @@ -144,12 +143,9 @@ Annotation::Annotation(const css::uno::Reference& r : cppu::PropertySetMixin(rxContext, IMPLEMENTS_PROPERTY_SET, uno::Sequence()) , mpPage(pPage) - , m_nId(nextID()) { } -sal_uInt32 Annotation::m_nLastId = 1; - SdrModel* Annotation::GetModel() const { return mpPage != nullptr ? &mpPage->getSdrModelFromSdrPage() : nullptr; diff --git a/svx/source/annotation/AnnotationObject.cxx b/svx/source/annotation/AnnotationObject.cxx index 35dc4807e1b8..d69f9be6e9fa 100644 --- a/svx/source/annotation/AnnotationObject.cxx +++ b/svx/source/annotation/AnnotationObject.cxx @@ -11,15 +11,13 @@ #include #include +#include + #include #include - #include #include #include -#include -#include - #include #include #include @@ -29,6 +27,9 @@ #include #include #include + +#include +#include #include #include #include @@ -92,13 +93,13 @@ Color getColorLight(sal_uInt16 aAuthorIndex) AnnotationObject::AnnotationObject(SdrModel& rSdrModel) : SdrRectObj(rSdrModel) { - setAsAnnotationObject(true); + setup(); } AnnotationObject::AnnotationObject(SdrModel& rSdrModel, AnnotationObject const& rSource) : SdrRectObj(rSdrModel, rSource) { - setAsAnnotationObject(true); + setup(); } AnnotationObject::AnnotationObject(SdrModel& rSdrModel, tools::Rectangle const& rRectangle, @@ -114,7 +115,15 @@ AnnotationObject::AnnotationObject(SdrModel& rSdrModel, tools::Rectangle const& rSdrModel.EnableUndo(bUndo); osl_atomic_decrement(&m_refCount); + setup(); +} + +void AnnotationObject::setup() +{ setAsAnnotationObject(true); + mbTextFrame = true; // need this so the frame can be adjusted to the text + bool bLOK = comphelper::LibreOfficeKit::isActive(); + SetVisible(getSdrModelFromSdrObject().IsPDFDocument() || !bLOK); } void AnnotationObject::ApplyAnnotationName() @@ -124,17 +133,18 @@ void AnnotationObject::ApplyAnnotationName() OUString sInitials(mpAnnotationData->mxAnnotation->getInitials()); if (sInitials.isEmpty()) sInitials = createInitials(mpAnnotationData->mxAnnotation->getAuthor()); - SetText(sInitials + " " + OUString::number(maViewData.nIndex)); + SetText(sInitials + u" "_ustr + OUString::number(maViewData.nIndex)); } else { - SetText(u"Empty"_ustr); + SetText(u"🗅"_ustr); } Color aColor(getColorLight(maViewData.nAuthorIndex)); - SetMergedItem(XFillStyleItem(drawing::FillStyle_SOLID)); - SetMergedItem(XFillColorItem(OUString(), aColor)); + SfxItemSet aItemSet = GetMergedItemSet(); + aItemSet.Put(XFillStyleItem(drawing::FillStyle_SOLID)); + aItemSet.Put(XFillColorItem(OUString(), aColor)); Color aBorderColor(aColor); if (aColor.IsDark()) @@ -142,20 +152,22 @@ void AnnotationObject::ApplyAnnotationName() else aBorderColor.DecreaseLuminance(32); - SetMergedItem(XLineStyleItem(drawing::LineStyle_SOLID)); - SetMergedItem(XLineColorItem(OUString(), aBorderColor)); - SetMergedItem(XLineWidthItem(o3tl::convert(0, o3tl::Length::pt, o3tl::Length::mm100))); + aItemSet.Put(XLineStyleItem(drawing::LineStyle_SOLID)); + aItemSet.Put(XLineColorItem(OUString(), aBorderColor)); + aItemSet.Put(XLineWidthItem(o3tl::convert(0, o3tl::Length::pt, o3tl::Length::mm100))); - SetMergedItem(SvxFontHeightItem(o3tl::convert(10, o3tl::Length::pt, o3tl::Length::mm100), 100, - EE_CHAR_FONTHEIGHT)); + aItemSet.Put(SvxFontHeightItem(o3tl::convert(10, o3tl::Length::pt, o3tl::Length::mm100), 100, + EE_CHAR_FONTHEIGHT)); - SetMergedItem(SvxColorItem(aColor.IsDark() ? COL_WHITE : COL_BLACK, EE_CHAR_COLOR)); + aItemSet.Put(SvxColorItem(aColor.IsDark() ? COL_WHITE : COL_BLACK, EE_CHAR_COLOR)); - SetMergedItem(SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_NONE)); + aItemSet.Put(SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_NONE)); - SetMergedItem(makeSdrTextWordWrapItem(false)); - SetMergedItem(makeSdrTextAutoGrowWidthItem(true)); - SetMergedItem(makeSdrTextAutoGrowHeightItem(true)); + aItemSet.Put(makeSdrTextWordWrapItem(false)); + aItemSet.Put(makeSdrTextAutoGrowWidthItem(true)); + aItemSet.Put(makeSdrTextAutoGrowHeightItem(true)); + + SetMergedItemSet(aItemSet); } AnnotationObject::~AnnotationObject() {} @@ -186,13 +198,13 @@ SdrObjKind AnnotationObject::GetObjIdentifier() const { return SdrObjKind::Annot OUString AnnotationObject::TakeObjNameSingul() const { - OUString sName(u"Annotation"_ustr); + OUString sOutName(u"Annotation"_ustr); OUString aName(GetName()); if (!aName.isEmpty()) - sName += " '" + aName + "'"; + sOutName += u" '"_ustr + aName + u"'"_ustr; - return sName; + return sOutName; } OUString AnnotationObject::TakeObjNamePlural() const { return u"Annotations"_ustr; } diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 4c68aa45ded2..8bbd3a2bd555 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -546,14 +546,14 @@ void EnhancedCustomShape2d::ApplyShapeAttributes( const SdrCustomShapeGeometryIt { // AdjustmentValues static constexpr OUStringLiteral sAdjustmentValues( u"AdjustmentValues" ); - const Any* pAny = const_cast(rGeometryItem).GetPropertyValueByName( sAdjustmentValues ); + const Any* pAny = rGeometryItem.GetPropertyValueByName( sAdjustmentValues ); if ( pAny ) *pAny >>= m_seqAdjustmentValues; // Coordsize static constexpr OUStringLiteral sViewBox( u"ViewBox" ); - const Any* pViewBox = const_cast(rGeometryItem).GetPropertyValueByName( sViewBox ); + const Any* pViewBox = rGeometryItem.GetPropertyValueByName( sViewBox ); css::awt::Rectangle aViewBox; if ( pViewBox && (*pViewBox >>= aViewBox ) ) { @@ -565,6 +565,7 @@ void EnhancedCustomShape2d::ApplyShapeAttributes( const SdrCustomShapeGeometryIt static constexpr OUString sPath( u"Path"_ustr ); static constexpr OUStringLiteral sCoordinates( u"Coordinates" ); static constexpr OUStringLiteral sGluePoints( u"GluePoints" ); + static constexpr OUStringLiteral sGluePointLeavingDirections( u"GluePointLeavingDirections" ); static constexpr OUStringLiteral sSegments( u"Segments" ); static constexpr OUStringLiteral sSubViewSize( u"SubViewSize" ); static constexpr OUStringLiteral sStretchX( u"StretchX" ); @@ -575,31 +576,35 @@ void EnhancedCustomShape2d::ApplyShapeAttributes( const SdrCustomShapeGeometryIt // Path/Coordinates - pAny = const_cast(rGeometryItem).GetPropertyValueByName( sPath, sCoordinates ); + pAny = rGeometryItem.GetPropertyValueByName( sPath, sCoordinates ); if ( pAny ) *pAny >>= m_seqCoordinates; // Path/GluePoints - pAny = const_cast(rGeometryItem).GetPropertyValueByName( sPath, sGluePoints ); + pAny = rGeometryItem.GetPropertyValueByName( sPath, sGluePoints ); if ( pAny ) *pAny >>= m_seqGluePoints; + // Path/GluePointLeavingDirections + pAny = rGeometryItem.GetPropertyValueByName(sPath, sGluePointLeavingDirections); + if (pAny) + *pAny >>= m_seqGluePointLeavingDirections; // Path/Segments - pAny = const_cast(rGeometryItem).GetPropertyValueByName( sPath, sSegments ); + pAny = rGeometryItem.GetPropertyValueByName( sPath, sSegments ); if ( pAny ) *pAny >>= m_seqSegments; // Path/SubViewSize - pAny = const_cast(rGeometryItem).GetPropertyValueByName( sPath, sSubViewSize ); + pAny = rGeometryItem.GetPropertyValueByName( sPath, sSubViewSize ); if ( pAny ) *pAny >>= m_seqSubViewSize; // Path/StretchX - pAny = const_cast(rGeometryItem).GetPropertyValueByName( sPath, sStretchX ); + pAny = rGeometryItem.GetPropertyValueByName( sPath, sStretchX ); if ( pAny ) { sal_Int32 nStretchX = 0; @@ -609,7 +614,7 @@ void EnhancedCustomShape2d::ApplyShapeAttributes( const SdrCustomShapeGeometryIt // Path/StretchY - pAny = const_cast(rGeometryItem).GetPropertyValueByName( sPath, sStretchY ); + pAny = rGeometryItem.GetPropertyValueByName( sPath, sStretchY ); if ( pAny ) { sal_Int32 nStretchY = 0; @@ -619,19 +624,19 @@ void EnhancedCustomShape2d::ApplyShapeAttributes( const SdrCustomShapeGeometryIt // Path/TextFrames - pAny = const_cast(rGeometryItem).GetPropertyValueByName( sPath, sTextFrames ); + pAny = rGeometryItem.GetPropertyValueByName( sPath, sTextFrames ); if ( pAny ) *pAny >>= m_seqTextFrames; // Equations - pAny = const_cast(rGeometryItem).GetPropertyValueByName( sEquations ); + pAny = rGeometryItem.GetPropertyValueByName( sEquations ); if ( pAny ) *pAny >>= m_seqEquations; // Handles - pAny = const_cast(rGeometryItem).GetPropertyValueByName( sHandles ); + pAny = rGeometryItem.GetPropertyValueByName( sHandles ); if ( pAny ) *pAny >>= m_seqHandles; } @@ -2177,8 +2182,8 @@ void EnhancedCustomShape2d::CreateSubPath( { // Some shapes will need special handling, decide on property 'Type'. OUString sShpType; - SdrCustomShapeGeometryItem& rGeometryItem = const_cast(mrSdrObjCustomShape.GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY)); - Any* pAny = rGeometryItem.GetPropertyValueByName(u"Type"_ustr); + const SdrCustomShapeGeometryItem& rGeometryItem = mrSdrObjCustomShape.GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY); + const Any* pAny = rGeometryItem.GetPropertyValueByName(u"Type"_ustr); if (pAny) *pAny >>= sShpType; // User defined shapes in MS binary format, which contain command U or T after import @@ -3064,19 +3069,38 @@ rtl::Reference EnhancedCustomShape2d::CreateObject( bool bLineGeometr return pRet; } -void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* pObj ) +static SdrEscapeDirection lcl_GetEscapeDirection(sal_Int32 nDirection) +{ + switch (nDirection) + { + case 1: return SdrEscapeDirection::LEFT; + case 2: return SdrEscapeDirection::RIGHT; + case 3: return SdrEscapeDirection::TOP; + case 4: return SdrEscapeDirection::BOTTOM; + default: return SdrEscapeDirection::SMART; + } +} + +void EnhancedCustomShape2d::ApplyGluePoints(SdrObject* pObj) { if ( !pObj ) return; - for (const auto& rGluePoint : m_seqGluePoints) + SdrEscapeDirection aDirection = SdrEscapeDirection::SMART; + for (size_t i = 0; i < m_seqGluePoints.size(); i++) { - SdrGluePoint aGluePoint; + EnhancedCustomShapeParameterPair aGluePointPair = m_seqGluePoints[i]; + if (m_seqGluePointLeavingDirections.hasElements()) + { + sal_Int32 aGluePointLeavingDirection = m_seqGluePointLeavingDirections[i]; + aDirection = lcl_GetEscapeDirection(aGluePointLeavingDirection); + } - aGluePoint.SetPos( GetPoint( rGluePoint, !m_bOOXMLShape, true ) ); + SdrGluePoint aGluePoint; + aGluePoint.SetPos( GetPoint( aGluePointPair, !m_bOOXMLShape, true ) ); aGluePoint.SetPercent( false ); aGluePoint.SetAlign( SdrAlign::VERT_TOP | SdrAlign::HORZ_LEFT ); - aGluePoint.SetEscDir( SdrEscapeDirection::SMART ); + aGluePoint.SetEscDir( aDirection ); SdrGluePointList* pList = pObj->ForceGluePointList(); if( pList ) /* sal_uInt16 nId = */ pList->Insert( aGluePoint ); diff --git a/svx/source/dialog/svxgraphicitem.cxx b/svx/source/dialog/svxgraphicitem.cxx index eb5458c3284e..d0ef1111ab08 100644 --- a/svx/source/dialog/svxgraphicitem.cxx +++ b/svx/source/dialog/svxgraphicitem.cxx @@ -27,6 +27,16 @@ SvxGraphicItem::SvxGraphicItem( Graphic _aGraphic ) } +bool SvxGraphicItem::isHashable() const +{ + return true; +} + +size_t SvxGraphicItem::hashCode() const +{ + return aGraphic.GetChecksum(); +} + bool SvxGraphicItem::operator==( const SfxPoolItem& rItem) const { return SfxPoolItem::operator==(rItem) && static_cast(rItem).aGraphic == aGraphic; diff --git a/svx/source/engine3d/svx3ditems.cxx b/svx/source/engine3d/svx3ditems.cxx index 1bfa4f559111..ea58e06de592 100644 --- a/svx/source/engine3d/svx3ditems.cxx +++ b/svx/source/engine3d/svx3ditems.cxx @@ -31,7 +31,8 @@ using namespace ::com::sun::star; // Added extra Item (Bool) for chart2 to be able to show reduced line geometry Svx3DReducedLineGeometryItem::Svx3DReducedLineGeometryItem(bool bVal) - : SfxBoolItem(SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY, bVal) + : SfxBoolItem(SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY, bVal, + SfxItemType::Svx3DReducedLineGeometryItemType) { } @@ -41,42 +42,45 @@ Svx3DReducedLineGeometryItem* Svx3DReducedLineGeometryItem::Clone(SfxItemPool*) } Svx3DNormalsKindItem::Svx3DNormalsKindItem(sal_uInt16 nVal) - : SfxUInt16Item(SDRATTR_3DOBJ_NORMALS_KIND, nVal) + : SfxUInt16Item(SDRATTR_3DOBJ_NORMALS_KIND, nVal, SfxItemType::Svx3DNormalsKindItemType) { } Svx3DTextureProjectionXItem::Svx3DTextureProjectionXItem(sal_uInt16 nVal) - : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_X, nVal) + : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_X, nVal, + SfxItemType::Svx3DTextureProjectionXItemType) { } Svx3DTextureProjectionYItem::Svx3DTextureProjectionYItem(sal_uInt16 nVal) - : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_Y, nVal) + : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_Y, nVal, + SfxItemType::Svx3DTextureProjectionYItemType) { } Svx3DTextureKindItem::Svx3DTextureKindItem(sal_uInt16 nVal) - : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_KIND, nVal) + : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_KIND, nVal, SfxItemType::Svx3DTextureKindItemType) { } Svx3DTextureModeItem::Svx3DTextureModeItem(sal_uInt16 nVal) - : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_MODE, nVal) + : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_MODE, nVal, SfxItemType::Svx3DTextureModeItemType) { } Svx3DPerspectiveItem::Svx3DPerspectiveItem(ProjectionType nVal) - : SfxUInt16Item(SDRATTR_3DSCENE_PERSPECTIVE, static_cast(nVal)) + : SfxUInt16Item(SDRATTR_3DSCENE_PERSPECTIVE, static_cast(nVal), + SfxItemType::Svx3DPerspectiveItemType) { } Svx3DShadeModeItem::Svx3DShadeModeItem(sal_uInt16 nVal) - : SfxUInt16Item(SDRATTR_3DSCENE_SHADE_MODE, nVal) + : SfxUInt16Item(SDRATTR_3DSCENE_SHADE_MODE, nVal, SfxItemType::Svx3DShadeModeItemType) { } Svx3DSmoothNormalsItem::Svx3DSmoothNormalsItem(bool bVal) - : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_NORMALS, bVal) + : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_NORMALS, bVal, SfxItemType::Svx3DSmoothNormalsItemType) { } @@ -86,7 +90,7 @@ Svx3DSmoothNormalsItem* Svx3DSmoothNormalsItem::Clone(SfxItemPool*) const } Svx3DSmoothLidsItem::Svx3DSmoothLidsItem(bool bVal) - : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_LIDS, bVal) + : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_LIDS, bVal, SfxItemType::Svx3DSmoothLidsItemType) { } @@ -96,7 +100,7 @@ Svx3DSmoothLidsItem* Svx3DSmoothLidsItem::Clone(SfxItemPool*) const } Svx3DCharacterModeItem::Svx3DCharacterModeItem(bool bVal) - : SfxBoolItem(SDRATTR_3DOBJ_CHARACTER_MODE, bVal) + : SfxBoolItem(SDRATTR_3DOBJ_CHARACTER_MODE, bVal, SfxItemType::Svx3DCharacterModeItemType) { } @@ -106,7 +110,7 @@ Svx3DCharacterModeItem* Svx3DCharacterModeItem::Clone(SfxItemPool*) const } Svx3DCloseFrontItem::Svx3DCloseFrontItem(bool bVal) - : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_FRONT, bVal) + : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_FRONT, bVal, SfxItemType::Svx3DCloseFrontItemType) { } @@ -116,7 +120,7 @@ Svx3DCloseFrontItem* Svx3DCloseFrontItem::Clone(SfxItemPool*) const } Svx3DCloseBackItem::Svx3DCloseBackItem(bool bVal) - : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_BACK, bVal) + : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_BACK, bVal, SfxItemType::Svx3DCloseBackItemType) { } diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index ec18025b9b01..1dd2b13c53ee 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -1328,9 +1328,9 @@ void GalleryBrowser1::DispatchAdd( SVXGALLERYITEM_ARGNAME, aSeq) }; std::unique_ptr pInfo(new DispatchInfo); - pInfo->TargetURL = aURL; - pInfo->Arguments = aArgs; - pInfo->Dispatch = xDispatch; + pInfo->TargetURL = std::move(aURL); + pInfo->Arguments = std::move(aArgs); + pInfo->Dispatch = std::move(xDispatch); if ( Application::PostUserEvent( LINK( nullptr, GalleryBrowser1, AsyncDispatch_Impl), pInfo.get() ) ) diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx index 3a29c103df67..6343b878b687 100644 --- a/svx/source/items/algitem.cxx +++ b/svx/source/items/algitem.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -216,6 +217,21 @@ bool SvxMarginItem::GetPresentation } +bool SvxMarginItem::isHashable() const +{ + return true; +} + +size_t SvxMarginItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, nLeftMargin); + o3tl::hash_combine(seed, nTopMargin); + o3tl::hash_combine(seed, nRightMargin); + o3tl::hash_combine(seed, nBottomMargin); + return seed; +} + bool SvxMarginItem::operator==( const SfxPoolItem& rItem ) const { assert(SfxPoolItem::operator==(rItem)); @@ -260,6 +276,7 @@ bool SvxMarginItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxMarginItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = ( ( nMemberId & CONVERT_TWIPS ) != 0 ); tools::Long nMaxVal = bConvert ? convertTwipToMm100(SHRT_MAX) : SHRT_MAX; // members are sal_Int16 sal_Int32 nVal = 0; @@ -290,24 +307,28 @@ bool SvxMarginItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) void SvxMarginItem::SetLeftMargin( sal_Int16 nLeft ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nLeftMargin = nLeft; } void SvxMarginItem::SetTopMargin( sal_Int16 nTop ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nTopMargin = nTop; } void SvxMarginItem::SetRightMargin( sal_Int16 nRight ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nRightMargin = nRight; } void SvxMarginItem::SetBottomMargin( sal_Int16 nBottom ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nBottomMargin = nBottom; } diff --git a/svx/source/items/chrtitem.cxx b/svx/source/items/chrtitem.cxx index 7001c37c30a9..253d4f259aec 100644 --- a/svx/source/items/chrtitem.cxx +++ b/svx/source/items/chrtitem.cxx @@ -21,7 +21,7 @@ #include #include #include - +#include #include using namespace ::com::sun::star; @@ -120,6 +120,18 @@ bool SvxDoubleItem::GetPresentation return true; } +bool SvxDoubleItem::isHashable() const +{ + return true; +} + +size_t SvxDoubleItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, fVal); + return seed; +} + bool SvxDoubleItem::operator == (const SfxPoolItem& rItem) const { assert(SfxPoolItem::operator==(rItem)); @@ -139,6 +151,7 @@ bool SvxDoubleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const bool SvxDoubleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; return rVal >>= fVal; } diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx index 6a2153251c55..4479296227ae 100644 --- a/svx/source/items/customshapeitem.cxx +++ b/svx/source/items/customshapeitem.cxx @@ -40,6 +40,7 @@ SdrCustomShapeGeometryItem::SdrCustomShapeGeometryItem( const uno::Sequence< bea css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const OUString& rPropName ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; css::uno::Any* pRet = nullptr; PropertyHashMap::iterator aHashIter( m_aPropHashMap.find( rPropName ) ); if ( aHashIter != m_aPropHashMap.end() ) @@ -58,6 +59,7 @@ const css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const O css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const OUString& rSequenceName, const OUString& rPropName ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; css::uno::Any* pRet = nullptr; css::uno::Any* pSeqAny = GetPropertyValueByName( rSequenceName ); if ( pSeqAny ) @@ -94,6 +96,7 @@ const css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const O void SdrCustomShapeGeometryItem::SetPropertyValue( const css::beans::PropertyValue& rPropVal ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; css::uno::Any* pAny = GetPropertyValueByName( rPropVal.Name ); if ( pAny ) { // property is already available @@ -132,6 +135,7 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const css::beans::PropertyVal void SdrCustomShapeGeometryItem::SetPropertyValue( const OUString& rSequenceName, const css::beans::PropertyValue& rPropVal ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; css::uno::Any* pAny = GetPropertyValueByName( rSequenceName, rPropVal.Name ); if ( pAny ) // just replacing *pAny = rPropVal.Value; @@ -181,6 +185,7 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const OUString& rSequenceName void SdrCustomShapeGeometryItem::ClearPropertyValue( const OUString& rPropName ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; if ( !m_aPropSeq.hasElements() ) return; @@ -221,6 +226,17 @@ SdrCustomShapeGeometryItem::~SdrCustomShapeGeometryItem() { } +bool SdrCustomShapeGeometryItem::isHashable() const +{ + return true; +} + +size_t SdrCustomShapeGeometryItem::hashCode() const +{ + UpdateHash(); + return m_aHashState == HashState::Valid ? m_aHash : 0; +} + bool SdrCustomShapeGeometryItem::operator==( const SfxPoolItem& rCmp ) const { if( !SfxPoolItem::operator==( rCmp )) @@ -286,6 +302,7 @@ bool SdrCustomShapeGeometryItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMember bool SdrCustomShapeGeometryItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; css::uno::Sequence< css::beans::PropertyValue > propSeq; if ( ! ( rVal >>= propSeq ) ) return false; @@ -296,6 +313,7 @@ bool SdrCustomShapeGeometryItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMe void SdrCustomShapeGeometryItem::SetPropSeq( const css::uno::Sequence< css::beans::PropertyValue >& rVal ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; if( m_aPropSeq == rVal ) return; diff --git a/svx/source/items/e3ditem.cxx b/svx/source/items/e3ditem.cxx index d2cd113b16bf..7e947a7670e7 100644 --- a/svx/source/items/e3ditem.cxx +++ b/svx/source/items/e3ditem.cxx @@ -19,7 +19,7 @@ #include #include - +#include #include using namespace ::com::sun::star; @@ -43,6 +43,19 @@ SvxB3DVectorItem::SvxB3DVectorItem( const SvxB3DVectorItem& rItem ) : { } +bool SvxB3DVectorItem::isHashable() const +{ + return true; +} + +size_t SvxB3DVectorItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, aVal.getX()); + o3tl::hash_combine(seed, aVal.getY()); + o3tl::hash_combine(seed, aVal.getZ()); + return seed; +} bool SvxB3DVectorItem::operator==( const SfxPoolItem &rItem ) const { @@ -73,6 +86,7 @@ bool SvxB3DVectorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) con bool SvxB3DVectorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; drawing::Direction3D aDirection; if(!(rVal >>= aDirection)) return false; diff --git a/svx/source/items/grfitem.cxx b/svx/source/items/grfitem.cxx index fcc06e2b39be..62f34094e228 100644 --- a/svx/source/items/grfitem.cxx +++ b/svx/source/items/grfitem.cxx @@ -27,14 +27,14 @@ using namespace ::com::sun::star; SvxGrfCrop::SvxGrfCrop( TypedWhichId nItemId, SfxItemType eType ) : SfxPoolItem( nItemId, eType ), - nLeft( 0 ), nRight( 0 ), nTop( 0 ), nBottom( 0 ) + m_nLeft( 0 ), m_nRight( 0 ), m_nTop( 0 ), m_nBottom( 0 ) {} SvxGrfCrop::SvxGrfCrop( sal_Int32 nL, sal_Int32 nR, sal_Int32 nT, sal_Int32 nB, TypedWhichId nItemId, SfxItemType eItemType ) : SfxPoolItem( nItemId, eItemType ), - nLeft( nL ), nRight( nR ), nTop( nT ), nBottom( nB ) + m_nLeft( nL ), m_nRight( nR ), m_nTop( nT ), m_nBottom( nB ) {} SvxGrfCrop::~SvxGrfCrop() @@ -46,10 +46,10 @@ bool SvxGrfCrop::operator==( const SfxPoolItem& rAttr ) const assert(SfxPoolItem::operator==(rAttr)); const SvxGrfCrop& rCrop = static_cast(rAttr); - return nLeft == rCrop.GetLeft() && - nRight == rCrop.GetRight() && - nTop == rCrop.GetTop() && - nBottom == rCrop.GetBottom(); + return m_nLeft == rCrop.GetLeft() && + m_nRight == rCrop.GetRight() && + m_nTop == rCrop.GetTop() && + m_nBottom == rCrop.GetBottom(); } @@ -57,10 +57,10 @@ bool SvxGrfCrop::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); text::GraphicCrop aRet; - aRet.Left = nLeft; - aRet.Right = nRight; - aRet.Top = nTop; - aRet.Bottom = nBottom; + aRet.Left = m_nLeft; + aRet.Right = m_nRight; + aRet.Top = m_nTop; + aRet.Bottom = m_nBottom; if( bConvert ) { @@ -90,10 +90,10 @@ bool SvxGrfCrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) aVal.Bottom = o3tl::toTwips(aVal.Bottom, o3tl::Length::mm100); } - nLeft = aVal.Left ; - nRight = aVal.Right ; - nTop = aVal.Top ; - nBottom = aVal.Bottom; + m_nLeft = aVal.Left ; + m_nRight = aVal.Right ; + m_nTop = aVal.Top ; + m_nBottom = aVal.Bottom; return true; } diff --git a/svx/source/items/postattr.cxx b/svx/source/items/postattr.cxx index 267c2cd9ad18..f04541bf67e2 100644 --- a/svx/source/items/postattr.cxx +++ b/svx/source/items/postattr.cxx @@ -65,14 +65,20 @@ SvxPostItAuthorItem* SvxPostItAuthorItem::Clone( SfxItemPool * ) const return new SvxPostItAuthorItem( *this ); } +// hashCode is defined in CntUnencodedStringItem +bool SvxPostItAuthorItem::isHashable() const +{ + return true; +} + SvxPostItDateItem::SvxPostItDateItem( TypedWhichId _nWhich ) - : SfxStringItem(_nWhich) + : SfxStringItem(_nWhich, SfxItemType::SvxPostItDateItemType) { } SvxPostItDateItem::SvxPostItDateItem( const OUString& rDate, TypedWhichId _nWhich ) : - SfxStringItem( _nWhich, rDate ) + SfxStringItem( _nWhich, rDate, SfxItemType::SvxPostItDateItemType ) { } @@ -104,6 +110,12 @@ SvxPostItDateItem* SvxPostItDateItem::Clone( SfxItemPool * ) const return new SvxPostItDateItem( *this ); } +// hashCode is defined in CntUnencodedStringItem +bool SvxPostItDateItem::isHashable() const +{ + return true; +} + SvxPostItTextItem::SvxPostItTextItem( TypedWhichId _nWhich ) { SetWhich( _nWhich ); @@ -141,6 +153,12 @@ SvxPostItTextItem* SvxPostItTextItem::Clone( SfxItemPool * ) const return new SvxPostItTextItem( *this ); } +// hashCode is defined in CntUnencodedStringItem +bool SvxPostItTextItem::isHashable() const +{ + return true; +} + SvxPostItIdItem::SvxPostItIdItem( TypedWhichId _nWhich ) { SetWhich( _nWhich ); @@ -151,4 +169,10 @@ SvxPostItIdItem* SvxPostItIdItem::Clone( SfxItemPool * ) const return new SvxPostItIdItem( *this ); } +// hashCode is defined in CntUnencodedStringItem +bool SvxPostItIdItem::isHashable() const +{ + return true; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/items/statusitem.cxx b/svx/source/items/statusitem.cxx index e2e1c74307dc..5d8a74dbe19d 100644 --- a/svx/source/items/statusitem.cxx +++ b/svx/source/items/statusitem.cxx @@ -19,7 +19,7 @@ constexpr int STATUS_PARAMS = 2; SvxStatusItem::SvxStatusItem(TypedWhichId nWhich, const OUString& rString, StatusCategory eCategory) - : SfxStringItem(nWhich, rString) + : SfxStringItem(nWhich, rString, SfxItemType::SvxStatusItemType) , m_eCategory(eCategory) { } diff --git a/svx/source/items/viewlayoutitem.cxx b/svx/source/items/viewlayoutitem.cxx index 78a03efb5edd..2761dced30d7 100644 --- a/svx/source/items/viewlayoutitem.cxx +++ b/svx/source/items/viewlayoutitem.cxx @@ -40,7 +40,7 @@ SvxViewLayoutItem::SvxViewLayoutItem bool bBookMode, TypedWhichId _nWhich ) -: SfxUInt16Item( _nWhich, nColumns ), +: SfxUInt16Item( _nWhich, nColumns, SfxItemType::SvxViewLayoutItemType ), mbBookMode( bBookMode ) { } diff --git a/svx/source/items/zoomslideritem.cxx b/svx/source/items/zoomslideritem.cxx index bd7313904710..042b9f4a5947 100644 --- a/svx/source/items/zoomslideritem.cxx +++ b/svx/source/items/zoomslideritem.cxx @@ -36,7 +36,7 @@ constexpr OUString ZOOMSLIDER_PARAM_MAXZOOM = u"MaxValue"_ustr; SvxZoomSliderItem::SvxZoomSliderItem( sal_uInt16 nCurrentZoom, sal_uInt16 nMinZoom, sal_uInt16 nMaxZoom, TypedWhichId _nWhich ) -: SfxUInt16Item( _nWhich, nCurrentZoom ), mnMinZoom( nMinZoom ), mnMaxZoom( nMaxZoom ) +: SfxUInt16Item( _nWhich, nCurrentZoom, SfxItemType::SvxZoomSliderItemType ), mnMinZoom( nMinZoom ), mnMaxZoom( nMaxZoom ) { } diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx index bd00e8a7f5df..78a1421943d5 100644 --- a/svx/source/sdr/overlay/overlayselection.cxx +++ b/svx/source/sdr/overlay/overlayselection.cxx @@ -33,30 +33,22 @@ #include #include #include +#include namespace sdr::overlay { // combine ranges geometrically to a single, ORed polygon - static basegfx::B2DPolyPolygon impCombineRangesToPolyPolygon(const std::vector< basegfx::B2DRange >& rRanges, bool bOffset) + static basegfx::B2DPolyPolygon impCombineRangesToPolyPolygon(const std::vector< basegfx::B2DRange >& rRanges, bool bOffset, double fOffset) { - // Determines the offset in twips. - // The offset is only needed if the contrast outline is drawn - sal_Int32 nOffset(0); - if (bOffset) - { - Size aSize(1, 1); - aSize = o3tl::convert(aSize, o3tl::Length::px, o3tl::Length::twip); - nOffset = aSize.getWidth(); - } - const sal_uInt32 nCount(rRanges.size()); basegfx::B2DPolyPolygon aRetval; for(sal_uInt32 a(0); a < nCount; a++) { basegfx::B2DRange aRange(rRanges[a]); - aRange.grow(nOffset); + if (bOffset) + aRange.grow(fOffset); const basegfx::B2DPolygon aDiscretePolygon(basegfx::utils::createPolygonFromRect(aRange)); if(0 == a) @@ -172,15 +164,7 @@ namespace sdr::overlay if(mbBorder) { - // External outline using themed color - basegfx::B2DPolyPolygon aPolyPolygon(impCombineRangesToPolyPolygon(getRanges(), mbContrastOutline)); - const drawinglayer::primitive2d::Primitive2DReference aSelectionOutline( - new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D( - std::move(aPolyPolygon), - aRGBColor)); - - // add both to result - aRetval = drawinglayer::primitive2d::Primitive2DContainer {aUnifiedTransparence, aSelectionOutline}; + aRetval = drawinglayer::primitive2d::Primitive2DContainer {aUnifiedTransparence}; // tdf#161204 Outline with white color to provide contrast if (mbContrastOutline) @@ -192,6 +176,21 @@ namespace sdr::overlay basegfx::BColor(1.0, 1.0, 1.0))); aRetval.append(drawinglayer::primitive2d::Primitive2DContainer{aContrastSelectionOutline}); } + + // Offset to be applied to the external outline + double fOffset(0); + if (getOverlayManager()) + fOffset = getOverlayManager()->getOutputDevice().PixelToLogic(Size(1, 1)).getWidth(); + + // External outline using themed color + basegfx::B2DPolyPolygon aPolyPolygon(impCombineRangesToPolyPolygon(getRanges(), mbContrastOutline, fOffset)); + const drawinglayer::primitive2d::Primitive2DReference aSelectionOutline( + new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D( + std::move(aPolyPolygon), + aRGBColor)); + + // Add to result + aRetval.append(drawinglayer::primitive2d::Primitive2DContainer {aSelectionOutline}); } else { diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 5e34d50cca39..6b18b2fab1de 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -1113,9 +1113,11 @@ namespace drawinglayer::primitive2d } } - if(!aFill.isDefault() || !aText.isDefault()) + if (!aFill.isDefault() || !aText.isDefault()) { - return attribute::SdrFillTextAttribute(aFill, aFillFloatTransGradient, aText); + return attribute::SdrFillTextAttribute(std::move(aFill), + std::move(aFillFloatTransGradient), + std::move(aText)); } return attribute::SdrFillTextAttribute(); diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 1ae7e7eedcab..93fbfe261fcf 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -1477,7 +1477,7 @@ bool SdrTextAniAmountItem::GetPresentation( SdrTextFixedCellHeightItem::SdrTextFixedCellHeightItem( bool bUseFixedCellHeight ) - : SfxBoolItem( SDRATTR_TEXT_USEFIXEDCELLHEIGHT, bUseFixedCellHeight ) + : SfxBoolItem( SDRATTR_TEXT_USEFIXEDCELLHEIGHT, bUseFixedCellHeight, SfxItemType::SdrTextFixedCellHeightItemType ) { } bool SdrTextFixedCellHeightItem::GetPresentation( SfxItemPresentation ePres, @@ -2171,4 +2171,10 @@ SdrLayerNameItem* SdrLayerNameItem::Clone(SfxItemPool* /*pPool*/) const return new SdrLayerNameItem(*this); } +// hashCode is defined in CntUnencodedStringItem +bool SdrLayerNameItem::isHashable() const +{ + return true; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 3c43cf2c81bc..a26b26a2ff2c 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -142,6 +142,7 @@ SdrModel::SdrModel(SfxItemPool* pPool, comphelper::IEmbeddedHelper* pEmbeddedHel , m_bStarDrawPreviewMode(false) , mbDisableTextEditUsesCommonUndoManager(false) , mbVOCInvalidationIsReliable(false) + , m_bIsPDFDocument(false) , m_nDefaultTabulator(0) , m_nMaxUndoCount(16) , m_pTextChain(new TextChain) diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 6400f9748d91..b94721c85e24 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1260,7 +1260,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S if (pViewShell != pOtherShell) SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelectionTextView); } - else + else if (pViewShell) { // We have a new selection, so both pViewShell and the // other views want to know about it. diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index ea8af4045878..5874acb1c63d 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -334,8 +334,16 @@ sal_uInt16 SdrPaintView::ImpGetHitTolLogic(short nHitTol, const OutputDevice* pO void SdrPaintView::TheresNewMapMode() { if (mpActualOutDev) { - mnHitTolLog=static_cast(mpActualOutDev->PixelToLogic(Size(mnHitTolPix,0)).Width()); - mnMinMovLog=static_cast(mpActualOutDev->PixelToLogic(Size(mnMinMovPix,0)).Width()); + if (comphelper::LibreOfficeKit::isActive()) + { + mnHitTolLog=static_cast(OutputDevice::LogicToLogic(Size(mnHitTolPix,0), MapMode(MapUnit::MapPixel), mpActualOutDev->GetMapMode()).Width()); + mnMinMovLog=static_cast(OutputDevice::LogicToLogic(Size(mnMinMovPix,0), MapMode(MapUnit::MapPixel), mpActualOutDev->GetMapMode()).Width()); + } + else + { + mnHitTolLog=static_cast(mpActualOutDev->PixelToLogic(Size(mnHitTolPix,0)).Width()); + mnMinMovLog=static_cast(mpActualOutDev->PixelToLogic(Size(mnMinMovPix,0)).Width()); + } } } diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index a47665d1bde5..617bdb8f8fbc 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -543,9 +543,9 @@ void SvxLineBox::Fill( const XDashListRef &pList ) mxLineStyleSet->InsertItem(1, Image(), pList->GetStringForUiNoLine()); // entry for solid line - auto aBmp = pList->GetBitmapForUISolidLine(); - Size aBmpSize = aBmp.GetSizePixel(); - mxLineStyleSet->InsertItem(2, Image(aBmp), pList->GetStringForUiSolidLine()); + const auto& rBmp = pList->GetBitmapForUISolidLine(); + Size aBmpSize = rBmp.GetSizePixel(); + mxLineStyleSet->InsertItem(2, Image(rBmp), pList->GetStringForUiSolidLine()); // entries for dashed lines tools::Long nCount = pList->Count(); diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index a228b93e4da2..d8e0a41a6f9d 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -2987,7 +2987,7 @@ XFormTextStartItem* XFormTextStartItem::Clone(SfxItemPool* /*pPool*/) const SfxPoolItem* XFormTextMirrorItem::CreateDefault() { return new XFormTextMirrorItem; } XFormTextMirrorItem::XFormTextMirrorItem(bool bMirror) : - SfxBoolItem(XATTR_FORMTXTMIRROR, bMirror, SfxItemType::XFormTextMirrorItem) + SfxBoolItem(XATTR_FORMTXTMIRROR, bMirror, SfxItemType::XFormTextMirrorItemType) { } diff --git a/sw/inc/fmtclbl.hxx b/sw/inc/fmtclbl.hxx index c521b45bd8bb..5ffc709896cf 100644 --- a/sw/inc/fmtclbl.hxx +++ b/sw/inc/fmtclbl.hxx @@ -29,7 +29,7 @@ class SW_DLLPUBLIC SwFormatNoBalancedColumns final : public SfxBoolItem { public: SwFormatNoBalancedColumns( bool bFlag = false ) - : SfxBoolItem( RES_COLUMNBALANCE, bFlag ) {} + : SfxBoolItem( RES_COLUMNBALANCE, bFlag, SfxItemType::SwFormatNoBalancedColumnsType ) {} /// "pure virtual methods" of SfxPoolItem virtual SwFormatNoBalancedColumns* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/sw/inc/fmteiro.hxx b/sw/inc/fmteiro.hxx index 7ec165654c27..a971d71cc2ca 100644 --- a/sw/inc/fmteiro.hxx +++ b/sw/inc/fmteiro.hxx @@ -35,7 +35,7 @@ class SW_DLLPUBLIC SwFormatEditInReadonly final : public SfxBoolItem { public: SwFormatEditInReadonly( sal_uInt16 nId = RES_EDIT_IN_READONLY, - bool bPrt = false ) : SfxBoolItem( nId, bPrt ) {} + bool bPrt = false ) : SfxBoolItem( nId, bPrt, SfxItemType::SwFormatEditInReadonly ) {} /// "pure virtual method" of SfxPoolItem virtual SwFormatEditInReadonly* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/sw/inc/fmtfollowtextflow.hxx b/sw/inc/fmtfollowtextflow.hxx index 625f4658207b..b4e1fc599cab 100644 --- a/sw/inc/fmtfollowtextflow.hxx +++ b/sw/inc/fmtfollowtextflow.hxx @@ -34,7 +34,7 @@ class SW_DLLPUBLIC SwFormatFollowTextFlow final : public SfxBoolItem public: SwFormatFollowTextFlow( bool bFlag = false ) - : SfxBoolItem( RES_FOLLOW_TEXT_FLOW, bFlag ) + : SfxBoolItem( RES_FOLLOW_TEXT_FLOW, bFlag, SfxItemType::SwFormatFollowTextFlowType ) {} /// "pure virtual methods" of SfxPoolItem diff --git a/sw/inc/fmtfsize.hxx b/sw/inc/fmtfsize.hxx index 4607d2c83579..fae54e25729b 100644 --- a/sw/inc/fmtfsize.hxx +++ b/sw/inc/fmtfsize.hxx @@ -112,8 +112,8 @@ public: void dumpAsXml(xmlTextWriterPtr pWriter) const override; -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; + virtual bool isHashable() const override; + virtual size_t hashCode() const override; }; inline const SwFormatFrameSize &SwAttrSet::GetFrameSize(bool bInP) const diff --git a/sw/inc/fmtlsplt.hxx b/sw/inc/fmtlsplt.hxx index 8038f597d9a9..822ec7af9b98 100644 --- a/sw/inc/fmtlsplt.hxx +++ b/sw/inc/fmtlsplt.hxx @@ -31,7 +31,7 @@ class IntlWrapper; class SW_DLLPUBLIC SwFormatLayoutSplit final : public SfxBoolItem { public: - SwFormatLayoutSplit( bool bSplit = true ) : SfxBoolItem( RES_LAYOUT_SPLIT, bSplit ) {} + SwFormatLayoutSplit( bool bSplit = true ) : SfxBoolItem( RES_LAYOUT_SPLIT, bSplit, SfxItemType::SwFormatLayoutSplitType ) {} /// "pure virtual methods" of SfxPoolItem virtual SwFormatLayoutSplit* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/sw/inc/fmtornt.hxx b/sw/inc/fmtornt.hxx index 9e4ef933c97e..238bd2def862 100644 --- a/sw/inc/fmtornt.hxx +++ b/sw/inc/fmtornt.hxx @@ -67,8 +67,8 @@ public: void dumpAsXml(xmlTextWriterPtr pWriter) const override; -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; + virtual bool isHashable() const override; + virtual size_t hashCode() const override; }; /// Defines the horizontal position of a fly frame. @@ -110,8 +110,8 @@ public: void dumpAsXml(xmlTextWriterPtr pWriter) const override; -protected: - virtual ItemInstanceManager* getItemInstanceManager() const override; + virtual bool isHashable() const override; + virtual size_t hashCode() const override; }; inline const SwFormatVertOrient &SwAttrSet::GetVertOrient(bool bInP) const diff --git a/sw/inc/fmtrowsplt.hxx b/sw/inc/fmtrowsplt.hxx index faf168ba2b5e..a3a53e2012a2 100644 --- a/sw/inc/fmtrowsplt.hxx +++ b/sw/inc/fmtrowsplt.hxx @@ -31,7 +31,7 @@ class IntlWrapper; class SW_DLLPUBLIC SwFormatRowSplit final : public SfxBoolItem { public: - SwFormatRowSplit( bool bSplit = true ) : SfxBoolItem( RES_ROW_SPLIT, bSplit ) {} + SwFormatRowSplit( bool bSplit = true ) : SfxBoolItem( RES_ROW_SPLIT, bSplit, SfxItemType::SwFormatRowSplitType ) {} // "pure virtual methods" of SfxPoolItem virtual SwFormatRowSplit* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/sw/inc/grfatr.hxx b/sw/inc/grfatr.hxx index fa3991d4aa8f..f6fe5bb8b05f 100644 --- a/sw/inc/grfatr.hxx +++ b/sw/inc/grfatr.hxx @@ -114,7 +114,7 @@ class SW_DLLPUBLIC SwLuminanceGrf final : public SfxInt16Item { public: SwLuminanceGrf( sal_Int16 nVal = 0 ) - : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal ) + : SfxInt16Item( RES_GRFATR_LUMINANCE, nVal, SfxItemType::SwLuminanceGrfType ) {} // pure virtual methods from SfxInt16Item @@ -130,7 +130,7 @@ class SW_DLLPUBLIC SwContrastGrf final : public SfxInt16Item { public: SwContrastGrf( sal_Int16 nVal = 0 ) - : SfxInt16Item( RES_GRFATR_CONTRAST, nVal ) + : SfxInt16Item( RES_GRFATR_CONTRAST, nVal, SfxItemType::SwContrastGrfType ) {} // pure virtual methods from SfxInt16Item @@ -146,7 +146,7 @@ class SwChannelGrf : public SfxInt16Item { protected: SwChannelGrf( sal_Int16 nVal, sal_uInt16 nWhichL ) - : SfxInt16Item( nWhichL, nVal ) + : SfxInt16Item( nWhichL, nVal, SfxItemType::SwChannelGrfType ) {} public: diff --git a/sw/inc/hfspacingitem.hxx b/sw/inc/hfspacingitem.hxx index a18ae742a3a0..1d1c85693290 100644 --- a/sw/inc/hfspacingitem.hxx +++ b/sw/inc/hfspacingitem.hxx @@ -29,7 +29,7 @@ class SW_DLLPUBLIC SwHeaderAndFooterEatSpacingItem final : public SfxBoolItem { public: SwHeaderAndFooterEatSpacingItem( sal_uInt16 nId = RES_HEADER_FOOTER_EAT_SPACING, - bool bPrt = false ) : SfxBoolItem( nId, bPrt ) {} + bool bPrt = false ) : SfxBoolItem( nId, bPrt, SfxItemType::SwHeaderAndFooterEatSpacingItemType ) {} // "pure virtual methods" of SfxPoolItem virtual SwHeaderAndFooterEatSpacingItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx index 9b5f2b156430..dfe9be3afe70 100644 --- a/sw/inc/paratr.hxx +++ b/sw/inc/paratr.hxx @@ -156,14 +156,15 @@ public: static SfxPoolItem* CreateDefault(); SwNumRuleItem() - : SfxStringItem( RES_PARATR_NUMRULE, OUString() ) {} + : SfxStringItem( RES_PARATR_NUMRULE, OUString(), SfxItemType::SwNumRuleItemType ) {} SwNumRuleItem( const OUString& rRuleName ) - : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {} + : SfxStringItem( RES_PARATR_NUMRULE, rRuleName, SfxItemType::SwNumRuleItemType ) {} SwNumRuleItem(SwNumRuleItem const &) = default; // SfxPoolItem copy function dichotomy /// "pure virtual methods" of SfxPoolItem + virtual bool isHashable() const override; // hashCode is defined in CntUnencodedStringItem virtual bool operator==( const SfxPoolItem& ) const override; virtual SwNumRuleItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 1d205f18624f..d6a5dbb90eac 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -241,6 +241,7 @@ public: virtual int GetPageNumberAlignment() const = 0; virtual bool GetMirrorOnEvenPages() const = 0; virtual bool GetIncludePageTotal() const = 0; + virtual bool GetFitIntoExistingMargins() const = 0; virtual SvxNumType GetPageNumberType() const = 0; virtual void SetPageNumberType(SvxNumType nSet) = 0; }; diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index d938773d17dd..38d67effb9ff 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -181,7 +181,6 @@ private: const SfxItemPropertySet* m_pPropSet; SwDocShell* m_pDocShell; - bool m_bObjectValid; rtl::Reference m_xDrawPage; diff --git a/sw/qa/api/SwXAutoTextContainer.cxx b/sw/qa/api/SwXAutoTextContainer.cxx index 5812e1ec0c44..4d6031a990e4 100644 --- a/sw/qa/api/SwXAutoTextContainer.cxx +++ b/sw/qa/api/SwXAutoTextContainer.cxx @@ -45,7 +45,7 @@ public: virtual void setUp() override { UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); + mxDesktop.set(frame::Desktop::create(m_xContext)); } Reference init() override diff --git a/sw/qa/api/SwXBodyText.cxx b/sw/qa/api/SwXBodyText.cxx index 3db54633e441..7dd479c43eac 100644 --- a/sw/qa/api/SwXBodyText.cxx +++ b/sw/qa/api/SwXBodyText.cxx @@ -7,13 +7,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include #include #include #include #include #include -#include #include @@ -32,8 +31,7 @@ namespace /** * Initial tests for SwXBodyText. */ -class SwXBodyText final : public test::BootstrapFixture, - public unotest::MacrosTest, +class SwXBodyText final : public UnoApiTest, public apitest::XElementAccess, public apitest::XTextRange, public apitest::XSimpleText, @@ -42,8 +40,6 @@ class SwXBodyText final : public test::BootstrapFixture, { public: SwXBodyText(); - virtual void setUp() override; - void tearDown() override; Reference init() override; @@ -62,37 +58,20 @@ public: CPPUNIT_TEST(testCompareRegionStarts); CPPUNIT_TEST(testCompareRegionEnds); CPPUNIT_TEST_SUITE_END(); - -private: - uno::Reference component_; }; SwXBodyText::SwXBodyText() - : XElementAccess(cppu::UnoType::get()) + : UnoApiTest(u""_ustr) + , XElementAccess(cppu::UnoType::get()) { } -void SwXBodyText::setUp() -{ - test::BootstrapFixture::setUp(); - mxDesktop.set( - frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()))); -} - -void SwXBodyText::tearDown() -{ - if (component_.is()) - component_->dispose(); - - test::BootstrapFixture::tearDown(); -} - Reference SwXBodyText::init() { - component_ + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr); - Reference xTextDocument(component_, UNO_QUERY_THROW); - Reference xMSF(component_, UNO_QUERY_THROW); + Reference xTextDocument(mxComponent, UNO_QUERY_THROW); + Reference xMSF(mxComponent, UNO_QUERY_THROW); Reference xText = xTextDocument->getText(); diff --git a/sw/qa/api/SwXBookmark.cxx b/sw/qa/api/SwXBookmark.cxx index 3e6bf37eacbb..a92528d6f201 100644 --- a/sw/qa/api/SwXBookmark.cxx +++ b/sw/qa/api/SwXBookmark.cxx @@ -39,16 +39,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXBookmarks.cxx b/sw/qa/api/SwXBookmarks.cxx index a3162f0053b6..c2f37bcc676b 100644 --- a/sw/qa/api/SwXBookmarks.cxx +++ b/sw/qa/api/SwXBookmarks.cxx @@ -42,16 +42,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXChapterNumbering.cxx b/sw/qa/api/SwXChapterNumbering.cxx index 7b090134109b..c6e302362ddb 100644 --- a/sw/qa/api/SwXChapterNumbering.cxx +++ b/sw/qa/api/SwXChapterNumbering.cxx @@ -41,16 +41,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xCNSupplier(xTextDocument, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXDocumentIndex.cxx b/sw/qa/api/SwXDocumentIndex.cxx index 9954f5bf3955..7e1e5f9d673e 100644 --- a/sw/qa/api/SwXDocumentIndex.cxx +++ b/sw/qa/api/SwXDocumentIndex.cxx @@ -55,16 +55,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); mxTextDocument = Reference(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxTextDocument, UNO_QUERY_THROW); Reference xDocumentIndex( diff --git a/sw/qa/api/SwXDocumentIndexMark.cxx b/sw/qa/api/SwXDocumentIndexMark.cxx index 5206dbe068a5..1d0e28a9e737 100644 --- a/sw/qa/api/SwXDocumentIndexMark.cxx +++ b/sw/qa/api/SwXDocumentIndexMark.cxx @@ -7,12 +7,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include #include #include #include #include -#include #include @@ -32,22 +31,19 @@ namespace /** * Initial tests for SwXDocumentIndexMark. */ -class SwXDocumentIndexMark final : public test::BootstrapFixture, - public unotest::MacrosTest, +class SwXDocumentIndexMark final : public UnoApiTest, public apitest::XComponent, public apitest::XTextContent, public apitest::BaseIndexMark, public apitest::DocumentIndexMark { public: - virtual void setUp() override; - void tearDown() override; + SwXDocumentIndexMark(); Reference init() override; uno::Reference getTextRange() override; uno::Reference getTextContent() override; bool isAttachSupported() override { return true; } - uno::Reference getTextDocument() { return mxTextDocument; } void triggerDesktopTerminate() override { mxDesktop->terminate(); } CPPUNIT_TEST_SUITE(SwXDocumentIndexMark); @@ -61,35 +57,23 @@ public: CPPUNIT_TEST_SUITE_END(); private: - uno::Reference mxTextDocument; uno::Reference mxTextRange; uno::Reference mxTextContent; }; -void SwXDocumentIndexMark::setUp() +SwXDocumentIndexMark::SwXDocumentIndexMark() + : UnoApiTest(u""_ustr) { - test::BootstrapFixture::setUp(); - - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxTextDocument = uno::Reference( - loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr), - uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(mxTextDocument.is()); -} - -void SwXDocumentIndexMark::tearDown() -{ - if (mxTextDocument.is()) - mxTextDocument->dispose(); - - test::BootstrapFixture::tearDown(); } Reference SwXDocumentIndexMark::init() { - Reference xMSF(mxTextDocument, UNO_QUERY_THROW); + mxComponent + = loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr); + Reference xTextDocument(mxComponent, UNO_QUERY_THROW); + Reference xMSF(mxComponent, UNO_QUERY_THROW); - Reference xText = getTextDocument()->getText(); + Reference xText = xTextDocument->getText(); Reference xCursor = xText->createTextCursor(); Reference xDIM( diff --git a/sw/qa/api/SwXDocumentIndexes.cxx b/sw/qa/api/SwXDocumentIndexes.cxx index 841609df5131..7ba73bba26ff 100644 --- a/sw/qa/api/SwXDocumentIndexes.cxx +++ b/sw/qa/api/SwXDocumentIndexes.cxx @@ -43,16 +43,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXDocumentSettings.cxx b/sw/qa/api/SwXDocumentSettings.cxx index 509bbfc3eb22..f88b6a1e60a9 100644 --- a/sw/qa/api/SwXDocumentSettings.cxx +++ b/sw/qa/api/SwXDocumentSettings.cxx @@ -7,12 +7,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include #include #include #include #include -#include #include @@ -28,22 +27,16 @@ namespace /** * Test for Java API test of file com.sun.star.comp.Writer.DocumentSettings.csv */ -class SwXDocumentSettings final : public test::BootstrapFixture, - public unotest::MacrosTest, +class SwXDocumentSettings final : public UnoApiTest, public apitest::TextDocumentSettings, public apitest::TextSettings, public apitest::TextPrinterSettings, public apitest::XServiceInfo { -private: - uno::Reference mxComponent; - public: - virtual void setUp() override; - virtual void tearDown() override; - SwXDocumentSettings() - : apitest::XServiceInfo(u"SwXDocumentSettings"_ustr, + : UnoApiTest(u""_ustr) + , apitest::XServiceInfo(u"SwXDocumentSettings"_ustr, u"com.sun.star.text.DocumentSettings"_ustr){}; uno::Reference init() override; @@ -57,21 +50,6 @@ public: CPPUNIT_TEST_SUITE_END(); }; -void SwXDocumentSettings::setUp() -{ - test::BootstrapFixture::setUp(); - - mxDesktop.set(frame::Desktop::create(mxComponentContext)); -} - -void SwXDocumentSettings::tearDown() -{ - if (mxComponent.is()) - mxComponent->dispose(); - - test::BootstrapFixture::tearDown(); -} - uno::Reference SwXDocumentSettings::init() { mxComponent diff --git a/sw/qa/api/SwXFieldEnumeration.cxx b/sw/qa/api/SwXFieldEnumeration.cxx index 282d0322e051..cb9998a4e094 100644 --- a/sw/qa/api/SwXFieldEnumeration.cxx +++ b/sw/qa/api/SwXFieldEnumeration.cxx @@ -38,16 +38,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXFootnote.cxx b/sw/qa/api/SwXFootnote.cxx index 9f5d1e488bcf..686494312ddc 100644 --- a/sw/qa/api/SwXFootnote.cxx +++ b/sw/qa/api/SwXFootnote.cxx @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include #include #include #include @@ -15,7 +15,6 @@ #include #include #include -#include #include @@ -35,8 +34,7 @@ namespace /** * Initial tests for SwXFootnote. */ -class SwXFootnote final : public test::BootstrapFixture, - public unotest::MacrosTest, +class SwXFootnote final : public UnoApiTest, public apitest::XComponent, public apitest::XSimpleText, public apitest::XTextRange, @@ -46,14 +44,12 @@ class SwXFootnote final : public test::BootstrapFixture, public apitest::Footnote { public: - virtual void setUp() override; - void tearDown() override; + SwXFootnote(); Reference init() override; Reference getTextRange() override; Reference getTextContent() override; bool isAttachSupported() override { return true; } - Reference getTextDocument() { return mxTextDocument; } void triggerDesktopTerminate() override {} CPPUNIT_TEST_SUITE(SwXFootnote); @@ -76,38 +72,25 @@ public: CPPUNIT_TEST_SUITE_END(); private: - Reference mxTextDocument; Reference mxTextRange; Reference mxTextContent; }; -void SwXFootnote::setUp() +SwXFootnote::SwXFootnote() + : UnoApiTest(u""_ustr) { - test::BootstrapFixture::setUp(); - - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxTextDocument = Reference( - loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr), - uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(mxTextDocument.is()); -} - -void SwXFootnote::tearDown() -{ - if (mxTextDocument.is()) - mxTextDocument->dispose(); - - test::BootstrapFixture::tearDown(); } Reference SwXFootnote::init() { - Reference xMSF(mxTextDocument, UNO_QUERY_THROW); - + mxComponent + = loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr); + Reference xTextDocument(mxComponent, UNO_QUERY_THROW); + Reference xMSF(mxComponent, UNO_QUERY_THROW); Reference xFootnote(xMSF->createInstance(u"com.sun.star.text.Footnote"_ustr), UNO_QUERY_THROW); - Reference xText = getTextDocument()->getText(); + Reference xText = xTextDocument->getText(); Reference xCursor = xText->createTextCursor(); xText->insertTextContent(xCursor, xFootnote, false); diff --git a/sw/qa/api/SwXFootnoteProperties.cxx b/sw/qa/api/SwXFootnoteProperties.cxx index 69e58b4fca7e..a7572fa573ab 100644 --- a/sw/qa/api/SwXFootnoteProperties.cxx +++ b/sw/qa/api/SwXFootnoteProperties.cxx @@ -7,10 +7,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include #include #include -#include #include @@ -31,52 +30,32 @@ namespace /** * Initial tests for SwXFootnoteProperties. */ -class SwXFootnoteProperties final : public test::BootstrapFixture, - public unotest::MacrosTest, +class SwXFootnoteProperties final : public UnoApiTest, public apitest::XElementAccess, public apitest::XIndexAccess { public: SwXFootnoteProperties(); - virtual void setUp() override; - void tearDown() override; Reference init() override; CPPUNIT_TEST_SUITE(SwXFootnoteProperties); CPPUNIT_TEST_SUITE_END(); - -private: - uno::Reference component_; }; SwXFootnoteProperties::SwXFootnoteProperties() - : XElementAccess(cppu::UnoType::get()) + : UnoApiTest(u""_ustr) + , XElementAccess(cppu::UnoType::get()) , XIndexAccess(3) { } -void SwXFootnoteProperties::setUp() -{ - test::BootstrapFixture::setUp(); - mxDesktop.set( - frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()))); -} - -void SwXFootnoteProperties::tearDown() -{ - if (component_.is()) - component_->dispose(); - - test::BootstrapFixture::tearDown(); -} - Reference SwXFootnoteProperties::init() { - component_ + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr); - Reference xTextDocument(component_, UNO_QUERY_THROW); - Reference xMSF(component_, UNO_QUERY_THROW); + Reference xTextDocument(mxComponent, UNO_QUERY_THROW); + Reference xMSF(mxComponent, UNO_QUERY_THROW); Reference xFootnote(xMSF->createInstance(u"com.sun.star.text.Footnote"_ustr), UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXFootnoteText.cxx b/sw/qa/api/SwXFootnoteText.cxx index 14eb0c510139..d552aa386ba3 100644 --- a/sw/qa/api/SwXFootnoteText.cxx +++ b/sw/qa/api/SwXFootnoteText.cxx @@ -7,14 +7,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include #include #include #include #include #include #include -#include #include @@ -35,8 +34,7 @@ namespace /** * Initial tests for SwXFootnoteText. */ -class SwXFootnoteText final : public test::BootstrapFixture, - public unotest::MacrosTest, +class SwXFootnoteText final : public UnoApiTest, public apitest::XElementAccess, public apitest::XSimpleText, public apitest::XTextRange, @@ -46,8 +44,6 @@ class SwXFootnoteText final : public test::BootstrapFixture, { public: SwXFootnoteText(); - virtual void setUp() override; - void tearDown() override; Reference init() override; Reference getTextContent() override { return mxTextContent; }; @@ -70,36 +66,21 @@ public: CPPUNIT_TEST_SUITE_END(); private: - Reference component_; Reference mxTextContent; }; SwXFootnoteText::SwXFootnoteText() - : XElementAccess(cppu::UnoType::get()) + : UnoApiTest(u""_ustr) + , XElementAccess(cppu::UnoType::get()) { } -void SwXFootnoteText::setUp() -{ - test::BootstrapFixture::setUp(); - mxDesktop.set( - frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()))); -} - -void SwXFootnoteText::tearDown() -{ - if (component_.is()) - component_->dispose(); - - test::BootstrapFixture::tearDown(); -} - Reference SwXFootnoteText::init() { - component_ + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr); - Reference xTextDocument(component_, UNO_QUERY_THROW); - Reference xMSF(component_, UNO_QUERY_THROW); + Reference xTextDocument(mxComponent, UNO_QUERY_THROW); + Reference xMSF(mxComponent, UNO_QUERY_THROW); Reference xFootnote(xMSF->createInstance(u"com.sun.star.text.Footnote"_ustr), UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXFootnotes.cxx b/sw/qa/api/SwXFootnotes.cxx index 2d8f99aafed8..fae9d6938587 100644 --- a/sw/qa/api/SwXFootnotes.cxx +++ b/sw/qa/api/SwXFootnotes.cxx @@ -42,16 +42,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXFrames.cxx b/sw/qa/api/SwXFrames.cxx index 4cf72b9d42dc..b9745d9af20a 100644 --- a/sw/qa/api/SwXFrames.cxx +++ b/sw/qa/api/SwXFrames.cxx @@ -43,16 +43,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXHeadFootText.cxx b/sw/qa/api/SwXHeadFootText.cxx index 6c873aef66bf..3059af980b33 100644 --- a/sw/qa/api/SwXHeadFootText.cxx +++ b/sw/qa/api/SwXHeadFootText.cxx @@ -7,14 +7,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include #include #include #include #include #include #include -#include #include @@ -37,8 +36,7 @@ namespace /** * Initial tests for SwXHeadFootText. */ -class SwXHeadFootText final : public test::BootstrapFixture, - public unotest::MacrosTest, +class SwXHeadFootText final : public UnoApiTest, public apitest::XElementAccess, public apitest::XSimpleText, public apitest::XTextRange, @@ -48,8 +46,6 @@ class SwXHeadFootText final : public test::BootstrapFixture, { public: SwXHeadFootText(); - virtual void setUp() override; - void tearDown() override; Reference init() override; Reference getTextContent() override { return mxTextContent; }; @@ -72,36 +68,21 @@ public: CPPUNIT_TEST_SUITE_END(); private: - Reference component_; Reference mxTextContent; }; SwXHeadFootText::SwXHeadFootText() - : XElementAccess(cppu::UnoType::get()) + : UnoApiTest(u""_ustr) + , XElementAccess(cppu::UnoType::get()) { } -void SwXHeadFootText::setUp() -{ - test::BootstrapFixture::setUp(); - mxDesktop.set( - frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()))); -} - -void SwXHeadFootText::tearDown() -{ - if (component_.is()) - component_->dispose(); - - test::BootstrapFixture::tearDown(); -} - Reference SwXHeadFootText::init() { - component_ + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr); - Reference xTextDocument(component_, UNO_QUERY_THROW); - Reference xMSF(component_, UNO_QUERY_THROW); + Reference xTextDocument(mxComponent, UNO_QUERY_THROW); + Reference xMSF(mxComponent, UNO_QUERY_THROW); Reference xStyleFam(xTextDocument, UNO_QUERY_THROW); Reference xStyleFamNames = xStyleFam->getStyleFamilies(); diff --git a/sw/qa/api/SwXNumberingRules.cxx b/sw/qa/api/SwXNumberingRules.cxx index 67de5660e4ca..aecc71c9022f 100644 --- a/sw/qa/api/SwXNumberingRules.cxx +++ b/sw/qa/api/SwXNumberingRules.cxx @@ -49,16 +49,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xIndexAccess; diff --git a/sw/qa/api/SwXParagraphEnumeration.cxx b/sw/qa/api/SwXParagraphEnumeration.cxx index f1dbac6c7ea4..e3a2b3d45e92 100644 --- a/sw/qa/api/SwXParagraphEnumeration.cxx +++ b/sw/qa/api/SwXParagraphEnumeration.cxx @@ -39,16 +39,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXReferenceMark.cxx b/sw/qa/api/SwXReferenceMark.cxx index 7cfb8e598622..0f56a07c29ee 100644 --- a/sw/qa/api/SwXReferenceMark.cxx +++ b/sw/qa/api/SwXReferenceMark.cxx @@ -41,16 +41,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXReferenceMarks.cxx b/sw/qa/api/SwXReferenceMarks.cxx index 22747741c72f..d359f7cdddf3 100644 --- a/sw/qa/api/SwXReferenceMarks.cxx +++ b/sw/qa/api/SwXReferenceMarks.cxx @@ -45,16 +45,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(xTextDocument, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXStyleFamilies.cxx b/sw/qa/api/SwXStyleFamilies.cxx index f5f959cd77cc..6928896a430b 100644 --- a/sw/qa/api/SwXStyleFamilies.cxx +++ b/sw/qa/api/SwXStyleFamilies.cxx @@ -45,16 +45,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXTableCellText.cxx b/sw/qa/api/SwXTableCellText.cxx index 0f698b37154a..6ac75ab2ac70 100644 --- a/sw/qa/api/SwXTableCellText.cxx +++ b/sw/qa/api/SwXTableCellText.cxx @@ -46,16 +46,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXTextEmbeddedObjects.cxx b/sw/qa/api/SwXTextEmbeddedObjects.cxx index 36afea6ca1dc..27ee002c4a72 100644 --- a/sw/qa/api/SwXTextEmbeddedObjects.cxx +++ b/sw/qa/api/SwXTextEmbeddedObjects.cxx @@ -48,16 +48,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXTextField.cxx b/sw/qa/api/SwXTextField.cxx index 2cc708380da0..c02de9f134cb 100644 --- a/sw/qa/api/SwXTextField.cxx +++ b/sw/qa/api/SwXTextField.cxx @@ -51,16 +51,10 @@ struct SwXTextField final : public UnoApiTest, { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXTextFieldMasters.cxx b/sw/qa/api/SwXTextFieldMasters.cxx index ae233d595f51..fb07a53933e3 100644 --- a/sw/qa/api/SwXTextFieldMasters.cxx +++ b/sw/qa/api/SwXTextFieldMasters.cxx @@ -42,16 +42,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xTFS; diff --git a/sw/qa/api/SwXTextFieldTypes.cxx b/sw/qa/api/SwXTextFieldTypes.cxx index d95b2ed85691..6ac1cad4749a 100644 --- a/sw/qa/api/SwXTextFieldTypes.cxx +++ b/sw/qa/api/SwXTextFieldTypes.cxx @@ -42,19 +42,11 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { - component_ = loadFromDesktop(u"private:factory/swriter"_ustr, - u"com.sun.star.text.TextDocument"_ustr); - Reference xTextDocument(component_, UNO_QUERY_THROW); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); + Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xTFS; @@ -75,9 +67,6 @@ public: CPPUNIT_TEST(testCreateEnumeration); CPPUNIT_TEST(testRefreshListener); CPPUNIT_TEST_SUITE_END(); - -private: - Reference component_; }; CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextFieldTypes); diff --git a/sw/qa/api/SwXTextFrame.cxx b/sw/qa/api/SwXTextFrame.cxx index 44d316037f4f..970011d64aef 100644 --- a/sw/qa/api/SwXTextFrame.cxx +++ b/sw/qa/api/SwXTextFrame.cxx @@ -36,16 +36,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - uno::Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); uno::Reference xMSF(mxComponent, uno::UNO_QUERY_THROW); uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY_THROW); uno::Reference xTextFrame( diff --git a/sw/qa/api/SwXTextSections.cxx b/sw/qa/api/SwXTextSections.cxx index b81f43866713..60502dfcc801 100644 --- a/sw/qa/api/SwXTextSections.cxx +++ b/sw/qa/api/SwXTextSections.cxx @@ -46,16 +46,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/api/SwXTextTable.cxx b/sw/qa/api/SwXTextTable.cxx index f682789b4d1c..c0bd7226de56 100644 --- a/sw/qa/api/SwXTextTable.cxx +++ b/sw/qa/api/SwXTextTable.cxx @@ -7,9 +7,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include +#include #include -#include #include #include @@ -29,12 +28,9 @@ namespace /** * Initial tests for SwXTextTable. */ -struct SwXTextTable final : public test::BootstrapFixture, - public unotest::MacrosTest, - public apitest::XComponent +struct SwXTextTable final : public UnoApiTest, public apitest::XComponent { - virtual void setUp() override; - void tearDown() override; + SwXTextTable(); Reference init() override; void triggerDesktopTerminate() override; @@ -43,34 +39,21 @@ struct SwXTextTable final : public test::BootstrapFixture, CPPUNIT_TEST(testAddEventListener); CPPUNIT_TEST(testRemoveEventListener); CPPUNIT_TEST_SUITE_END(); - -private: - css::uno::Reference component_; }; -void SwXTextTable::setUp() +SwXTextTable::SwXTextTable() + : UnoApiTest(u""_ustr) { - test::BootstrapFixture::setUp(); - mxDesktop.set( - frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()))); -} - -void SwXTextTable::tearDown() -{ - if (component_.is()) - { - component_->dispose(); - } } void SwXTextTable::triggerDesktopTerminate() { mxDesktop->terminate(); } Reference SwXTextTable::init() { - component_ + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, u"com.sun.star.text.TextDocument"_ustr); - Reference xTextDocument(component_, UNO_QUERY_THROW); - Reference xMSF(component_, UNO_QUERY_THROW); + Reference xTextDocument(mxComponent, UNO_QUERY_THROW); + Reference xMSF(mxComponent, UNO_QUERY_THROW); Reference xText = xTextDocument->getText(); Reference xCursor = xText->createTextCursor(); Reference xTable(xMSF->createInstance(u"com.sun.star.text.TextTable"_ustr), diff --git a/sw/qa/api/SwXTextTables.cxx b/sw/qa/api/SwXTextTables.cxx index d67e376729d4..d89546805170 100644 --- a/sw/qa/api/SwXTextTables.cxx +++ b/sw/qa/api/SwXTextTables.cxx @@ -43,16 +43,10 @@ public: { } - virtual void setUp() override - { - UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(mxComponentContext)); - mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); - CPPUNIT_ASSERT(mxComponent.is()); - } - Reference init() override { + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr, + u"com.sun.star.text.TextDocument"_ustr); Reference xTextDocument(mxComponent, UNO_QUERY_THROW); Reference xMSF(mxComponent, UNO_QUERY_THROW); diff --git a/sw/qa/extras/layout/data/tdf56408-ltr.fodt b/sw/qa/extras/layout/data/tdf56408-ltr.fodt new file mode 100644 index 000000000000..5ce76412c080 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf56408-ltr.fodt @@ -0,0 +1,129 @@ + + + Lior Kaplan2012-10-25T19:53:272024-07-08T03:20:20.348137955PT8M18S11LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/9452bf222f57094e3bb100c6b0b9655d9f327737 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + English English English ((((עברית)))) English + + + \ No newline at end of file diff --git a/sw/qa/extras/layout/data/tdf56408-no-underflow.fodt b/sw/qa/extras/layout/data/tdf56408-no-underflow.fodt new file mode 100644 index 000000000000..7ef7ebf605d5 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf56408-no-underflow.fodt @@ -0,0 +1,123 @@ + + + Lior Kaplan2012-10-25T19:53:272024-07-08T03:21:06.304537073PT8M42S11LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/9452bf222f57094e3bb100c6b0b9655d9f327737 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + English English English עברית English + + + \ No newline at end of file diff --git a/sw/qa/extras/layout/data/tdf56408-rtl.fodt b/sw/qa/extras/layout/data/tdf56408-rtl.fodt new file mode 100644 index 000000000000..e68774befc5f --- /dev/null +++ b/sw/qa/extras/layout/data/tdf56408-rtl.fodt @@ -0,0 +1,125 @@ + + + Lior Kaplan2012-10-25T19:53:272024-07-08T03:38:49.126947456PT11M10S13LibreOffice/24.2.4.2$Linux_X86_64 LibreOffice_project/d29029bfb700ea4a272da1366c5f5e7c14e351b5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + עברית עברית עברית ((((English)))) עברית + + + \ No newline at end of file diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 3ee4953e52cc..d10e0c78a2f7 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -3037,6 +3037,50 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf104209VertRTL) "portion"_ostr, u"B"_ustr); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf56408LTR) +{ + // Verify that line breaking a first bidi portion correctly underflows in LTR text + createSwDoc("tdf56408-ltr.fodt"); + auto pXmlDoc = parseLayoutDump(); + + assertXPath(pXmlDoc, "//page"_ostr, 1); + + assertXPath(pXmlDoc, "/root/page/body/txt/SwParaPortion/SwLineLayout[1]"_ostr, "portion"_ostr, + u"English English English "_ustr); + assertXPath(pXmlDoc, "/root/page/body/txt/SwParaPortion/SwLineLayout[2]"_ostr, "portion"_ostr, + u"((((עברית)))) English"_ustr); +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf56408RTL) +{ + // Verify that line breaking a first bidi portion correctly underflows in RTL text + createSwDoc("tdf56408-rtl.fodt"); + auto pXmlDoc = parseLayoutDump(); + + assertXPath(pXmlDoc, "//page"_ostr, 1); + + assertXPath(pXmlDoc, "/root/page/body/txt/SwParaPortion/SwLineLayout[1]"_ostr, "portion"_ostr, + u"עברית עברית עברית "_ustr); + assertXPath(pXmlDoc, "/root/page/body/txt/SwParaPortion/SwLineLayout[2]"_ostr, "portion"_ostr, + u"((((English)))) עברית"_ustr); +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, TestTdf56408NoUnderflow) +{ + // The fix for tdf#56408 introduced a change to line breaking between text with + // direction changes. This test verifies behavior in the trivial case, when a + // break opportunity exists at the direction change boundary. + createSwDoc("tdf56408-no-underflow.fodt"); + auto pXmlDoc = parseLayoutDump(); + + assertXPath(pXmlDoc, "//page"_ostr, 1); + + assertXPath(pXmlDoc, "/root/page/body/txt/SwParaPortion/SwLineLayout[1]"_ostr, "portion"_ostr, + u"English English English "_ustr); + assertXPath(pXmlDoc, "/root/page/body/txt/SwParaPortion/SwLineLayout[2]"_ostr, "portion"_ostr, + u"עברית English"_ustr); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 2cd9e7f888a5..31529eeb9b10 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -2432,7 +2432,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf133477) // Save the shape to a BMP. uno::Reference xGraphicExporter - = drawing::GraphicExportFilter::create(mxComponentContext); + = drawing::GraphicExportFilter::create(m_xContext); uno::Reference xSourceDoc(getShape(1), uno::UNO_QUERY); xGraphicExporter->setSourceDocument(xSourceDoc); diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx index 9a1d9bca8b4f..9a1b919c0cc8 100644 --- a/sw/qa/filter/ww8/ww8.cxx +++ b/sw/qa/filter/ww8/ww8.cxx @@ -14,6 +14,8 @@ #include #include +#include + #include #include #include @@ -598,6 +600,48 @@ CPPUNIT_TEST_FIXTURE(Test, testEndnotesAtSectEnd) // i.e. the default position was used: document end. CPPUNIT_ASSERT_EQUAL(u"sectEnd"_ustr, aPos); } + +CPPUNIT_TEST_FIXTURE(Test, testContentControlPDFDropDownEmptyItem) +{ + // Given a document with a dropdown content control, one item is empty, which can't be saved to + // a valid DOCX: + createSwDoc(); + uno::Reference xMSF(mxComponent, uno::UNO_QUERY); + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xText = xTextDocument->getText(); + uno::Reference xCursor = xText->createTextCursor(); + xText->insertString(xCursor, u"test"_ustr, /*bAbsorb=*/false); + xCursor->gotoStart(/*bExpand=*/false); + xCursor->gotoEnd(/*bExpand=*/true); + uno::Reference xContentControl( + xMSF->createInstance(u"com.sun.star.text.ContentControl"_ustr), uno::UNO_QUERY); + uno::Reference xContentControlProps(xContentControl, uno::UNO_QUERY); + { + uno::Sequence aListItems = { + { + comphelper::makePropertyValue(u"DisplayText"_ustr, uno::Any(u"red"_ustr)), + comphelper::makePropertyValue(u"Value"_ustr, uno::Any(u"R"_ustr)), + }, + { + comphelper::makePropertyValue(u"DisplayText"_ustr, uno::Any(u""_ustr)), + comphelper::makePropertyValue(u"Value"_ustr, uno::Any(u""_ustr)), + }, + }; + xContentControlProps->setPropertyValue(u"ListItems"_ustr, uno::Any(aListItems)); + } + xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true); + + // When saving to DOCX: + save(u"Office Open XML Text"_ustr); + + // Then make sure we only emit 1 list item: + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 2 + // i.e. we emitted an empty list item, so the result can't be opened in Word. + assertXPath(pXmlDoc, "//w:dropDownList/w:listItem"_ostr, 1); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/uitest/data/tdf159102.fodt b/sw/qa/uitest/data/tdf159102.fodt index dfe9fc18872b..7ef0765170bb 100644 --- a/sw/qa/uitest/data/tdf159102.fodt +++ b/sw/qa/uitest/data/tdf159102.fodt @@ -1,20 +1,149 @@ + LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/0e3394f7123b6d63b91c1c55f227253f21cba343 + + 0 + 0 + 0 + 0 + true + false + - true + false + true + true + + false + 0 + false + true + false + true + false + true + 0 + true + false + false + false + true + false + true + false + false + false + false + true + true + false + false + false + false + false + false + false + true + false + false + false + false + false + false high-resolution + true + 1428728 + false + false + false + + + true + + false + false + false + true + true + true + false + 0 + true + false + true + false + true + false + false + true + true + false + false + false + false + true + true + true + + false + false + true + 0 + false + true + + false + false + true + true + false + false + false + 1 + true + true + true + false + false + true + false + false + true + false + true + false + false + + true + 1428728 + true + false + false + true + + + + + + + + + + + + - - + + @@ -23,8 +152,8 @@ - - + + @@ -33,29 +162,29 @@ - + - - - - + - - + + + + + - venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cursus egestas. - venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cursus egestas. + venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cursus egestas. + venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cursus egestas. diff --git a/sw/qa/uitest/data/tdf160170.fodt b/sw/qa/uitest/data/tdf160170.fodt new file mode 100644 index 000000000000..7b0a06d76f7b --- /dev/null +++ b/sw/qa/uitest/data/tdf160170.fodt @@ -0,0 +1,205 @@ + + + + 2024-07-01T14:21:09hu-HU2024-07-01T16:51:14.3614127733PT10M3SLibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/0e3394f7123b6d63b91c1c55f227253f21cba34315.0000 + + + 0 + 0 + 23481 + 10659 + true + false + + + view2 + 7895 + 2988 + 0 + 0 + 23479 + 10657 + 0 + 1 + false + 214 + false + false + false + false + false + false + + + + + false + true + true + + false + 0 + false + true + true + true + true + false + 0 + true + false + true + true + false + true + true + true + true + true + false + true + true + false + true + false + false + true + true + true + true + true + false + false + false + true + true + high-resolution + true + 1327917 + false + true + false + + + true + + true + false + true + true + true + false + false + 0 + true + false + false + true + true + true + true + true + true + false + true + false + true + true + true + false + true + HP-LaserJet-P1005 + true + false + false + 0 + false + true + 4gH+/0hQLUxhc2VySmV0LVAxMDA1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ1VQUzpIUC1MYXNlckpldC1QMTAwNQAAAAAAAAAAAAAWAAMAvQAAAAAAAQAEAAhSAAAEdAAASm9iRGF0YSAxCnByaW50ZXI9SFAtTGFzZXJKZXQtUDEwMDUKb3JpZW50YXRpb249UG9ydHJhaXQKY29waWVzPTEKY29sbGF0ZT1mYWxzZQptYXJnaW5hZGp1c3RtZW50PTAsMCwnMCwwCmNvbG9yZGVwdGg9MjQKY29sb3JkZXZpY2U9MApQUERDb250ZXh0RGF0YQpQYWdlU2l6ZTpBNABJbnB1dFNsb3Q6QXV0bwBEdXBsZXg6Tm9uZQAAEgBDT01QQVRfRFVQTEVYX01PREUPAER1cGxleE1vZGU6Ok9mZgwAUFJJTlRFUl9OQU1FEQBIUC1MYXNlckpldC1QMTAwNQsARFJJVkVSX05BTUUWAENVUFM6SFAtTGFzZXJKZXQtUDEwMDU= + false + false + true + true + true + false + true + 1 + false + false + false + true + false + false + true + true + false + true + false + true + false + + false + 1400376 + true + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + placerat mauris enim, nec rutrum purus semper vel. Praesent tincidunt neque eu pellentesque pharetra. Fusce pellentesque est orci. + + + diff --git a/sw/qa/uitest/writer_tests8/tdf159102.py b/sw/qa/uitest/writer_tests8/tdf159102.py index aee1a0cc405c..e5e50dd6f698 100644 --- a/sw/qa/uitest/writer_tests8/tdf159102.py +++ b/sw/qa/uitest/writer_tests8/tdf159102.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 +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.linguistic.linguservice import get_lingu_service_manager @@ -71,19 +71,19 @@ class tdf159102(UITestCase): if not supported_locale: self.skipTest("no hyphenation patterns for en_US available") -# disabling this because it fails on some machines -# xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') -# with self.ui_test.load_file(get_url_for_data_file("tdf159102.fodt")) as writer_doc: -# # we must not depend on the installed hyphenation patterns, -# # so extend user dictionary temporarily with the hyphenation cur=sus and ege=stas -# self.set_custom_hyphenation() -# xToolkit.processEventsToIdle() -# # delete the text of the first line -# self.xUITest.executeCommand(".uno:GoToEndOfLine") -# self.xUITest.executeCommand('.uno:StartOfDocumentSel') -# self.xUITest.executeCommand('.uno:Delete') -# paragraphs = writer_doc.Text.createEnumeration() -# para1 = paragraphs.nextElement() + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + with self.ui_test.load_file(get_url_for_data_file("tdf159102.fodt")) as writer_doc: + # we must not depend on the installed hyphenation patterns, + # so extend user dictionary temporarily with the hyphenation cur=sus and ege=stas + self.set_custom_hyphenation() + xToolkit.processEventsToIdle() + # delete the text of the first line + self.xUITest.executeCommand(".uno:GoToEndOfLine") + self.xUITest.executeCommand('.uno:StartOfDocumentSel') + self.xUITest.executeCommand('.uno:Delete') + paragraphs = writer_doc.Text.createEnumeration() + para1 = paragraphs.nextElement() +# disable UITest that fails reliably # # This was "stas.", i.e. too much shrinking # self.assertEqual("sus egestas.", para1.String) # diff --git a/sw/qa/uitest/writer_tests8/tdf160170.py b/sw/qa/uitest/writer_tests8/tdf160170.py new file mode 100644 index 000000000000..69ead0d5b52e --- /dev/null +++ b/sw/qa/uitest/writer_tests8/tdf160170.py @@ -0,0 +1,85 @@ +# -*- 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_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.linguistic.linguservice import get_lingu_service_manager + +# handle tdf#160170 overshrank lines with smart justify and hyphenation + +class tdf160170(UITestCase): + def is_supported_locale(self, language, country): + xLinguServiceManager = get_lingu_service_manager(self.ui_test._xContext) + xHyphenator = xLinguServiceManager.getHyphenator() + locales = xHyphenator.getLocales() + for locale in locales: + if language != None: + if locale.Language != language: + continue + + if country != None: + if locale.Country != country: + continue + + # we found the correct combination + return True + + def set_custom_hyphenation(self): + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + + xPages = xDialog.getChild("pages") + xLanguageEntry = xPages.getChild('2') # Language Settings + xLanguageEntry.executeAction("EXPAND", tuple()) + xxLanguageEntryWritingAidsEntry = xLanguageEntry.getChild('1') + xxLanguageEntryWritingAidsEntry.executeAction("SELECT", tuple()) # Writing Aids + + # add hyphenation "phare=tra" to the custom dictionary + # to solve the non-accessible hyphenation patterns for the test + + # Select an editable dictionary (list of Ignored words) + dictionaries = xDialog.getChild("lingudicts") + hasEditableDictionary = False + for i in dictionaries.getChildren(): + entry = dictionaries.getChild(i) + entry_label = get_state_as_dict(entry)["Text"] + if entry_label == "List of Ignored Words [All]": + hasEditableDictionary = True + entry.executeAction("SELECT", tuple()) # an editable user dictionary + break + + self.assertEqual(True, hasEditableDictionary) + + # open Edit dialog window + edit = xDialog.getChild("lingudictsedit") + with self.ui_test.execute_blocking_action(edit.executeAction, args=('CLICK', ()), close_button="close") as xEdit: + # write phare=tra into the input box + inputbox = xEdit.getChild("word") + inputbox.executeAction("TYPE", mkPropertyValues({"TEXT": "phare=tra"})) + add = xEdit.getChild("newreplace") + add.executeAction("CLICK", tuple()) + + def test_tdf160170(self): + supported_locale = self.is_supported_locale("en", "US") + if not supported_locale: + self.skipTest("no hyphenation patterns for en_US available") + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + with self.ui_test.load_file(get_url_for_data_file("tdf160170.fodt")) as writer_doc: + # we must not depend on the installed hyphenation patterns, + # so extend user dictionary temporarily with the hyphenation phare=tra + self.set_custom_hyphenation() + xToolkit.processEventsToIdle() + # delete the text of the first line + self.xUITest.executeCommand(".uno:GoToEndOfLine") + self.xUITest.executeCommand('.uno:StartOfDocumentSel') + self.xUITest.executeCommand('.uno:Delete') + paragraphs = writer_doc.Text.createEnumeration() + para1 = paragraphs.nextElement() + # This was " pellentesque est orvi.", i.e. too much shrinking + self.assertEqual(" Fusce pellentesque est orci.", para1.String) diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 4be4a5feb4a2..64a1e622c272 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1525,8 +1525,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl( { PropertyValue rPropVal; rPropVal.Name = UNO_NAME_PARA_STYLE_NAME; - uno::Any aVal( uno::Any( pTextNode->GetTextColl()->GetName() ) ); - rPropVal.Value = aVal; + rPropVal.Value <<= pTextNode->GetTextColl()->GetName(); rPropVal.Handle = -1; rPropVal.State = beans::PropertyState_DEFAULT_VALUE; diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx index 67aaeee2518f..f0a32b89f7c6 100644 --- a/sw/source/core/attr/cellatr.cxx +++ b/sw/source/core/attr/cellatr.cxx @@ -38,7 +38,7 @@ SwTableBoxNumFormat::SwTableBoxNumFormat( sal_uInt32 nFormat ) : SfxUInt32Item( RES_BOXATR_FORMAT, (((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == getSwDefaultTextFormat()) ? - getSwDefaultTextFormat() : nFormat)) + getSwDefaultTextFormat() : nFormat), SfxItemType::SwTableBoxNumFormatType) { } diff --git a/sw/source/core/attr/formatflysplit.cxx b/sw/source/core/attr/formatflysplit.cxx index 6bcfd74390e1..76f8eb8ed451 100644 --- a/sw/source/core/attr/formatflysplit.cxx +++ b/sw/source/core/attr/formatflysplit.cxx @@ -22,7 +22,7 @@ #include SwFormatFlySplit::SwFormatFlySplit(bool bSplit) - : SfxBoolItem(RES_FLY_SPLIT, bSplit) + : SfxBoolItem(RES_FLY_SPLIT, bSplit, SfxItemType::SwFormatFlySplitType) { // Once this pool item is true, a floating table (text frame + table inside it) is meant to // split across multiple pages. diff --git a/sw/source/core/attr/formatwraptextatflystart.cxx b/sw/source/core/attr/formatwraptextatflystart.cxx index 88a17d5ade33..898a24c97f5c 100644 --- a/sw/source/core/attr/formatwraptextatflystart.cxx +++ b/sw/source/core/attr/formatwraptextatflystart.cxx @@ -22,7 +22,7 @@ #include SwFormatWrapTextAtFlyStart::SwFormatWrapTextAtFlyStart(bool bAtStart) - : SfxBoolItem(RES_WRAP_TEXT_AT_FLY_START, bAtStart) + : SfxBoolItem(RES_WRAP_TEXT_AT_FLY_START, bAtStart, SfxItemType::SwFormatWrapTextAtFlyStartType) { // Once this pool item is true, the text from the anchor text of the fly wraps an all pages, not // only on the last page of the fly chain. diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 055ab5fbabe2..1935d5612a58 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -206,7 +207,7 @@ void SwTextFormatColl::SwClientNotify(const SwModify& rModify, const SfxHint& rH pNewULSpace = &pNew->StaticWhichCast(RES_UL_SPACE); break; case RES_CHRATR_FONTSIZE: - aFontSizeArr[0] = &pNew->StaticWhichCast(RES_CHRATR_CJK_FONTSIZE); + aFontSizeArr[0] = &pNew->StaticWhichCast(RES_CHRATR_FONTSIZE); break; case RES_CHRATR_CJK_FONTSIZE: aFontSizeArr[1] = &pNew->StaticWhichCast(RES_CHRATR_CJK_FONTSIZE); @@ -379,6 +380,26 @@ void SwTextFormatColl::SwClientNotify(const SwModify& rModify, const SfxHint& rH } } + // If there are any attributes in addition to the special ones already handled, then notify... + if (!bContinue && pNewChgSet && pNewChgSet->GetChgSet()) + { + SfxItemIter aIter(*pNewChgSet->GetChgSet()); + for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem()) + { + const sal_uInt16 nWhich = pItem->Which(); + if (nWhich == RES_CHRATR_FONTSIZE || nWhich == RES_CHRATR_CTL_FONTSIZE + || nWhich == RES_CHRATR_CJK_FONTSIZE || nWhich == RES_UL_SPACE + || nWhich == RES_MARGIN_TEXTLEFT || nWhich == RES_MARGIN_RIGHT + || nWhich == RES_MARGIN_FIRSTLINE) + { + continue; // already considered for bContinue + } + + bContinue = true; + break; // only one new condition needed to notify that this style has changes + } + } + if( bContinue ) SwFormatColl::SwClientNotify(rModify, rHint); } diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index e05d4fb10fe4..119bfdf8c614 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -277,7 +277,12 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 nFlag, SdrObject *pObj ) { // tolerance limit of Drawing-SS const auto nHdlSizePixel = Imp()->GetDrawView()->GetMarkHdlSizePixel(); - const short nMinMove = static_cast(GetOut()->PixelToLogic(Size(nHdlSizePixel/2, 0)).Width()); + short nMinMove; + if (comphelper::LibreOfficeKit::isActive()) + nMinMove = static_cast(OutputDevice::LogicToLogic(Size(nHdlSizePixel/2,0), MapMode(MapUnit::MapPixel), GetOut()->GetMapMode()).Width()); + else + nMinMove = static_cast(GetOut()->PixelToLogic(Size(nHdlSizePixel/2, 0)).Width()); + pDView->MarkObj( rPt, nMinMove, bAddSelect, bEnterGroup ); } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 8c44f2ac893b..7b89676e7b9c 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -216,32 +216,23 @@ static void lcl_DelHFFormat( SwClient *pToRemove, SwFrameFormat *pFormat ) delete pFormat; } -namespace +bool SwFormatFrameSize::isHashable() const { - class SwFormatFrameSizeInstanceManager : public TypeSpecificItemInstanceManager - { - protected: - virtual size_t hashCode(const SfxPoolItem& rItem) const override - { - auto const & rFormatItem = static_cast(rItem); - std::size_t seed(0); - o3tl::hash_combine(seed, rFormatItem.GetHeightSizeType()); - o3tl::hash_combine(seed, rFormatItem.GetWidthSizeType()); - o3tl::hash_combine(seed, rFormatItem.GetWidthPercent()); - o3tl::hash_combine(seed, rFormatItem.GetWidthPercentRelation()); - o3tl::hash_combine(seed, rFormatItem.GetHeightPercent()); - o3tl::hash_combine(seed, rFormatItem.GetHeightPercentRelation()); - o3tl::hash_combine(seed, rFormatItem.GetSize().Width()); - o3tl::hash_combine(seed, rFormatItem.GetSize().Height()); - return seed; - } - }; + return true; } -ItemInstanceManager* SwFormatFrameSize::getItemInstanceManager() const +size_t SwFormatFrameSize::hashCode() const { - static SwFormatFrameSizeInstanceManager aInstanceManager; - return &aInstanceManager; + std::size_t seed(0); + o3tl::hash_combine(seed, GetHeightSizeType()); + o3tl::hash_combine(seed, GetWidthSizeType()); + o3tl::hash_combine(seed, GetWidthPercent()); + o3tl::hash_combine(seed, GetWidthPercentRelation()); + o3tl::hash_combine(seed, GetHeightPercent()); + o3tl::hash_combine(seed, GetHeightPercentRelation()); + o3tl::hash_combine(seed, GetSize().Width()); + o3tl::hash_combine(seed, GetSize().Height()); + return seed; } void SwFormatFrameSize::ScaleMetrics(tools::Long lMult, tools::Long lDiv) { @@ -260,7 +251,7 @@ bool SwFormatFrameSize::HasMetrics() const { // Partially implemented inline in hxx SwFormatFrameSize::SwFormatFrameSize( SwFrameSize eSize, SwTwips nWidth, SwTwips nHeight ) - : SvxSizeItem( RES_FRM_SIZE, {nWidth, nHeight} ), + : SvxSizeItem( RES_FRM_SIZE, {nWidth, nHeight}, SfxItemType::SwFormatFrameSizeType ), m_eFrameHeightType( eSize ), m_eFrameWidthType( SwFrameSize::Fixed ) { @@ -341,6 +332,7 @@ bool SwFormatFrameSize::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; bool bRet = true; @@ -1403,27 +1395,18 @@ void SwFormatSurround::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterEndElement(pWriter); } -namespace +bool SwFormatVertOrient::isHashable() const { - class SwFormatVertOrientInstanceManager : public TypeSpecificItemInstanceManager - { - protected: - virtual size_t hashCode(const SfxPoolItem& rItem) const override - { - auto const & rFormatItem = static_cast(rItem); - std::size_t seed(0); - o3tl::hash_combine(seed, rFormatItem.GetPos()); - o3tl::hash_combine(seed, rFormatItem.GetVertOrient()); - o3tl::hash_combine(seed, rFormatItem.GetRelationOrient()); - return seed; - } - }; + return true; } -ItemInstanceManager* SwFormatVertOrient::getItemInstanceManager() const +size_t SwFormatVertOrient::hashCode() const { - static SwFormatVertOrientInstanceManager aInstanceManager; - return &aInstanceManager; + std::size_t seed(0); + o3tl::hash_combine(seed, GetPos()); + o3tl::hash_combine(seed, GetVertOrient()); + o3tl::hash_combine(seed, GetRelationOrient()); + return seed; } // Partially implemented inline in hxx @@ -1518,28 +1501,19 @@ void SwFormatVertOrient::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterEndElement(pWriter); } -namespace +bool SwFormatHoriOrient::isHashable() const { - class SwFormatHoriOrientInstanceManager : public TypeSpecificItemInstanceManager - { - protected: - virtual size_t hashCode(const SfxPoolItem& rItem) const override - { - auto const & rFormatItem = static_cast(rItem); - std::size_t seed(0); - o3tl::hash_combine(seed, rFormatItem.GetPos()); - o3tl::hash_combine(seed, rFormatItem.GetHoriOrient()); - o3tl::hash_combine(seed, rFormatItem.GetRelationOrient()); - o3tl::hash_combine(seed, rFormatItem.IsPosToggle()); - return seed; - } - }; + return true; } -ItemInstanceManager* SwFormatHoriOrient::getItemInstanceManager() const +size_t SwFormatHoriOrient::hashCode() const { - static SwFormatHoriOrientInstanceManager aInstanceManager; - return &aInstanceManager; + std::size_t seed(0); + o3tl::hash_combine(seed, GetPos()); + o3tl::hash_combine(seed, GetHoriOrient()); + o3tl::hash_combine(seed, GetRelationOrient()); + o3tl::hash_combine(seed, IsPosToggle()); + return seed; } // Partially implemented inline in hxx @@ -1596,6 +1570,7 @@ bool SwFormatHoriOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SwFormatHoriOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; bool bRet = true; diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx index 0cffb932c57e..98e80499e44d 100644 --- a/sw/source/core/para/paratr.cxx +++ b/sw/source/core/para/paratr.cxx @@ -185,6 +185,12 @@ SwNumRuleItem* SwNumRuleItem::Clone( SfxItemPool * ) const return new SwNumRuleItem( *this ); } +// hashCode is defined in CntUnencodedStringItem +bool SwNumRuleItem::isHashable() const +{ + return true; +} + bool SwNumRuleItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 61a6ab8d413d..9816adacea7d 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -765,10 +765,18 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) if ( bPlacement ) { - eVal = vcl::PDFWriter::TableHeader == eType || - vcl::PDFWriter::TableData == eType ? - vcl::PDFWriter::Inline : - vcl::PDFWriter::Block; + bool bIsFigureInline = false; + if (vcl::PDFWriter::Figure == eType) + { + const SwFrame* pKeyFrame = static_cast(*pFrame).GetAnchorFrame(); + if (pKeyFrame->GetUpper()->GetType() == SwFrameType::Body) + bIsFigureInline = true; + } + + eVal = vcl::PDFWriter::TableHeader == eType || vcl::PDFWriter::TableData == eType + || bIsFigureInline + ? vcl::PDFWriter::Inline + : vcl::PDFWriter::Block; mpPDFExtOutDevData->SetStructureAttribute( vcl::PDFWriter::Placement, eVal ); } diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index df352e6aa785..e22ad78d44a1 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -32,6 +32,9 @@ #include #include #include +#include +#include +#include #include "pormulti.hxx" #include "inftxt.hxx" #include "itrpaint.hxx" @@ -1919,8 +1922,8 @@ static bool lcl_ExtractFieldFollow( SwLineLayout* pLine, SwLinePortion* &rpField // If a multi portion completely has to go to the // next line, this function is called to truncate // the rest of the remaining multi portion -static void lcl_TruncateMultiPortion( SwMultiPortion& rMulti, SwTextFormatInfo& rInf, - TextFrameIndex const nStartIdx) +static void lcl_TruncateMultiPortion(SwMultiPortion& rMulti, SwTextFormatInfo& rInf, + TextFrameIndex const nStartIdx, bool bIsBidiPortion) { rMulti.GetRoot().Truncate(); rMulti.GetRoot().SetLen(TextFrameIndex(0)); @@ -1935,6 +1938,31 @@ static void lcl_TruncateMultiPortion( SwMultiPortion& rMulti, SwTextFormatInfo& rMulti.Width( 0 ); rMulti.SetLen(TextFrameIndex(0)); rInf.SetIdx( nStartIdx ); + + if (bIsBidiPortion) + { + // The truncated portion is a bidi portion. Bidi portions contain ordinary text, and may + // potentially underflow in the case that none of the text fits on the current line. + if (auto* pPrevTextPor = dynamic_cast(rInf.GetLast()); + pPrevTextPor != nullptr) + { + // Check if the start of the bidi portion is a valid break. In that case, truncating + // the multi portion is sufficient. + css::i18n::LineBreakHyphenationOptions aHyphOptions; + css::i18n::LineBreakUserOptions aUserOptions; + css::lang::Locale aLocale; + auto aResult = g_pBreakIt->GetBreakIter()->getLineBreak( + rInf.GetText(), sal_Int32(nStartIdx), aLocale, sal_Int32(rInf.GetLineStart()), + aHyphOptions, aUserOptions); + + if (aResult.breakIndex != sal_Int32{ nStartIdx }) + { + // The start of the bidi portion is not a valid break. Instead, a break should be + // inserted into a previous text portion on this line. + rInf.SetUnderflow(pPrevTextPor); + } + } + } } // Manages the formatting of a SwMultiPortion. External, for the calling @@ -2345,7 +2373,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, else { // we try to keep our ruby portion together - lcl_TruncateMultiPortion( rMulti, rInf, nStartIdx ); + lcl_TruncateMultiPortion(rMulti, rInf, nStartIdx, /*bIsBidiPortion=*/false); pTmp = nullptr; // A follow field portion may still be waiting. If nobody wants // it, we delete it. @@ -2355,7 +2383,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, else if( rMulti.HasRotation() ) { // we try to keep our rotated portion together - lcl_TruncateMultiPortion( rMulti, rInf, nStartIdx ); + lcl_TruncateMultiPortion(rMulti, rInf, nStartIdx, /*bIsBidiPortion=*/false); pTmp = new SwRotatedPortion( nMultiLen + rInf.GetIdx(), rMulti.GetDirection() ); } @@ -2363,8 +2391,10 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, // a new SwBidiPortion, this would cause a memory leak else if( rMulti.IsBidi() && ! m_pMulti ) { - if ( ! rMulti.GetLen() ) - lcl_TruncateMultiPortion( rMulti, rInf, nStartIdx ); + if (!rMulti.GetLen()) + { + lcl_TruncateMultiPortion(rMulti, rInf, nStartIdx, /*bIsBidiPortion=*/true); + } // If there is a HolePortion at the end of the bidi portion, // it has to be moved behind the bidi portion. Otherwise diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx index f1dd3acc5b75..bf8751d6cea5 100644 --- a/sw/source/core/text/txthyph.cxx +++ b/sw/source/core/text/txthyph.cxx @@ -431,23 +431,26 @@ SwTwips SwSoftHyphPortion::GetViewWidth(const SwTextSizeInfo& rInf) const */ void SwSoftHyphPortion::Paint( const SwTextPaintInfo &rInf ) const { - if ( Width() && rInf.GetOpt().IsViewMetaChars()) + if ( Width() ) { rInf.DrawViewOpt( *this, PortionType::SoftHyphen ); SwExpandPortion::Paint( rInf ); - OUString aMarker = u"-"_ustr; - SwTextPaintInfo aInf(rInf, &aMarker); - SwTextPortion aMarkerPor; - SwPosSize aMarkerSize(rInf.GetTextSize(aMarker)); - aMarkerPor.Width(aMarkerSize.Width()); - aMarkerPor.Height(aMarkerSize.Height()); - aMarkerPor.SetAscent(GetAscent()); + if (rInf.GetOpt().IsViewMetaChars() && !rInf.GetOpt().IsPrinting()) + { + OUString aMarker = u"-"_ustr; + SwTextPaintInfo aInf(rInf, &aMarker); + SwTextPortion aMarkerPor; + SwPosSize aMarkerSize(rInf.GetTextSize(aMarker)); + aMarkerPor.Width(aMarkerSize.Width()); + aMarkerPor.Height(aMarkerSize.Height()); + aMarkerPor.SetAscent(GetAscent()); - Color colorBackup = aInf.GetFont()->GetColor(); - aInf.GetFont()->SetColor(NON_PRINTING_CHARACTER_COLOR); - aInf.DrawText(aMarkerPor, TextFrameIndex(aMarker.getLength()), true); - aInf.GetFont()->SetColor(colorBackup); + Color colorBackup = aInf.GetFont()->GetColor(); + aInf.GetFont()->SetColor(NON_PRINTING_CHARACTER_COLOR); + aInf.DrawText(aMarkerPor, TextFrameIndex(aMarker.getLength()), true); + aInf.GetFont()->SetColor(colorBackup); + } } } diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index 1838522b3bc0..2365c9b57156 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -50,7 +50,7 @@ struct SwUndoGroupObjImpl SwNodeOffset nNodeIdx; }; -// Draw-Objecte +// Draw-Object void SwDoc::AddDrawUndo( std::unique_ptr pUndo ) { diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index d85a90736866..db754dba86a4 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -1108,11 +1108,10 @@ SwXTextSection::Impl::GetPropertyValues_Impl( pRet[nProperty] <<= bRet; } break; - case FN_UNO_ANCHOR_TYPES: - case FN_UNO_TEXT_WRAP: - case FN_UNO_ANCHOR_TYPE: - ::sw::GetDefaultTextContentValue( - pRet[nProperty], u"", pEntry->nWID); + case FN_UNO_ANCHOR_TYPES: + case FN_UNO_TEXT_WRAP: + case FN_UNO_ANCHOR_TYPE: + (void)::sw::GetDefaultTextContentValue(pRet[nProperty], u"", pEntry->nWID); break; case FN_UNO_REDLINE_NODE_START: case FN_UNO_REDLINE_NODE_END: diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index f9ce9aa23b6e..fa442954a55f 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -2189,7 +2189,7 @@ rtl::Reference GetRangeByName( UnoActionRemoveContext aRemoveContext(rCursor); rCursor.MakeBoxSels(); // pUnoCursor will be provided and will not be deleted - return SwXCellRange::CreateXCellRange(pUnoCursor, *pFormat, rDesc); + return SwXCellRange::CreateXCellRange(std::move(pUnoCursor), *pFormat, rDesc); } } // namespace diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 7e055dccea28..e9d1707cc015 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -1744,7 +1744,7 @@ void SwHTMLParser::InsertInput() SvxCSS1PropertyInfo aCSS1PropInfo; if( HasStyleOptions( aStyle, aId, aClass ) ) { - ParseStyleOptions( aStyle, aId, aClass, aCSS1ItemSet, aCSS1PropInfo ); + (void)ParseStyleOptions(aStyle, aId, aClass, aCSS1ItemSet, aCSS1PropInfo); if( !aId.isEmpty() ) InsertBookmark( aId ); } @@ -2004,7 +2004,7 @@ void SwHTMLParser::NewTextArea() SvxCSS1PropertyInfo aCSS1PropInfo; if( HasStyleOptions( aStyle, aId, aClass ) ) { - ParseStyleOptions( aStyle, aId, aClass, aCSS1ItemSet, aCSS1PropInfo ); + (void)ParseStyleOptions(aStyle, aId, aClass, aCSS1ItemSet, aCSS1PropInfo); if( !aId.isEmpty() ) InsertBookmark( aId ); } @@ -2271,7 +2271,7 @@ void SwHTMLParser::NewSelect() SvxCSS1PropertyInfo aCSS1PropInfo; if( HasStyleOptions( aStyle, aId, aClass ) ) { - ParseStyleOptions( aStyle, aId, aClass, aCSS1ItemSet, aCSS1PropInfo ); + (void)ParseStyleOptions(aStyle, aId, aClass, aCSS1ItemSet, aCSS1PropInfo); if( !aId.isEmpty() ) InsertBookmark( aId ); } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 15928d5d414f..07c7bba7ef87 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2717,12 +2717,25 @@ void DocxAttributeOutput::WriteContentControlStart() } for (const auto& rItem : m_pContentControl->GetListItems()) { + if (rItem.m_aDisplayText.isEmpty() && rItem.m_aValue.isEmpty()) + { + // Empty display text & value would be invalid DOCX, skip the item. + continue; + } + rtl::Reference xAttributes = FastSerializerHelper::createAttrList(); if (!rItem.m_aDisplayText.isEmpty()) { // If there is no display text, need to omit the attribute, not write an empty one. xAttributes->add(FSNS(XML_w, XML_displayText), rItem.m_aDisplayText); } + + OUString aValue = rItem.m_aValue; + if (aValue.isEmpty()) + { + // Empty value would be invalid DOCX, default to the display text. + aValue = rItem.m_aDisplayText; + } xAttributes->add(FSNS(XML_w, XML_value), rItem.m_aValue); m_pSerializer->singleElementNS(XML_w, XML_listItem, xAttributes); } diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 4e3d87ba0ff0..1c042afd38f0 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -779,6 +779,11 @@ bool AbstractSwPageNumberDlg_Impl::GetIncludePageTotal() const return m_xDlg->GetIncludePageTotal(); } +bool AbstractSwPageNumberDlg_Impl::GetFitIntoExistingMargins() const +{ + return m_xDlg->GetFitIntoExistingMargins(); +} + SvxNumType AbstractSwPageNumberDlg_Impl::GetPageNumberType() const { return m_xDlg->GetPageNumberType(); diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index ae11902beedc..feb703e621e0 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -171,6 +171,7 @@ public: virtual int GetPageNumberAlignment() const override; bool GetMirrorOnEvenPages() const override; bool GetIncludePageTotal() const override; + bool GetFitIntoExistingMargins() const override; SvxNumType GetPageNumberType() const override; void SetPageNumberType(SvxNumType nSet) override; }; diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx index 0e6374e2b45e..99af2899746b 100644 --- a/sw/source/ui/fldui/flddb.cxx +++ b/sw/source/ui/fldui/flddb.cxx @@ -441,7 +441,7 @@ void SwFieldDBPage::CheckInsert() bInsert &= bHasValue; } - EnableInsert(bInsert); + EnableInsert(bInsert, IsCurrentPage()); } IMPL_LINK(SwFieldDBPage, TreeSelectHdl, weld::TreeView&, rBox, void) diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index 24c81eb10edb..36743339ab56 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -401,7 +401,7 @@ sal_Int32 SwFieldDokInfPage::FillSelectionLB(sal_uInt16 nSubType) // fill Format-Listbox SwFieldTypesEnum nTypeId = SwFieldTypesEnum::DocumentInfo; - EnableInsert(nSubType != USHRT_MAX); + EnableInsert(nSubType != USHRT_MAX, IsCurrentPage()); if (nSubType == USHRT_MAX) // Info-Text nSubType = DI_SUBTYPE_BEGIN; diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx index 0a553522985c..98fac8e93515 100644 --- a/sw/source/ui/fldui/fldfunc.cxx +++ b/sw/source/ui/fldui/fldfunc.cxx @@ -377,7 +377,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void) m_xValueGroup->set_sensitive(bValue); m_xMacroBT->set_sensitive(bMacro); - EnableInsert( bInsert ); + EnableInsert(bInsert, IsCurrentPage()); } IMPL_LINK_NOARG(SwFieldFuncPage, SelectHdl, weld::TreeView&, void) @@ -500,7 +500,7 @@ void SwFieldFuncPage::UpdateSubType() m_xNameED->set_text(GetFieldMgr().GetMacroName()); m_xValueGroup->set_sensitive(true); } - EnableInsert(bHasMacro); + EnableInsert(bHasMacro, IsCurrentPage()); } } @@ -605,7 +605,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, ModifyHdl, weld::Entry&, void) (!nLen || nLen > MAX_COMBINED_CHARACTERS )) bEnable = false; - EnableInsert( bEnable ); + EnableInsert(bEnable, IsCurrentPage()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index 11923d34ee93..0bf3fa640dc0 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -98,7 +98,7 @@ void SwFieldPage::Init() // newly initialise page void SwFieldPage::Activate() { - EnableInsert(m_bInsert); + EnableInsert(m_bInsert, true); } // complete reset; edit new field @@ -318,18 +318,25 @@ void SwFieldPage::InsertHdl(weld::Widget* pBtn) } } -// enable/disable "Insert"-Button -void SwFieldPage::EnableInsert(bool bEnable) +bool SwFieldPage::IsCurrentPage() const { - if (SwFieldDlg *pDlg = dynamic_cast(GetDialogController())) + if (const SwFieldDlg *pDlg = dynamic_cast(GetDialogController())) + return pDlg->GetCurTabPage() == this; + return true; +} + +// enable/disable "Insert"-Button +void SwFieldPage::EnableInsert(bool bEnable, bool bIsCurrentPage) +{ + if (bIsCurrentPage) { - if (pDlg->GetCurTabPage() == this) + if (SwFieldDlg *pDlg = dynamic_cast(GetDialogController())) pDlg->EnableInsert(bEnable); - } - else - { - SwFieldEditDlg *pEditDlg = static_cast(GetDialogController()); - pEditDlg->EnableInsert(bEnable); + else + { + SwFieldEditDlg *pEditDlg = static_cast(GetDialogController()); + pEditDlg->EnableInsert(bEnable); + } } m_bInsert = bEnable; diff --git a/sw/source/ui/fldui/fldpage.hxx b/sw/source/ui/fldui/fldpage.hxx index fbfa8cf2ba53..aad057822b6b 100644 --- a/sw/source/ui/fldui/fldpage.hxx +++ b/sw/source/ui/fldui/fldpage.hxx @@ -58,7 +58,8 @@ protected: void Init(); void SavePos( const weld::TreeView& rLst1); void RestorePos( weld::TreeView& rLst1 ); - void EnableInsert(bool bEnable); + bool IsCurrentPage() const; + void EnableInsert(bool bEnable, bool bIsCurrentPage); bool IsFieldEdit() const { return m_bFieldEdit; } // insert field diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 672465d713d9..334f392f476f 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -1003,7 +1003,7 @@ IMPL_LINK_NOARG(SwFieldRefPage, ModifyHdl, weld::Entry&, void) nTypeId == REFFLDFLAG_BOOKMARK))) bEnable = false; - EnableInsert(bEnable); + EnableInsert(bEnable, IsCurrentPage()); m_xSelectionLB->select_text(aName); } diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx index f649a24416b1..8b0d334f19fd 100644 --- a/sw/source/ui/fldui/fldtdlg.cxx +++ b/sw/source/ui/fldui/fldtdlg.cxx @@ -240,6 +240,13 @@ void SwFieldDlg::Activate() } } +void SwFieldDlg::ActivatePage(const OUString& rPage) +{ + SfxTabDialogController::ActivatePage(rPage); + if (SfxTabPage* pPage = GetTabPage(rPage)) + pPage->Activate(); +} + void SwFieldDlg::EnableInsert(bool bEnable) { if( bEnable ) diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index a950a5054529..01be468828f1 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -408,7 +408,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox) else bFormat = false; - EnableInsert(bFormat || bNumFormat); + EnableInsert(bFormat || bNumFormat, IsCurrentPage()); } break; @@ -953,7 +953,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, weld::Entry&, void) m_xNewPB->set_sensitive(bApply); m_xDelPB->set_sensitive(bDelete); - EnableInsert(bInsert); + EnableInsert(bInsert, IsCurrentPage()); } IMPL_LINK(SwFieldVarPage, TBClickHdl, weld::Button&, rBox, void) @@ -1123,7 +1123,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, SeparatorHdl, weld::Entry&, void) { bool bEnable = !m_xSeparatorED->get_text().isEmpty() || m_xChapterLevelLB->get_active() == 0; - EnableInsert(bEnable); + EnableInsert(bEnable, IsCurrentPage()); } bool SwFieldVarPage::FillItemSet(SfxItemSet* ) diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 427cca6a94a4..103c5f2c9e35 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -369,6 +369,7 @@ constexpr sal_uInt16 g_nMinWidth(MINLAY); SwColumnPage::SwColumnPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet) : SfxTabPage(pPage, pController, u"modules/swriter/ui/columnpage.ui"_ustr, u"ColumnPage"_ustr, &rSet) , m_nFirstVis(0) + , m_nCols(0) , m_pModifiedField(nullptr) , m_bFormat(false) , m_bFrame(false) diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index a37ef31f2dba..a61c662c9327 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -526,7 +526,7 @@ void SwIndexMarkPane::InsertMark() SwTOXMarkDescription aDesc(eType); - const int nLevel = m_xLevelNF->denormalize(m_xLevelNF->get_value()); + const auto nLevel = m_xLevelNF->denormalize(m_xLevelNF->get_value()); switch( nPos) { case POS_CONTENT : break; diff --git a/sw/source/ui/misc/pagenumberdlg.cxx b/sw/source/ui/misc/pagenumberdlg.cxx index d812cfaee60f..bc3cadb701e8 100644 --- a/sw/source/ui/misc/pagenumberdlg.cxx +++ b/sw/source/ui/misc/pagenumberdlg.cxx @@ -34,6 +34,8 @@ SwPageNumberDlg::SwPageNumberDlg(weld::Window* pParent) , m_xPageNumberAlignment(m_xBuilder->weld_combo_box(u"alignmentCombo"_ustr)) , m_xMirrorOnEvenPages(m_xBuilder->weld_check_button(u"mirrorCheckbox"_ustr)) , m_xIncludePageTotal(m_xBuilder->weld_check_button(u"pagetotalCheckbox"_ustr)) + , m_xFitIntoExistingMargins( + m_xBuilder->weld_check_button(u"fitintoexistingmarginsCheckbox"_ustr)) , m_xPageNumberTypeLB(new SvxPageNumberListBox(m_xBuilder->weld_combo_box(u"numfmtlb"_ustr))) , m_xPreviewImage(m_xBuilder->weld_image(u"previewImage"_ustr)) , m_aPageNumberPosition(1) // bottom @@ -48,6 +50,7 @@ SwPageNumberDlg::SwPageNumberDlg(weld::Window* pParent) m_xMirrorOnEvenPages->set_sensitive(false); m_xMirrorOnEvenPages->set_state(TRISTATE_TRUE); m_xIncludePageTotal->set_state(TRISTATE_FALSE); + m_xFitIntoExistingMargins->set_state(TRISTATE_FALSE); SvxNumOptionsTabPageHelper::GetI18nNumbering(m_xPageNumberTypeLB->get_widget(), ::std::numeric_limits::max()); m_xPageNumberTypeLB->connect_changed(LINK(this, SwPageNumberDlg, NumberTypeSelectHdl)); @@ -84,17 +87,22 @@ IMPL_LINK_NOARG(SwPageNumberDlg, IncludePageTotalChangeHdl, weld::Toggleable&, v updateImage(); } -bool SwPageNumberDlg::GetMirrorOnEvenPages() +bool SwPageNumberDlg::GetMirrorOnEvenPages() const { return m_xMirrorOnEvenPages->get_sensitive() && m_xMirrorOnEvenPages->get_state() == TRISTATE_TRUE; } -bool SwPageNumberDlg::GetIncludePageTotal() +bool SwPageNumberDlg::GetIncludePageTotal() const { return m_xIncludePageTotal->get_state() == TRISTATE_TRUE; } +bool SwPageNumberDlg::GetFitIntoExistingMargins() const +{ + return m_xFitIntoExistingMargins->get_state() == TRISTATE_TRUE; +} + void SwPageNumberDlg::SetPageNumberType(SvxNumType nSet) { m_nPageNumberType = nSet; diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index a85cc1dbf563..51e7cc4c259a 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1164,7 +1164,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, pFilterContainer->GetFilter4FilterName( rMergeDescriptor.sSaveToFilter ); if(pFilter) { - pStoreToFilter = pFilter; + pStoreToFilter = std::move(pFilter); if(!rMergeDescriptor.sSaveToFilterOptions.isEmpty()) pStoreToFilterOptions = &rMergeDescriptor.sSaveToFilterOptions; } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 8c41e02a98bc..1abf300f3d86 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -3373,7 +3373,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) rSh.LockView( true ); bool bSelObj = rSh.SelectObj(aDocPos, aMEvt.IsMod1() ? SW_ENTER_GROUP : 0); - if ( bSelObj && bSelectFrameInsteadOfCroppedImage ) + if ( bSelObj && bSelectFrameInsteadOfCroppedImage && pSdrView ) { bool bWrapped(false); const SdrObject* pFly = rSh.GetBestObject(false, GotoObjFlags::FlyAny, true, nullptr, &bWrapped); @@ -5364,6 +5364,16 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) if (bCallBase) Window::MouseButtonUp(rMEvt); + // tdf#161717 - Track changes: Clicking on change in document should highlight related change + // in "Manage Changes" window/sidebar + if (SwContentAtPos aRedlineContentAtPos(IsAttrAtPos::Redline); + rSh.GetContentAtPos(aDocPt, aRedlineContentAtPos)) + { + SwDocShell* pDocSh = m_rView.GetDocShell(); + if (pDocSh) + pDocSh->Broadcast(SfxHint(SfxHintId::SwRedlineContentAtPos)); + } + if (!(pSdrView && rMEvt.GetClicks() == 1 && comphelper::LibreOfficeKit::isActive())) return; diff --git a/sw/source/uibase/inc/fldtdlg.hxx b/sw/source/uibase/inc/fldtdlg.hxx index 0db155b3d54b..55de4a5db20c 100644 --- a/sw/source/uibase/inc/fldtdlg.hxx +++ b/sw/source/uibase/inc/fldtdlg.hxx @@ -61,6 +61,7 @@ public: virtual void Close() override; virtual void EndDialog(int nResponse) override; virtual void Activate() override; + virtual void ActivatePage(const OUString& rPage) override; }; #endif diff --git a/sw/source/uibase/inc/pagenumberdlg.hxx b/sw/source/uibase/inc/pagenumberdlg.hxx index 169c9209dbf5..f097509b5a68 100644 --- a/sw/source/uibase/inc/pagenumberdlg.hxx +++ b/sw/source/uibase/inc/pagenumberdlg.hxx @@ -33,6 +33,7 @@ class SwPageNumberDlg final : public SfxDialogController std::unique_ptr m_xPageNumberAlignment; std::unique_ptr m_xMirrorOnEvenPages; std::unique_ptr m_xIncludePageTotal; + std::unique_ptr m_xFitIntoExistingMargins; std::unique_ptr m_xPageNumberTypeLB; std::unique_ptr m_xPreviewImage; @@ -53,8 +54,9 @@ public: SwPageNumberDlg(weld::Window* pParent); int GetPageNumberPosition() const { return m_aPageNumberPosition; } int GetPageNumberAlignment() const { return m_aPageNumberAlignment; } - bool GetMirrorOnEvenPages(); - bool GetIncludePageTotal(); + bool GetMirrorOnEvenPages() const; + bool GetIncludePageTotal() const; + bool GetFitIntoExistingMargins() const; SvxNumType GetPageNumberType() const { return m_nPageNumberType; } void SetPageNumberType(SvxNumType nSet); }; diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index 6330d194fb13..b0c53e00f350 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -53,7 +53,7 @@ struct SwRedlineDataParent class SwRedlineDataParentSortArr : public o3tl::sorted_vector {}; -class SW_DLLPUBLIC SwRedlineAcceptDlg final +class SW_DLLPUBLIC SwRedlineAcceptDlg final : public SfxListener { std::shared_ptr m_xParentDlg; std::vector> m_RedlineParents; @@ -124,6 +124,8 @@ public: void FillInfo(OUString &rExtraData) const; void Activate(); + + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; }; class SwModelessRedlineAcceptDlg final : public SfxModelessDialogController diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 9a5a144b4426..5efd064889ab 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -207,6 +207,9 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(std::shared_ptr xParent, we // avoid multiple selection of the same texts: m_aSelectTimer.SetTimeout(100); m_aSelectTimer.SetInvokeHandler(LINK(this, SwRedlineAcceptDlg, GotoHdl)); + + // we want to receive SfxHintId::SwRedlineContentAtPos + StartListening(*(SW_MOD()->GetView()->GetDocShell())); } SwRedlineAcceptDlg::~SwRedlineAcceptDlg() @@ -495,6 +498,42 @@ void SwRedlineAcceptDlg::Activate() InitAuthors(); } +void SwRedlineAcceptDlg::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) +{ + if (rHint.GetId() == SfxHintId::SwRedlineContentAtPos) + { + SwView* pView = GetActiveView(); + if (!pView) + return; + + SwWrtShell* pSh = pView->GetWrtShellPtr(); + if (!pSh) + return; + + const SwRangeRedline* pRangeRedline = pSh->GetCurrRedline(); + if (!pRangeRedline) + return; + + const SwRedlineData& rRedlineData = pRangeRedline->GetRedlineData(); + + weld::TreeView& rTreeView = m_pTable->GetWidget(); + rTreeView.all_foreach([&rTreeView, &rRedlineData](weld::TreeIter& rIter) { + RedlinData* pRedlinData = weld::fromId(rTreeView.get_id(rIter)); + const SwRedlineData* pRedlineData; + if (rTreeView.iter_has_child(rIter)) + pRedlineData = static_cast(pRedlinData->pData)->pData; + else + pRedlineData = static_cast(pRedlinData->pData)->pChild; + if (pRedlineData == &rRedlineData) + { + rTreeView.set_cursor(rIter); + return true; + } + return false; + }); + } +} + SwRedlineTable::size_type SwRedlineAcceptDlg::CalcDiff(SwRedlineTable::size_type nStart, bool bChild) { if (!nStart || m_bHasTrackedColumn) diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 54602e0199b7..a31d249093d2 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -37,10 +37,15 @@ #include #include #include +#include +#include #include #include #include +#include +#include #include +#include #include #include #include @@ -59,9 +64,9 @@ #include #include -#include #include #include +#include #include #include #include @@ -1153,6 +1158,72 @@ FIELD_INSERT: rFormat.SetFormatAttr(aUL); rFormat.SetFormatAttr(aFill); + if (pDlg->GetFitIntoExistingMargins()) + { + SvxULSpaceItem aPageUL(aNewDesc.GetMaster().GetULSpace()); + tools::Long nPageMargin = bHeader ? aPageUL.GetUpper() : aPageUL.GetLower(); + + // most printers can't print to paper edge - use arbitrary ~14pt as minimum + if (nPageMargin > constTwips_5mm) + { + // reduce existing margin by the "Spacing" + nPageMargin -= constTwips_5mm; + + // also reduce by the "Height" (as calculated from the font) + tools::Long nFontHeight = constTwips_5mm; // appropriate for 12pt font + const OutputDevice* pOutDev = Application::GetDefaultDevice(); + const SwViewShell* pViewSh + = rDoc.getIDocumentLayoutAccess().GetCurrentViewShell(); + OUString sParaStyle(bHeader ? "Header" : "Footer"); + SwTextFormatColl* pStyle = rDoc.FindTextFormatCollByName(sParaStyle); + if (pStyle && pOutDev) + { + SwFont aFont( + &pStyle->GetAttrSet(), /*IDocumentSettingAccess=*/nullptr); + + // sledgehammer approach: since the in-use-font (Latin/CTL/CKJ) + // is not known, use the tallest of the three just to ensure fit. + sal_uInt16 nHeight = aFont.GetHeight(pViewSh, *pOutDev); // Latin + + aFont.SetActual(SwFontScript::CTL); + nHeight = std::max(nHeight, aFont.GetHeight(pViewSh, *pOutDev)); + + aFont.SetActual(SwFontScript::CJK); + nFontHeight = std::max(nHeight, aFont.GetHeight(pViewSh, *pOutDev)); + + // Spacing: above and below paragraph + const SvxULSpaceItem& rParaStyleUL = pStyle->GetULSpace(); + nFontHeight += rParaStyleUL.GetUpper() + rParaStyleUL.GetLower(); + + // Border padding: top and bottom + const SvxBoxItem rBorders = pStyle->GetBox(); + nFontHeight += rBorders.CalcLineSpace(SvxBoxItemLine::TOP, true); + nFontHeight += rBorders.CalcLineSpace(SvxBoxItemLine::BOTTOM, true); + } + nPageMargin -= nFontHeight; + + nPageMargin = std::max(nPageMargin, constTwips_5mm); + if (bHeader) + aPageUL.SetUpper(nPageMargin); + else + aPageUL.SetLower(nPageMargin); + aNewDesc.GetMaster().SetFormatAttr(aPageUL); + + // force aggressively calculated font height as minimum to ensure + // effective margin stays the same (instead of getting smaller) + SwFormatFrameSize aSize(rFormat.GetFrameSize()); + aSize.SetHeightSizeType(SwFrameSize::Minimum); + // frame size property includes both Spacing + Height + aSize.SetHeight(constTwips_5mm + nFontHeight); + rFormat.SetFormatAttr(aSize); + + // in case the calculated font height isn't actually large enough, + // eat into spacing first before pushing into the content area. + rFormat.SetFormatAttr(SwHeaderAndFooterEatSpacingItem( + RES_HEADER_FOOTER_EAT_SPACING, true)); + } + } + // Might as well turn on margin mirroring too - if appropriate if (pDlg->GetMirrorOnEvenPages() && !bHeaderAlreadyOn && !bFooterAlreadyOn && !bIsSinglePage diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 0144b01dbfaf..5bcf240026b6 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1627,7 +1627,7 @@ void SwTextShell::Execute(SfxRequest &rReq) rReq.Ignore(); // the 'old' request is not relevant any more auto vCursors = CopyPaMRing(*pPaM); // tdf#134439 make a copy to use at later apply - pDlg->StartExecuteAsync([pDlg, &rWrtSh, pDrawModel, pRequest, nDefDist, vCursors](sal_Int32 nResult){ + pDlg->StartExecuteAsync([pDlg, &rWrtSh, pDrawModel, pRequest=std::move(pRequest), nDefDist, vCursors=std::move(vCursors)](sal_Int32 nResult){ if (nResult == RET_OK) { // Apply defaults if necessary. diff --git a/sw/source/uibase/sidebar/QuickFindPanel.cxx b/sw/source/uibase/sidebar/QuickFindPanel.cxx index cdf7afa68947..4da7639ca8c2 100644 --- a/sw/source/uibase/sidebar/QuickFindPanel.cxx +++ b/sw/source/uibase/sidebar/QuickFindPanel.cxx @@ -335,7 +335,7 @@ IMPL_LINK_NOARG(QuickFindPanel, SearchFindsListSelectionChangedHandler, weld::Tr if (sId[0] == '-') return; - std::unique_ptr& rxPaM = m_vPaMs[sId.toInt64()]; + std::unique_ptr& rxPaM = m_vPaMs[sId.toUInt64()]; m_pWrtShell->StartAction(); bool bFound = false; diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index a454b7fd87a6..fb1cec99c40c 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -653,14 +653,9 @@ void SwView::ExecTabWin( SfxRequest const & rReq ) case SID_TABSTOP_ADD_OR_CHANGE: if (pReqArgs) { - const auto aIndexItem = static_cast(pReqArgs->Get(SID_TABSTOP_ATTR_INDEX)); - const auto aPositionItem = static_cast(pReqArgs->Get(SID_TABSTOP_ATTR_POSITION)); - const auto aRemoveItem = static_cast(pReqArgs->Get(SID_TABSTOP_ATTR_REMOVE)); - const sal_Int32 nIndex = aIndexItem.GetValue(); - const sal_Int32 nPosition = aPositionItem.GetValue(); - const bool bRemove = aRemoveItem.GetValue(); - - + const sal_Int32 nIndex = static_cast(pReqArgs->Get(SID_TABSTOP_ATTR_INDEX)).GetValue(); + const sal_Int32 nPosition = static_cast(pReqArgs->Get(SID_TABSTOP_ATTR_POSITION)).GetValue(); + const bool bRemove = static_cast(pReqArgs->Get(SID_TABSTOP_ATTR_REMOVE)).GetValue(); SfxItemSetFixed aItemSet(GetPool()); rSh.GetCurAttr(aItemSet); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 83cf875c65b5..8480ce498bc2 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -381,7 +381,6 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) , m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_DOCUMENT)), m_pDocShell(pShell), - m_bObjectValid(pShell != nullptr), m_pHiddenViewFrame(nullptr), // #i117783# m_bApplyPagePrintSettingsFromXPagePrintable( false ) @@ -390,7 +389,7 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) void SwXTextDocument::ThrowIfInvalid() const { - if (!m_bObjectValid) + if (!m_pDocShell) throw DisposedException(u"SwXTextDocument not valid"_ustr, const_cast(this)->getXWeak()); } @@ -442,7 +441,7 @@ SwXDocumentPropertyHelper * SwXTextDocument::GetPropertyHelper () void SwXTextDocument::GetNumberFormatter() { - if (!m_bObjectValid) + if (!m_pDocShell) return; if(!m_xNumFormatAgg.is()) @@ -529,7 +528,7 @@ Reference< XInterface > SwXTextDocument::getCurrentSelection() { SolarMutexGuard aGuard; Reference< XInterface > xRef; - if (m_bObjectValid) + if (m_pDocShell) { SwView* pView = static_cast(SfxViewShell::GetFirst(true, checkSfxViewShell)); while(pView && pView->GetObjectShell() != m_pDocShell) @@ -587,7 +586,7 @@ void SwXTextDocument::close( sal_Bool bDeliverOwnership ) m_pDocShell->CallAutomationDocumentEventSinks( u"Close"_ustr, aArgs ); } SolarMutexGuard aGuard; - if (m_bObjectValid && m_pHiddenViewFrame) + if (m_pDocShell && m_pHiddenViewFrame) lcl_DisposeView( m_pHiddenViewFrame, m_pDocShell); SfxBaseModel::close(bDeliverOwnership); } @@ -1372,7 +1371,7 @@ uno::Reference SAL_CALL SwXTextDocument::getDrawPages() void SwXTextDocument::Invalidate() { - m_bObjectValid = false; + m_pDocShell = nullptr; if(m_xNumFormatAgg.is()) { const uno::Type& rTunnelType = cppu::UnoType::get(); @@ -1387,7 +1386,6 @@ void SwXTextDocument::Invalidate() OSL_ENSURE(pNumFormat, "No number formatter available"); } InitNewDoc(); - m_pDocShell = nullptr; lang::EventObject const ev(getXWeak()); std::unique_lock aGuard(m_pImpl->m_Mutex); m_pImpl->m_RefreshListeners.disposeAndClear(aGuard, ev); @@ -1398,7 +1396,6 @@ void SwXTextDocument::Reactivate(SwDocShell* pNewDocShell) if(m_pDocShell && m_pDocShell != pNewDocShell) Invalidate(); m_pDocShell = pNewDocShell; - m_bObjectValid = true; } void SwXTextDocument::InitNewDoc() @@ -3190,7 +3187,7 @@ void SwXTextDocument::addPasteEventListener(const uno::ReferenceGetWrtShell()->GetPasteListeners().addInterface(xListener); } @@ -3199,7 +3196,7 @@ void SwXTextDocument::removePasteEventListener( { SolarMutexGuard aGuard; - if (m_bObjectValid && xListener.is()) + if (m_pDocShell && xListener.is()) m_pDocShell->GetWrtShell()->GetPasteListeners().removeInterface(xListener); } @@ -3273,6 +3270,12 @@ void SwXTextDocument::setClipboard(const uno::ReferenceGetView(); if (pView) pView->GetEditWin().SetClipboard(xClipboard); diff --git a/sw/source/writerfilter/dmapper/TablePropertiesHandler.hxx b/sw/source/writerfilter/dmapper/TablePropertiesHandler.hxx index 9d8f90dc3925..f4ebb4a14a23 100644 --- a/sw/source/writerfilter/dmapper/TablePropertiesHandler.hxx +++ b/sw/source/writerfilter/dmapper/TablePropertiesHandler.hxx @@ -56,7 +56,7 @@ public: private: - void cellProps( TablePropertyMapPtr pProps ) + void cellProps(const TablePropertyMapPtr& pProps) { if ( m_pTableManager ) m_pTableManager->cellProps( pProps ); @@ -64,7 +64,7 @@ private: m_pCurrentProperties->InsertProps(pProps.get()); }; - void insertRowProps( TablePropertyMapPtr pProps ) + void insertRowProps(const TablePropertyMapPtr& pProps) { if ( m_pTableManager ) m_pTableManager->insertRowProps( pProps ); @@ -72,7 +72,7 @@ private: m_pCurrentProperties->InsertProps(pProps.get()); }; - void tableExceptionProps( TablePropertyMapPtr pProps ) + void tableExceptionProps(const TablePropertyMapPtr& pProps) { if ( m_pTableManager ) m_pTableManager->tableExceptionProps( pProps ); @@ -80,7 +80,7 @@ private: m_pCurrentProperties->InsertProps(pProps.get()); }; - void insertTableProps( TablePropertyMapPtr pProps ) + void insertTableProps(const TablePropertyMapPtr& pProps) { if ( m_pTableManager ) m_pTableManager->insertTableProps( pProps ); diff --git a/sw/uiconfig/swriter/ui/managechangessidebar.ui b/sw/uiconfig/swriter/ui/managechangessidebar.ui index 681264f9a864..f305caf31348 100644 --- a/sw/uiconfig/swriter/ui/managechangessidebar.ui +++ b/sw/uiconfig/swriter/ui/managechangessidebar.ui @@ -1,11 +1,12 @@ - + True False + True True True diff --git a/sw/uiconfig/swriter/ui/navigatorpanel.ui b/sw/uiconfig/swriter/ui/navigatorpanel.ui index 5598ef1d938d..7d043cff1560 100644 --- a/sw/uiconfig/swriter/ui/navigatorpanel.ui +++ b/sw/uiconfig/swriter/ui/navigatorpanel.ui @@ -580,7 +580,7 @@ True False - Promote Outline Level + Promote Outline Level start start sw/res/sc20172.png @@ -594,7 +594,7 @@ True False - Demote Outline Level + Demote Outline Level start start sw/res/sc20173.png @@ -608,7 +608,7 @@ True False - Move Heading Up + Move Heading Up start start sw/res/sc20174.png @@ -622,7 +622,7 @@ True False - Move Heading Down + Move Heading Down start start sw/res/sc20171.png @@ -1299,7 +1299,7 @@ True False - Delete + Delete start start cmd/sc_delete.png diff --git a/sw/uiconfig/swriter/ui/pagenumberdlg.ui b/sw/uiconfig/swriter/ui/pagenumberdlg.ui index f014545da429..e876594c05c5 100644 --- a/sw/uiconfig/swriter/ui/pagenumberdlg.ui +++ b/sw/uiconfig/swriter/ui/pagenumberdlg.ui @@ -211,6 +211,28 @@ 5 + + + Fit into existing margins + True + True + False + 18 + 3 + True + True + + + Reduce the margin so that adding the page number will not change the page layout + + + + + False + True + 6 + + True @@ -232,7 +254,7 @@ False True - 6 + 7 @@ -251,7 +273,7 @@ False True - 7 + 8 diff --git a/test/source/a11y/accessibletestbase.cxx b/test/source/a11y/accessibletestbase.cxx index 62b8043917df..27bea36f6084 100644 --- a/test/source/a11y/accessibletestbase.cxx +++ b/test/source/a11y/accessibletestbase.cxx @@ -43,7 +43,7 @@ void test::AccessibleTestBase::setUp() { test::BootstrapFixture::setUp(); - mxDesktop = frame::Desktop::create(mxComponentContext); + mxDesktop = frame::Desktop::create(m_xContext); } void test::AccessibleTestBase::close() diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx index 273109496012..891af3c6f640 100644 --- a/test/source/bootstrapfixture.cxx +++ b/test/source/bootstrapfixture.cxx @@ -113,8 +113,6 @@ void test::BootstrapFixture::setUp() #if OSL_DEBUG_LEVEL > 0 Scheduler::ProcessEventsToIdle(); #endif - - mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory())); } test::BootstrapFixture::~BootstrapFixture() diff --git a/toolkit/qa/cppunit/Dialog.cxx b/toolkit/qa/cppunit/Dialog.cxx index c6f6f5699a8e..e41b0bf946f6 100644 --- a/toolkit/qa/cppunit/Dialog.cxx +++ b/toolkit/qa/cppunit/Dialog.cxx @@ -28,34 +28,22 @@ namespace /// Test dialogs constructed via UNO class DialogTest : public test::BootstrapFixture, public unotest::MacrosTest { -protected: - uno::Reference mxContext; - -public: - virtual void setUp() override; }; -void DialogTest::setUp() -{ - test::BootstrapFixture::setUp(); - - mxContext.set(comphelper::getComponentContext(getMultiServiceFactory())); -} - CPPUNIT_TEST_FIXTURE(DialogTest, testDialogSizeable) { uno::Reference xDialog; - uno::Reference xFactory(mxContext->getServiceManager(), + uno::Reference xFactory(m_xContext->getServiceManager(), uno::UNO_SET_THROW); uno::Reference xControlModel( xFactory->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr, - mxContext), + m_xContext), uno::UNO_QUERY_THROW); uno::Reference xPropSet(xControlModel, uno::UNO_QUERY_THROW); xPropSet->setPropertyValue(u"Sizeable"_ustr, uno::Any(true)); - uno::Reference xControl = awt::UnoControlDialog::create(mxContext); + uno::Reference xControl = awt::UnoControlDialog::create(m_xContext); xControl->setModel(xControlModel); xControl->setVisible(true); xDialog.set(xControl, uno::UNO_QUERY_THROW); diff --git a/toolkit/qa/cppunit/EventContainer.cxx b/toolkit/qa/cppunit/EventContainer.cxx index ab13e9fdf4f7..8bd4e57c631c 100644 --- a/toolkit/qa/cppunit/EventContainer.cxx +++ b/toolkit/qa/cppunit/EventContainer.cxx @@ -32,28 +32,16 @@ namespace /// Test EventContainer class class EventContainerTest : public test::BootstrapFixture { -protected: - Reference mxContext; - -public: - virtual void setUp() override; }; -void EventContainerTest::setUp() -{ - test::BootstrapFixture::setUp(); - - mxContext.set(comphelper::getComponentContext(getMultiServiceFactory())); -} - // Make sure that EventContainer keeps insertion order, and does not reorder its elements. // Otherwise this would break macro signatures. CPPUNIT_TEST_FIXTURE(EventContainerTest, testInsertOrder) { - Reference xFactory(mxContext->getServiceManager(), UNO_SET_THROW); + Reference xFactory(m_xContext->getServiceManager(), UNO_SET_THROW); Reference xControlModel( xFactory->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr, - mxContext), + m_xContext), UNO_QUERY_THROW); Reference xPropSet(xControlModel, UNO_QUERY_THROW); diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index ecf3605c9e9c..9e9c547e4ba6 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -136,6 +136,7 @@ #endif #include #include +#include #include #include #include @@ -928,7 +929,8 @@ VCLXToolkit::VCLXToolkit(): #ifndef IOS osl::Guard< osl::Mutex > aGuard( getInitMutex() ); nVCLToolkitInstanceCount++; - if( ( nVCLToolkitInstanceCount == 1 ) && ( !Application::IsInMain() ) ) + if( nVCLToolkitInstanceCount == 1 && !Application::IsInMain() && + !comphelper::LibreOfficeKit::isActive() ) { // setup execute thread CreateMainLoopThread( ToolkitWorkerFunction, this ); diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index e7fb947eebbb..5a5fdfa05b11 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -1224,14 +1224,13 @@ void UnoControlModel::setFastPropertyValueImpl( std::unique_lock& rG getFastPropertyValue( rGuard, aOldSingleValue, BASEPROPERTY_FONTDESCRIPTORPART_START ); css::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ]; - FontDescriptor aOldFontDescriptor; - (*pProp) >>= aOldFontDescriptor; + FontDescriptor aFontDescriptor; + (*pProp) >>= aFontDescriptor; - FontDescriptor aNewFontDescriptor( aOldFontDescriptor ); - lcl_ImplMergeFontProperty( aNewFontDescriptor, static_cast(nPropId), rValue ); + lcl_ImplMergeFontProperty(aFontDescriptor, static_cast(nPropId), rValue); Any aNewValue; - aNewValue <<= aNewFontDescriptor; + aNewValue <<= aFontDescriptor; sal_Int32 nDescriptorId = BASEPROPERTY_FONTDESCRIPTOR; // also, we need fire a propertyChange event for the single property, since with diff --git a/tools/CppunitTest_tools_unique_id.mk b/tools/CppunitTest_tools_unique_id.mk new file mode 100644 index 000000000000..547832910f80 --- /dev/null +++ b/tools/CppunitTest_tools_unique_id.mk @@ -0,0 +1,29 @@ +# -*- 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,tools_unique_id)) + + +$(eval $(call gb_CppunitTest_set_include,tools_unique_id,\ + $$(INCLUDE) \ + -I$(SRCDIR)/tools/inc \ +)) + +$(eval $(call gb_CppunitTest_add_exception_objects,tools_unique_id, \ + tools/qa/cppunit/UniqueIdTest \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,tools_unique_id, \ + tl \ + test \ + unotest \ +)) + + +# vim: set noet sw=4 ts=4: diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk index fee6fb1b4097..e2f1a9fccbf6 100644 --- a/tools/Library_tl.mk +++ b/tools/Library_tl.mk @@ -72,6 +72,7 @@ $(eval $(call gb_Library_add_exception_objects,tl,\ tools/source/misc/cpuid \ tools/source/misc/extendapplicationenvironment \ tools/source/misc/json_writer \ + tools/source/misc/UniqueID \ tools/source/ref/globname \ tools/source/ref/ref \ tools/source/stream/stream \ diff --git a/tools/Module_tools.mk b/tools/Module_tools.mk index 5632a5b94a2d..4d477462c0fe 100644 --- a/tools/Module_tools.mk +++ b/tools/Module_tools.mk @@ -33,6 +33,7 @@ $(eval $(call gb_Module_add_targets_for_build,tools,\ $(eval $(call gb_Module_add_check_targets,tools,\ CppunitTest_tools_test \ CppunitTest_tools_config \ + CppunitTest_tools_unique_id \ )) # vim: set noet sw=4 ts=4: diff --git a/tools/qa/cppunit/UniqueIdTest.cxx b/tools/qa/cppunit/UniqueIdTest.cxx new file mode 100644 index 000000000000..e85fcfb0cf39 --- /dev/null +++ b/tools/qa/cppunit/UniqueIdTest.cxx @@ -0,0 +1,79 @@ +/* -*- 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 + +#include +#include +#include +#include + +namespace +{ +class UniqueIdTest : public CppUnit::TestFixture +{ +}; + +struct ObjectExample1 +{ + UniqueID maID; +}; + +struct ObjectExample2 +{ + UniqueID maID; +}; + +CPPUNIT_TEST_FIXTURE(UniqueIdTest, testUniqueness) +{ + UniqueID aID; + // Check ID + CPPUNIT_ASSERT_EQUAL(sal_uInt64(1), aID.getID()); + // Call again - same result + CPPUNIT_ASSERT_EQUAL(sal_uInt64(1), aID.getID()); + + // Check creating another instance + { + UniqueID aID2; + CPPUNIT_ASSERT_EQUAL(sal_uInt64(1), aID.getID()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(2), aID2.getID()); + } + + // Check creating third instance + { + UniqueID aID3; + CPPUNIT_ASSERT_EQUAL(sal_uInt64(1), aID.getID()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(3), aID3.getID()); + } + + // Check object copying - preserve the id + ObjectExample1 objectA; + CPPUNIT_ASSERT_EQUAL(sal_uInt64(4), objectA.maID.getID()); + + ObjectExample1 objectB = objectA; + CPPUNIT_ASSERT_EQUAL(sal_uInt64(4), objectA.maID.getID()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(4), objectB.maID.getID()); + + // Multiple objects + ObjectExample2 objectC; + ObjectExample1 objectD; + ObjectExample2 objectE; + ObjectExample1 objectF; + + CPPUNIT_ASSERT_EQUAL(sal_uInt64(5), objectC.maID.getID()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(6), objectD.maID.getID()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(7), objectE.maID.getID()); + CPPUNIT_ASSERT_EQUAL(sal_uInt64(8), objectF.maID.getID()); +} + +} // end anonymous namespace + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/misc/UniqueID.cxx b/tools/source/misc/UniqueID.cxx new file mode 100644 index 000000000000..3af43eccb968 --- /dev/null +++ b/tools/source/misc/UniqueID.cxx @@ -0,0 +1,19 @@ +/* -*- 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 +#include + +UniqueID::UniqueID() +{ + static std::atomic staticCounter(1); + mnID = staticCounter.fetch_add(1); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/translations b/translations index b87971d7ac97..a9266fc54a66 160000 --- a/translations +++ b/translations @@ -1 +1 @@ -Subproject commit b87971d7ac97460271cb13bd0e4cb2e554654a45 +Subproject commit a9266fc54a66142dba20625f94d196898070ca0d diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 6bd5146bb7bc..2fc413b913bd 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -1130,8 +1130,7 @@ namespace cmis std::vector< std::string > aPaths = pPwc->getPaths( ); if ( !aPaths.empty() ) { - auto sPath = aPaths.front( ); - aCmisUrl.setObjectPath( STD_TO_OUSTR( sPath ) ); + aCmisUrl.setObjectPath(STD_TO_OUSTR(aPaths.front())); } else { diff --git a/unoxml/CppunitTest_unoxml_rdftest.mk b/unoxml/CppunitTest_unoxml_rdftest.mk new file mode 100644 index 000000000000..e4e12e9864d4 --- /dev/null +++ b/unoxml/CppunitTest_unoxml_rdftest.mk @@ -0,0 +1,38 @@ +# -*- 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,unoxml_rdftest)) + +$(eval $(call gb_CppunitTest_add_exception_objects,unoxml_rdftest, \ + unoxml/qa/unit/rdftest \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,unoxml_rdftest)) + +$(eval $(call gb_CppunitTest_use_rdb,unoxml_rdftest,services)) + +$(eval $(call gb_CppunitTest_use_externals,unoxml_rdftest, \ + boost_headers \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,unoxml_rdftest, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + sax \ + test \ + unotest \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,unoxml_rdftest)) +$(eval $(call gb_CppunitTest_use_ure,unoxml_rdftest)) +$(eval $(call gb_CppunitTest_use_vcl,unoxml_rdftest)) + +# vim: set noet sw=4 ts=4: diff --git a/unoxml/Module_unoxml.mk b/unoxml/Module_unoxml.mk index 8c55b830e42a..1a302c17a91a 100644 --- a/unoxml/Module_unoxml.mk +++ b/unoxml/Module_unoxml.mk @@ -31,6 +31,7 @@ endif $(eval $(call gb_Module_add_slowcheck_targets,unoxml,\ CppunitTest_unoxml_domtest \ + CppunitTest_unoxml_rdftest \ )) $(eval $(call gb_Module_add_subsequentcheck_targets,unoxml,\ diff --git a/unoxml/qa/complex/unoxml/RDFRepositoryTest.java b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java index 54277a0f4ac5..a24e159af40b 100644 --- a/unoxml/qa/complex/unoxml/RDFRepositoryTest.java +++ b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java @@ -531,20 +531,6 @@ public class RDFRepositoryTest } } - @Test public void checkCVE_2012_0037() throws Exception - { - XInputStream xIn = new StreamSimulator( - TestDocument.getUrl("cve_2012_0037.rdf"), true, param); - xRep.importGraph(FileFormat.RDF_XML, xIn, manifest, base); - XNamedGraph xGraph = xRep.getGraph(manifest); - assertNotNull("no graph", xGraph); - XEnumeration xEnum = xGraph.getStatements(foo, bar, null); - // there must not be anything more than "EVIL" in the literal - XLiteral evil = Literal.create(xContext, "EVIL"); - Statement FooBarEvil = new Statement(foo, bar, evil, manifest); - assertTrue("EVIL", eq(xEnum, new Statement [] { FooBarEvil })); - } - // utilities ------------------------------------------------------------- public void report(Exception e) { diff --git a/unoxml/qa/complex/unoxml/testdocuments/cve_2012_0037.rdf b/unoxml/qa/unit/data/cve_2012_0037.rdf similarity index 100% rename from unoxml/qa/complex/unoxml/testdocuments/cve_2012_0037.rdf rename to unoxml/qa/unit/data/cve_2012_0037.rdf diff --git a/unoxml/qa/unit/rdftest.cxx b/unoxml/qa/unit/rdftest.cxx new file mode 100644 index 000000000000..4595d78f5215 --- /dev/null +++ b/unoxml/qa/unit/rdftest.cxx @@ -0,0 +1,67 @@ +/* -*- 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 + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace com::sun::star; + +namespace +{ +class RDFStreamTest : public test::BootstrapFixture +{ +}; + +CPPUNIT_TEST_FIXTURE(RDFStreamTest, testCVE_2012_0037) +{ + const uno::Reference xContext(comphelper::getProcessComponentContext(), + css::uno::UNO_SET_THROW); + const uno::Reference xFileAccess( + xContext->getServiceManager()->createInstanceWithContext( + u"com.sun.star.ucb.SimpleFileAccess"_ustr, xContext), + uno::UNO_QUERY_THROW); + const uno::Reference xInputStream( + xFileAccess->openFileRead( + m_directories.getURLFromSrc(u"/unoxml/qa/unit/data/cve_2012_0037.rdf")), + uno::UNO_SET_THROW); + uno::Reference xRepo = rdf::Repository::create(xContext); + uno::Reference xDocRepo(xRepo, uno::UNO_QUERY); + CPPUNIT_ASSERT(xDocRepo); + + uno::Reference xManifest = rdf::URI::create(xContext, "manifest:manifest"); + uno::Reference xBase = rdf::URI::create(xContext, "base-uri:"); + uno::Reference xFoo = rdf::URI::create(xContext, "uri:foo"); + uno::Reference xBar = rdf::URI::create(xContext, "uri:bar"); + + xDocRepo->importGraph(rdf::FileFormat::RDF_XML, xInputStream, xManifest, xBase); + uno::Reference xGraph = xDocRepo->getGraph(xManifest); + CPPUNIT_ASSERT(xGraph); + uno::Reference xEnum = xGraph->getStatements(xFoo, xBar, nullptr); + + rdf::Statement aStatement = xEnum->nextElement().get(); + CPPUNIT_ASSERT_EQUAL(OUString("uri:foo"), aStatement.Subject->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("uri:bar"), aStatement.Predicate->getStringValue()); + CPPUNIT_ASSERT_EQUAL(OUString("EVIL"), aStatement.Object->getStringValue()); +} +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/ios/DataFlavorMapping.cxx b/vcl/ios/DataFlavorMapping.cxx index 607f110222bb..ded47097015c 100644 --- a/vcl/ios/DataFlavorMapping.cxx +++ b/vcl/ios/DataFlavorMapping.cxx @@ -404,6 +404,10 @@ NSString* DataFlavorMapper::openOfficeToSystemFlavor(const DataFlavor& oOOFlavor else sysFlavor = OUStringToNSString(oOOFlavor.MimeType); } + + // Flavor set, then break + if (sysFlavor != nullptr) + break; } if (!sysFlavor) diff --git a/vcl/osx/DataFlavorMapping.cxx b/vcl/osx/DataFlavorMapping.cxx index 16a2c8be9207..855f6db9a287 100644 --- a/vcl/osx/DataFlavorMapping.cxx +++ b/vcl/osx/DataFlavorMapping.cxx @@ -577,6 +577,10 @@ const NSString* DataFlavorMapper::openOfficeToSystemFlavor( const DataFlavor& oO sysFlavor = flavorMap[i].SystemFlavor; else sysFlavor = OUStringToNSString(oOOFlavor.MimeType); + + // Flavor set, then break + if (sysFlavor != nullptr) + break; } } diff --git a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx index fb36f40c4791..aeed3e8bdfed 100644 --- a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx +++ b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx @@ -41,6 +41,7 @@ class GraphicFormatDetectorTest : public test::BootstrapFixtureBase void testDetectPNG(); void testDetectAPNG(); void testDetectGIF(); + void testDetectGIFMetadata(); void testDetectPSD(); void testDetectTGA(); void testDetectTIF(); @@ -66,6 +67,7 @@ class GraphicFormatDetectorTest : public test::BootstrapFixtureBase CPPUNIT_TEST(testDetectPNG); CPPUNIT_TEST(testDetectAPNG); CPPUNIT_TEST(testDetectGIF); + CPPUNIT_TEST(testDetectGIFMetadata); CPPUNIT_TEST(testDetectPSD); CPPUNIT_TEST(testDetectTGA); CPPUNIT_TEST(testDetectTIF); @@ -218,6 +220,22 @@ void GraphicFormatDetectorTest::testDetectGIF() CPPUNIT_ASSERT_EQUAL(u"GIF"_ustr, rFormatExtension); } +void GraphicFormatDetectorTest::testDetectGIFMetadata() +{ + SvFileStream aFileStream(getFullUrl(u"123_Numbers.gif"), StreamMode::READ); + vcl::GraphicFormatDetector aDetector(aFileStream, "GIF", true); + + CPPUNIT_ASSERT(aDetector.detect()); + CPPUNIT_ASSERT(aDetector.checkGIF()); + auto const& rMetadata = aDetector.getMetadata(); + + CPPUNIT_ASSERT_EQUAL(Size(124, 146), rMetadata.maPixSize); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(5), rMetadata.mnBitsPerPixel); + + CPPUNIT_ASSERT_EQUAL(Size(), rMetadata.maLogSize); + CPPUNIT_ASSERT_EQUAL(true, rMetadata.mbIsAnimated); +} + void GraphicFormatDetectorTest::testDetectPSD() { SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.psd"), StreamMode::READ); diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index 1130a05708e1..3821c31dcf8e 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -364,11 +364,12 @@ CPPUNIT_TEST_FIXTURE(GraphicTest, testUnloadedGraphicSizeUnit) { GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); test::Directories aDirectories; - OUString aURL = aDirectories.getURLFromSrc(DATA_DIRECTORY) + "inch-size.emf"; + OUString aURL = aDirectories.getURLFromSrc(DATA_DIRECTORY) + "inch-size.pct"; Size aMtfSize100(42, 42); SvFileStream aStream(aURL, StreamMode::READ); Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream, 0, &aMtfSize100); + CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable()); CPPUNIT_ASSERT_EQUAL(Size(42, 42), aGraphic.GetPrefSize()); // Force it to swap in diff --git a/vcl/qa/cppunit/data/inch-size.emf b/vcl/qa/cppunit/data/inch-size.pct similarity index 100% rename from vcl/qa/cppunit/data/inch-size.emf rename to vcl/qa/cppunit/data/inch-size.pct diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 92c024bd34fa..b2594058dd36 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -51,7 +51,7 @@ void VclFilterIpdfTest::setUp() UnoApiTest::setUp(); MacrosTest::setUpX509(m_directories, u"vcl_filter_ipdf"_ustr); - mxSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); + mxSEInitializer = xml::crypto::SEInitializer::create(m_xContext); mxSecurityContext = mxSEInitializer->createSecurityContext(OUString()); } diff --git a/vcl/qa/cppunit/pdfexport/data/tdf101686.fodt b/vcl/qa/cppunit/pdfexport/data/tdf101686.fodt new file mode 100644 index 000000000000..0a76451165bd --- /dev/null +++ b/vcl/qa/cppunit/pdfexport/data/tdf101686.fodt @@ -0,0 +1,592 @@ + + + + Hameedullah2016-06-21T18:15:002024-07-03T08:51:13.4059332566PT10M59SLibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/c792fe496ef8913c4d2fec7739d197d6f1a186932024-07-03T08:50:25.292450393PDF files + + + 0 + 0 + 26598 + 18480 + true + false + + + view2 + 3748 + 501 + 0 + 0 + 26596 + 18479 + 0 + 1 + false + 250 + false + false + false + false + false + false + + + + + false + true + true + + false + 0 + false + false + false + true + false + false + 0 + true + false + true + true + false + true + true + false + false + true + true + true + true + false + true + false + false + false + false + true + true + true + false + true + false + true + true + high-resolution + false + 1185464 + false + true + false + + + true + + true + false + true + true + true + + + ja + JP + + !%),.:;?]}¢°’”‰′″℃、。々〉》」』】〕゛゜ゝゞ・ヽヾ!%),.:;?]}。」、・゙゚¢ + $([\{£¥‘“〈《「『【〔$([{「£¥ + + + false + false + 0 + true + false + false + true + true + true + false + true + false + false + true + false + true + true + true + false + + true + true + false + 0 + false + true + + false + false + true + true + true + false + true + 1 + false + false + false + true + false + false + true + true + false + true + false + true + false + + false + 1350167 + true + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Textbox + + + + Textbox + + + + Frame + + + + + + + \ No newline at end of file diff --git a/vcl/qa/cppunit/pdfexport/data/tdf159900_figurePlacement.odt b/vcl/qa/cppunit/pdfexport/data/tdf159900_figurePlacement.odt new file mode 100644 index 000000000000..0ebe292ce160 Binary files /dev/null and b/vcl/qa/cppunit/pdfexport/data/tdf159900_figurePlacement.odt differ diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 054496ee4895..d4325fe267ce 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -70,6 +70,57 @@ void PdfExportTest::load(std::u16string_view rFile, vcl::filter::PDFDocument& rD CPPUNIT_ASSERT(rDocument.Read(aStream)); } +CPPUNIT_TEST_FIXTURE(PdfExportTest, testFigurePlacement) +{ + aMediaDescriptor[u"FilterName"_ustr] <<= u"impress_pdf_Export"_ustr; + + uno::Sequence aFilterData( + comphelper::InitPropertySequence({ { "UseTaggedPDF", uno::Any(true) } })); + aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData; + saveAsPDF(u"tdf159900_figurePlacement.odt"); + + // Parse the export result. + vcl::filter::PDFDocument aDocument; + SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ); + CPPUNIT_ASSERT(aDocument.Read(aStream)); + + // The document has one page. + std::vector aPages = aDocument.GetPages(); + CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); + + for (const auto& aElement : aDocument.GetElements()) + { + auto pObject = dynamic_cast(aElement.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") + { + auto pAttrDict + = dynamic_cast(pObject->Lookup("A"_ostr)); + CPPUNIT_ASSERT(pAttrDict); + auto pOwner = dynamic_cast( + pAttrDict->LookupElement("O"_ostr)); + CPPUNIT_ASSERT(pOwner); + if (pOwner->GetValue() == "Layout") + { + auto pPlacement = dynamic_cast( + pAttrDict->LookupElement("Placement"_ostr)); + CPPUNIT_ASSERT(pPlacement); + + // Without the fix in place, this test would have failed with + // Expected: Inline + // Actual: Block + CPPUNIT_ASSERT_EQUAL("Inline"_ostr, pPlacement->GetValue()); + } + } + } + } +} + /// Tests that a pdf image is roundtripped back to PDF as a vector format. CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106059) { diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index fb7ad3f97d85..58a5d93e060e 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -5237,6 +5237,47 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf71956) fnEqualPos(aRect[5], aRect[6]); } +// tdf#101686 - Verifies that drawinglayer clears RTL flags while drawing Writer text boxes +CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf101686) +{ + aMediaDescriptor[u"FilterName"_ustr] <<= u"writer_pdf_Export"_ustr; + saveAsPDF(u"tdf101686.fodt"); + std::unique_ptr pPdfDocument = parsePDFExport(); + + CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount()); + + // Get the first pace + std::unique_ptr pPdfPage = pPdfDocument->openPage(/*nIndex*/ 0); + CPPUNIT_ASSERT(pPdfPage); + std::unique_ptr pTextPage = pPdfPage->getTextPage(); + CPPUNIT_ASSERT(pTextPage); + + int nPageObjectCount = pPdfPage->getObjectCount(); + CPPUNIT_ASSERT_EQUAL(3, nPageObjectCount); + + std::vector aText; + + int nTextObjectCount = 0; + for (int i = 0; i < nPageObjectCount; ++i) + { + auto pPageObject = pPdfPage->getObject(i); + CPPUNIT_ASSERT_MESSAGE("no object", pPageObject != nullptr); + if (pPageObject->getType() == vcl::pdf::PDFPageObjectType::Text) + { + aText.push_back(pPageObject->getText(pTextPage)); + ++nTextObjectCount; + } + } + + CPPUNIT_ASSERT_EQUAL(3, nTextObjectCount); + + CPPUNIT_ASSERT_EQUAL(u"Frame"_ustr, aText[0].trim()); + + // Without the fix, one of these two will be "xobtxeT" + CPPUNIT_ASSERT_EQUAL(u"Textbox"_ustr, aText[1].trim()); + CPPUNIT_ASSERT_EQUAL(u"Textbox"_ustr, aText[2].trim()); +} + } // end anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index ebcb7aa1cb9a..f00eff75ab9e 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -1286,11 +1286,12 @@ tools::Polygon BitmapEx::GetContour( bool bContourEdgeDetect, std::unique_ptr pPoints2; tools::Long nX, nY; sal_uInt16 nPolyPos = 0; - // tdf#161498 use COL_ALPHA_OPAQUE for finding opaque pixels - // Starting with commit 81994cb2b8b32453a92bcb011830fcb884f22ff3, - // pixels now contain an alpha value instead of a transparency - // value. - const BitmapColor aTransparencyOpaque = pAcc->GetBestMatchingColor( COL_ALPHA_OPAQUE ); + // tdf#161833 treat semi-transparent pixels as opaque + // Limiting the contour wrapping polygon to only opaque pixels + // causes clipping of any shadows or other semi-transparent + // areas in the image. So, instead of testing for fully opaque + // pixels, treat pixels that are not fully transparent as opaque. + const BitmapColor aTransparent = pAcc->GetBestMatchingColor( COL_ALPHA_TRANSPARENT ); pPoints1.reset(new Point[ nHeight ]); pPoints2.reset(new Point[ nHeight ]); @@ -1303,7 +1304,7 @@ tools::Polygon BitmapEx::GetContour( bool bContourEdgeDetect, // scan row from left to right while( nX < nEndX1 ) { - if( aTransparencyOpaque == pAcc->GetPixelFromData( pScanline, nX ) ) + if( aTransparent != pAcc->GetPixelFromData( pScanline, nX ) ) { pPoints1[ nPolyPos ] = Point( nX, nY ); nX = nStartX2; @@ -1311,7 +1312,7 @@ tools::Polygon BitmapEx::GetContour( bool bContourEdgeDetect, // this loop always breaks eventually as there is at least one pixel while( true ) { - if( aTransparencyOpaque == pAcc->GetPixelFromData( pScanline, nX ) ) + if( aTransparent != pAcc->GetPixelFromData( pScanline, nX ) ) { pPoints2[ nPolyPos ] = Point( nX, nY ); break; diff --git a/vcl/source/control/imivctl.hxx b/vcl/source/control/imivctl.hxx index c29068442728..7a09609a8716 100644 --- a/vcl/source/control/imivctl.hxx +++ b/vcl/source/control/imivctl.hxx @@ -52,12 +52,9 @@ class IcnGridMap_Impl; enum class IconChoiceFlags { NONE = 0x0000, AddMode = 0x0001, - SelectingRect = 0x0002, - DownCtrl = 0x0004, - DownDeselect = 0x0008, - EntryListPosValid = 0x0010, - ClearingSelection = 0x0020, - Arranging = 0x0040 + EntryListPosValid = 0x0002, + ClearingSelection = 0x0004, + Arranging = 0x0008, }; namespace o3tl { template<> struct typed_flags : is_typed_flags {}; @@ -105,7 +102,6 @@ typedef sal_uLong GridId; // Implementation-class of IconChoiceCtrl -typedef std::map> SvxIconChoiceCtrlColumnInfoMap; typedef std::vector SvxIconChoiceCtrlEntryPtrVec; class SvxIconChoiceCtrl_Impl @@ -117,12 +113,9 @@ class SvxIconChoiceCtrl_Impl VclPtr aVerSBar; VclPtr aHorSBar; VclPtr aScrBarBox; - tools::Rectangle aCurSelectionRect; - std::vector aSelectedRectList; Idle aAutoArrangeIdle; Idle aDocRectChangedIdle; Idle aVisRectChangedIdle; - Idle aCallSelectHdlIdle; Size aVirtOutputSize; Size aImageSize; Size aDefaultTextSize; @@ -133,31 +126,22 @@ class SvxIconChoiceCtrl_Impl tools::Long nMaxVirtWidth; // max. width aVirtOutputSize for ALIGN_TOP tools::Long nMaxVirtHeight; // max. height aVirtOutputSize for ALIGN_LEFT std::vector< SvxIconChoiceCtrlEntry* > maZOrderList; - std::unique_ptr m_pColumns; WinBits nWinBits; tools::Long nMaxBoundHeight; // height of highest BoundRects IconChoiceFlags nFlags; DrawTextFlags nCurTextDrawFlags; ImplSVEvent * nUserEventAdjustScrBars; SvxIconChoiceCtrlEntry* pCurHighlightFrame; - bool bHighlightFramePressed; - SvxIconChoiceCtrlEntry* pHead = nullptr; // top left entry SvxIconChoiceCtrlEntry* pCursor; - SvxIconChoiceCtrlEntry* pHdlEntry; - SvxIconChoiceCtrlEntry* pAnchor; // for selection LocalFocus aFocus; // Data for focusrect ::vcl::AccessibleFactoryAccess aAccFactory; - SvxIconChoiceCtrlTextMode eTextMode; - SelectionMode eSelectionMode; - sal_Int32 nSelectionCount; SvxIconChoiceCtrlPositionMode ePositionMode; bool bBoundRectsDirty; - bool bUpdateMode; void ShowCursor( bool bShow ); - void ImpArrange( bool bKeepPredecessors ); + void ImpArrange(); void AdjustVirtSize( const tools::Rectangle& ); void ResetVirtSize(); void CheckScrollBars(); @@ -168,7 +152,6 @@ class SvxIconChoiceCtrl_Impl DECL_LINK( AutoArrangeHdl, Timer*, void ); DECL_LINK( DocRectChangedHdl, Timer*, void ); DECL_LINK( VisRectChangedHdl, Timer*, void ); - DECL_LINK( CallSelectHdlHdl, Timer*, void ); void AdjustScrollBars(); void PositionScrollBars( tools::Long nRealWidth, tools::Long nRealHeight ); @@ -189,34 +172,10 @@ class SvxIconChoiceCtrl_Impl void ToggleSelection( SvxIconChoiceCtrlEntry* ); void DeselectAllBut( SvxIconChoiceCtrlEntry const * ); void Center( SvxIconChoiceCtrlEntry* pEntry ) const; - void CallSelectHandler(); - void SelectRect( - SvxIconChoiceCtrlEntry* pEntry1, - SvxIconChoiceCtrlEntry* pEntry2, - bool bAdd, - std::vector* pOtherRects - ); - void SelectRange( - SvxIconChoiceCtrlEntry const * pStart, - SvxIconChoiceCtrlEntry const * pEnd, - bool bAdd - ); - - void AddSelectedRect( const tools::Rectangle& ); - void AddSelectedRect( - SvxIconChoiceCtrlEntry* pEntry1, - SvxIconChoiceCtrlEntry* pEntry2 - ); - - void ClearSelectedRectList(); tools::Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const; void ClipAtVirtOutRect( tools::Rectangle& rRect ) const; - GridId GetPredecessorGrid( const Point& rDocPos) const; - - void InitPredecessors(); - void ClearPredecessors(); bool CheckVerScrollBar(); bool CheckHorScrollBar(); @@ -237,7 +196,7 @@ class SvxIconChoiceCtrl_Impl void SetOrigin( const Point& ); void ShowFocus ( tools::Rectangle const & rRect ); - void DrawFocusRect(vcl::RenderContext& rRenderContext); + void DrawFocusRect(vcl::RenderContext& rRenderContext, SvxIconChoiceCtrlEntry* pEntry); bool IsMnemonicChar( sal_Unicode cChar, sal_uLong& rPos ) const; @@ -255,18 +214,12 @@ public: SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle ); ~SvxIconChoiceCtrl_Impl(); - void SetSelectionMode(SelectionMode eMode) - { - eSelectionMode = eMode; - } - void Clear( bool bInCtor ); void SetStyle( WinBits nWinStyle ); WinBits GetStyle() const { return nWinBits; } void InsertEntry( std::unique_ptr, size_t nPos ); void RemoveEntry( size_t nPos ); void FontModified(); - void SelectAll(); void SelectEntry( SvxIconChoiceCtrlEntry*, bool bSelect, @@ -274,28 +227,15 @@ public: ); void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect); bool MouseButtonDown( const MouseEvent& ); - bool MouseButtonUp( const MouseEvent& ); bool MouseMove( const MouseEvent&); bool RequestHelp( const HelpEvent& rHEvt ); - void SetCursor_Impl( - SvxIconChoiceCtrlEntry* pOldCursor, - SvxIconChoiceCtrlEntry* pNewCursor, - bool bMod1, - bool bShift - ); + void SetCursor_Impl(SvxIconChoiceCtrlEntry* pNewCursor); bool KeyInput( const KeyEvent& ); void Resize(); void GetFocus(); void LoseFocus(); - void SetUpdateMode( bool bUpdate ); - bool GetUpdateMode() const { return bUpdateMode; } void PaintEntry(SvxIconChoiceCtrlEntry*, const Point&, vcl::RenderContext& rRenderContext); - void SetEntryPos( - SvxIconChoiceCtrlEntry* pEntry, - const Point& rPos - ); - void InvalidateEntry( SvxIconChoiceCtrlEntry* ); void SetNoSelection(); @@ -307,18 +247,13 @@ public: void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, bool bBound = true ); - void Arrange( - bool bKeepPredecessors, - tools::Long nSetMaxVirtWidth, - tools::Long nSetMaxVirtHeight - ); + void Arrange(tools::Long nSetMaxVirtWidth, tools::Long nSetMaxVirtHeight); tools::Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* ); tools::Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = nullptr ); tools::Rectangle CalcTextRect( SvxIconChoiceCtrlEntry*, - const Point* pPos = nullptr, - const OUString* pStr = nullptr + const Point* pPos = nullptr ); tools::Long CalcBoundingWidth() const; @@ -351,25 +286,16 @@ public: void Command( const CommandEvent& rCEvt ); void ToTop( SvxIconChoiceCtrlEntry* ); - sal_Int32 GetSelectionCount() const; void SetGrid( const Size& ); Size GetMinGrid() const; void Scroll( tools::Long nDeltaX, tools::Long nDeltaY ); const Size& GetItemSize( IcnViewFieldType ) const; - void HideDDIcon(); - static bool IsOver( - std::vector* pSelectedRectList, + const std::vector& rRects, const tools::Rectangle& rEntryBoundRect ); - void SelectRect( - const tools::Rectangle&, - bool bAdd, - std::vector* pOtherRects - ); - void MakeVisible( const tools::Rectangle& rDocPos, bool bInScrollBarEvent=false @@ -378,7 +304,7 @@ public: #ifdef DBG_UTIL void SetEntryTextMode( SvxIconChoiceCtrlTextMode, - SvxIconChoiceCtrlEntry* pEntry + SvxIconChoiceCtrlEntry& rEntry ); #endif size_t GetEntryCount() const { return maEntries.size(); } @@ -395,19 +321,9 @@ public: void InitSettings(); tools::Rectangle GetOutputRect() const; - void SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor); - // only delivers valid results when in AutoArrange mode! - SvxIconChoiceCtrlEntry* FindEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, const Point& ); - void SetPositionMode( SvxIconChoiceCtrlPositionMode ); - void SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& ); - const SvxIconChoiceCtrlColumnInfo* GetColumn( sal_uInt16 nIndex ) const; - - void SetEntryHighlightFrame( - SvxIconChoiceCtrlEntry* pEntry, - bool bKeepHighlightFlags - ); + void SetEntryHighlightFrame(SvxIconChoiceCtrlEntry* pEntry); void DrawHighlightFrame(vcl::RenderContext& rRenderContext, const tools::Rectangle& rBmpRect); void CallEventListeners( VclEventId nEvent, void* pData ); diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index a52a8634ff4b..b92972a55937 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -59,15 +59,12 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( aAutoArrangeIdle( "svtools::SvxIconChoiceCtrl_Impl aAutoArrangeIdle" ), aDocRectChangedIdle( "svtools::SvxIconChoiceCtrl_Impl aDocRectChangedIdle" ), aVisRectChangedIdle( "svtools::SvxIconChoiceCtrl_Impl aVisRectChangedIdle" ), - aCallSelectHdlIdle( "svtools::SvxIconChoiceCtrl_Impl aCallSelectHdlIdle" ), aImageSize( 32 * pCurView->GetDPIScaleFactor(), 32 * pCurView->GetDPIScaleFactor()), pView(pCurView), nMaxVirtWidth(DEFAULT_MAX_VIRT_WIDTH), nMaxVirtHeight(DEFAULT_MAX_VIRT_HEIGHT), nFlags(IconChoiceFlags::NONE), nUserEventAdjustScrBars(nullptr), - pCurHighlightFrame(nullptr), bHighlightFramePressed(false), pHead(nullptr), pCursor(nullptr), - pHdlEntry(nullptr), - pAnchor(nullptr), eTextMode(SvxIconChoiceCtrlTextMode::Short), - eSelectionMode(SelectionMode::Multiple), ePositionMode(SvxIconChoiceCtrlPositionMode::Free), - bUpdateMode(true) + pCurHighlightFrame(nullptr), + pCursor(nullptr), + ePositionMode(SvxIconChoiceCtrlPositionMode::Free) { SetStyle( nWinStyle ); pImpCursor.reset( new IcnCursor_Impl( this ) ); @@ -82,9 +79,6 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( aAutoArrangeIdle.SetPriority( TaskPriority::HIGH_IDLE ); aAutoArrangeIdle.SetInvokeHandler(LINK(this,SvxIconChoiceCtrl_Impl,AutoArrangeHdl)); - aCallSelectHdlIdle.SetPriority( TaskPriority::LOWEST ); - aCallSelectHdlIdle.SetInvokeHandler( LINK(this,SvxIconChoiceCtrl_Impl,CallSelectHdlHdl)); - aDocRectChangedIdle.SetPriority( TaskPriority::HIGH_IDLE ); aDocRectChangedIdle.SetInvokeHandler(LINK(this,SvxIconChoiceCtrl_Impl,DocRectChangedHdl)); @@ -106,8 +100,6 @@ SvxIconChoiceCtrl_Impl::~SvxIconChoiceCtrl_Impl() CancelUserEvents(); pImpCursor.reset(); pGridMap.reset(); - ClearSelectedRectList(); - m_pColumns.reset(); aVerSBar.disposeAndClear(); aHorSBar.disposeAndClear(); aScrBarBox.disposeAndClear(); @@ -115,7 +107,6 @@ SvxIconChoiceCtrl_Impl::~SvxIconChoiceCtrl_Impl() void SvxIconChoiceCtrl_Impl::Clear( bool bInCtor ) { - nSelectionCount = 0; pCurHighlightFrame = nullptr; CancelUserEvents(); ShowCursor( false ); @@ -138,8 +129,7 @@ void SvxIconChoiceCtrl_Impl::Clear( bool bInCtor ) nMaxVirtHeight = DEFAULT_MAX_VIRT_HEIGHT; maZOrderList.clear(); SetOrigin( Point() ); - if( bUpdateMode ) - pView->Invalidate(InvalidateFlags::NoChildren); + pView->Invalidate(InvalidateFlags::NoChildren); } AdjustScrollBars(); maEntries.clear(); @@ -153,8 +143,6 @@ void SvxIconChoiceCtrl_Impl::SetStyle( WinBits nWinStyle ) nCurTextDrawFlags = DRAWTEXT_FLAGS_ICON; if( nWinBits & (WB_SMALLICON | WB_DETAILS) ) nCurTextDrawFlags = DRAWTEXT_FLAGS_SMALLICON; - if( nWinBits & WB_NOSELECTION ) - eSelectionMode = SelectionMode::NONE; if( !(nWinStyle & (WB_ALIGN_TOP | WB_ALIGN_LEFT))) nWinBits |= WB_ALIGN_LEFT; } @@ -188,9 +176,6 @@ void SvxIconChoiceCtrl_Impl::InsertEntry( std::unique_ptrSetBacklink( pHead->pblink ); - if( (nFlags & IconChoiceFlags::EntryListPosValid) && nPos >= maEntries.size() - 1 ) pEntry->nPos = maEntries.size() - 1; else @@ -199,21 +184,16 @@ void SvxIconChoiceCtrl_Impl::InsertEntry( std::unique_ptrClear(); - // If the UpdateMode is true, don't set all bounding rectangles to + // don't set all bounding rectangles to // 'to be checked', but only the bounding rectangle of the new entry. // Thus, don't call InvalidateBoundingRect! pEntry->aRect.SetRight( LONG_MAX ); - if( bUpdateMode ) - { - FindBoundingRect( pEntry ); - tools::Rectangle aOutputArea( GetOutputRect() ); - pGridMap->OccupyGrids( pEntry ); - if( !aOutputArea.Overlaps( pEntry->aRect ) ) - return; // is invisible - pView->Invalidate( pEntry->aRect ); - } - else - InvalidateBoundingRect( pEntry->aRect ); + FindBoundingRect(pEntry); + tools::Rectangle aOutputArea(GetOutputRect()); + pGridMap->OccupyGrids(pEntry); + if (!aOutputArea.Overlaps(pEntry->aRect)) + return; // is invisible + pView->Invalidate(pEntry->aRect); } void SvxIconChoiceCtrl_Impl::RemoveEntry(size_t nPos) @@ -248,8 +228,6 @@ void SvxIconChoiceCtrl_Impl::SetListPositions() void SvxIconChoiceCtrl_Impl::SelectEntry( SvxIconChoiceCtrlEntry* pEntry, bool bSelect, bool bAdd ) { - if( eSelectionMode == SelectionMode::NONE ) - return; if( !bAdd ) { @@ -263,48 +241,38 @@ void SvxIconChoiceCtrl_Impl::SelectEntry( SvxIconChoiceCtrlEntry* pEntry, bool b if( pEntry->IsSelected() == bSelect ) return; - pHdlEntry = pEntry; SvxIconViewFlags nEntryFlags = pEntry->GetFlags(); if( bSelect ) { nEntryFlags |= SvxIconViewFlags::SELECTED; pEntry->AssignFlags( nEntryFlags ); - nSelectionCount++; - CallSelectHandler(); + pView->ClickIcon(); } else { nEntryFlags &= ~SvxIconViewFlags::SELECTED; pEntry->AssignFlags( nEntryFlags ); - nSelectionCount--; - CallSelectHandler(); + pView->ClickIcon(); } EntrySelected( pEntry, bSelect ); } void SvxIconChoiceCtrl_Impl::EntrySelected(SvxIconChoiceCtrlEntry* pEntry, bool bSelect) { - // When using SingleSelection, make sure that the cursor is always placed + // make sure that the cursor is always placed // over the (only) selected entry. (But only if a cursor exists.) - if (bSelect && pCursor && - eSelectionMode == SelectionMode::Single && - pEntry != pCursor) + if (bSelect && pCursor && pEntry != pCursor) { SetCursor(pEntry); } - // Not when dragging though, else the loop in SelectRect doesn't work - // correctly! - if (!(nFlags & IconChoiceFlags::SelectingRect)) - ToTop(pEntry); - if (bUpdateMode) - { - if (pEntry == pCursor) - ShowCursor(false); - pView->Invalidate(CalcFocusRect(pEntry)); - if (pEntry == pCursor) - ShowCursor(true); - } + ToTop(pEntry); + + if (pEntry == pCursor) + ShowCursor(false); + pView->Invalidate(CalcFocusRect(pEntry)); + if (pEntry == pCursor) + ShowCursor(true); // #i101012# emit vcl event LISTBOX_SELECT only in case that the given entry is selected. if (bSelect) @@ -321,17 +289,7 @@ void SvxIconChoiceCtrl_Impl::ResetVirtSize() for( size_t nCur = 0; nCur < nCount; nCur++ ) { SvxIconChoiceCtrlEntry* pCur = maEntries[ nCur ].get(); - pCur->ClearFlags( SvxIconViewFlags::POS_MOVED ); - if( pCur->IsPosLocked() ) - { - // adapt (among others) VirtSize - if( !IsBoundingRectValid( pCur->aRect ) ) - FindBoundingRect( pCur ); - else - AdjustVirtSize( pCur->aRect ); - } - else - InvalidateBoundingRect( pCur->aRect ); + InvalidateBoundingRect(pCur->aRect); } if( !(nWinBits & (WB_NOVSCROLL | WB_NOHSCROLL)) ) @@ -386,48 +344,7 @@ void SvxIconChoiceCtrl_Impl::AdjustVirtSize( const tools::Rectangle& rRect ) DocRectChanged(); } -void SvxIconChoiceCtrl_Impl::InitPredecessors() -{ - DBG_ASSERT(!pHead,"SvxIconChoiceCtrl_Impl::InitPredecessors() >> Already initialized"); - size_t nCount = maEntries.size(); - if( nCount ) - { - SvxIconChoiceCtrlEntry* pPrev = maEntries[ 0 ].get(); - for( size_t nCur = 1; nCur <= nCount; nCur++ ) - { - pPrev->ClearFlags( SvxIconViewFlags::POS_LOCKED | SvxIconViewFlags::POS_MOVED ); - - SvxIconChoiceCtrlEntry* pNext; - if( nCur == nCount ) - pNext = maEntries[ 0 ].get(); - else - pNext = maEntries[ nCur ].get(); - pPrev->pflink = pNext; - pNext->pblink = pPrev; - pPrev = pNext; - } - pHead = maEntries[ 0 ].get(); - } - else - pHead = nullptr; -} - -void SvxIconChoiceCtrl_Impl::ClearPredecessors() -{ - if( pHead ) - { - size_t nCount = maEntries.size(); - for( size_t nCur = 0; nCur < nCount; nCur++ ) - { - SvxIconChoiceCtrlEntry* pCur = maEntries[ nCur ].get(); - pCur->pflink = nullptr; - pCur->pblink = nullptr; - } - pHead = nullptr; - } -} - -void SvxIconChoiceCtrl_Impl::Arrange( bool bKeepPredecessors, tools::Long nSetMaxVirtWidth, tools::Long nSetMaxVirtHeight ) +void SvxIconChoiceCtrl_Impl::Arrange(tools::Long nSetMaxVirtWidth, tools::Long nSetMaxVirtHeight ) { if ( nSetMaxVirtWidth != 0 ) nMaxVirtWidth = nSetMaxVirtWidth; @@ -439,23 +356,15 @@ void SvxIconChoiceCtrl_Impl::Arrange( bool bKeepPredecessors, tools::Long nSetMa else nMaxVirtHeight = aOutputSize.Height(); - ImpArrange( bKeepPredecessors ); + ImpArrange(); } -void SvxIconChoiceCtrl_Impl::ImpArrange( bool bKeepPredecessors ) +void SvxIconChoiceCtrl_Impl::ImpArrange() { - static const Point aEmptyPoint; - - bool bOldUpdate = bUpdateMode; - tools::Rectangle aCurOutputArea( GetOutputRect() ); - if( (nWinBits & WB_SMART_ARRANGE) && aCurOutputArea.TopLeft() != aEmptyPoint ) - bUpdateMode = false; aAutoArrangeIdle.Stop(); nFlags |= IconChoiceFlags::Arranging; ShowCursor( false ); ResetVirtSize(); - if( !bKeepPredecessors ) - ClearPredecessors(); bBoundRectsDirty = false; SetOrigin( Point() ); VisRectChanged(); @@ -464,11 +373,6 @@ void SvxIconChoiceCtrl_Impl::ImpArrange( bool bKeepPredecessors ) //if( !(nWinBits & WB_DETAILS )) pView->Invalidate( InvalidateFlags::NoChildren ); nFlags &= ~IconChoiceFlags::Arranging; - if( (nWinBits & WB_SMART_ARRANGE) && aCurOutputArea.TopLeft() != aEmptyPoint ) - { - MakeVisible( aCurOutputArea ); - SetUpdateMode( bOldUpdate ); - } ShowCursor( true ); } @@ -569,14 +473,9 @@ void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const too void SvxIconChoiceCtrl_Impl::RepaintSelectedEntries() { - const size_t nCount = maZOrderList.size(); - if (!nCount) - return; - tools::Rectangle aOutRect(GetOutputRect()); - for (size_t nCur = 0; nCur < nCount; nCur++) + for (SvxIconChoiceCtrlEntry* pEntry : maZOrderList) { - SvxIconChoiceCtrlEntry* pEntry = maZOrderList[nCur]; if (pEntry->GetFlags() & SvxIconViewFlags::SELECTED) { const tools::Rectangle& rBoundRect = GetEntryBoundRect(pEntry); @@ -596,8 +495,6 @@ void SvxIconChoiceCtrl_Impl::InitScrollBarBox() bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) { bool bHandled = true; - bHighlightFramePressed = false; - bool bGotFocus = (!pView->HasFocus() && !(nWinBits & WB_NOPOINTERFOCUS)); if( !(nWinBits & WB_NOPOINTERFOCUS) ) pView->GrabFocus(); @@ -609,74 +506,13 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) if( pEntry ) MakeEntryVisible( pEntry, false ); - if( rMEvt.IsShift() && eSelectionMode != SelectionMode::Single ) - { - if( pEntry ) - SetCursor_Impl( pCursor, pEntry, rMEvt.IsMod1(), rMEvt.IsShift() ); - return true; - } - - if( pAnchor && (rMEvt.IsShift() || rMEvt.IsMod1())) // keyboard selection? - { - DBG_ASSERT(eSelectionMode != SelectionMode::Single,"Invalid selection mode"); - if( rMEvt.IsMod1() ) - nFlags |= IconChoiceFlags::AddMode; - - if( rMEvt.IsShift() ) - { - tools::Rectangle aRect( GetEntryBoundRect( pAnchor )); - if( pEntry ) - aRect.Union( GetEntryBoundRect( pEntry ) ); - else - { - tools::Rectangle aTempRect( aDocPos, Size(1,1)); - aRect.Union( aTempRect ); - } - aCurSelectionRect = aRect; - SelectRect( aRect, bool(nFlags & IconChoiceFlags::AddMode), &aSelectedRectList ); - } - else if( rMEvt.IsMod1() ) - { - AddSelectedRect( aCurSelectionRect ); - pAnchor = nullptr; - aCurSelectionRect.SetPos( aDocPos ); - } - - if( !pEntry && !(nWinBits & WB_NODRAGSELECTION)) - pView->StartTracking( StartTrackingFlags::ScrollRepeat ); - return true; - } - else - { - if( !pEntry ) - { - if( eSelectionMode == SelectionMode::Multiple ) - { - if( !rMEvt.IsMod1() ) // Ctrl - { - if( !bGotFocus ) - { - SetNoSelection(); - ClearSelectedRectList(); - } - } - else - nFlags |= IconChoiceFlags::AddMode; - aCurSelectionRect.SetPos( aDocPos ); - pView->StartTracking( StartTrackingFlags::ScrollRepeat ); - } - else - bHandled = false; - return bHandled; - } - } - bool bSelected = pEntry->IsSelected(); + if( !pEntry ) + return false; if( rMEvt.GetClicks() == 2 ) { DeselectAllBut( pEntry ); SelectEntry( pEntry, true, false ); - pHdlEntry = pEntry; pView->ClickIcon(); } else @@ -685,91 +521,11 @@ bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) if( rMEvt.IsMod2() ) // Alt? { } - else if( eSelectionMode == SelectionMode::Single ) + else { DeselectAllBut( pEntry ); SetCursor( pEntry ); } - else if( eSelectionMode == SelectionMode::NONE ) - { - if( rMEvt.IsLeft() && (nWinBits & WB_HIGHLIGHTFRAME) ) - { - pCurHighlightFrame = nullptr; // force repaint of frame - bHighlightFramePressed = true; - SetEntryHighlightFrame( pEntry, true ); - } - } - else - { - if( !rMEvt.GetModifier() && rMEvt.IsLeft() ) - { - if( !bSelected ) - { - DeselectAllBut( pEntry ); - SetCursor( pEntry ); - SelectEntry( pEntry, true, false ); - } - else - { - // deselect only in the Up, if the Move happened via D&D! - nFlags |= IconChoiceFlags::DownDeselect; - } - } - else if( rMEvt.IsMod1() ) - nFlags |= IconChoiceFlags::DownCtrl; - } - } - return bHandled; -} - -bool SvxIconChoiceCtrl_Impl::MouseButtonUp( const MouseEvent& rMEvt ) -{ - bool bHandled = false; - if( rMEvt.IsRight() && (nFlags & (IconChoiceFlags::DownCtrl | IconChoiceFlags::DownDeselect) )) - { - nFlags &= ~IconChoiceFlags(IconChoiceFlags::DownCtrl | IconChoiceFlags::DownDeselect); - bHandled = true; - } - - Point aDocPos( rMEvt.GetPosPixel() ); - ToDocPos( aDocPos ); - SvxIconChoiceCtrlEntry* pDocEntry = GetEntry( aDocPos ); - if( pDocEntry ) - { - if( nFlags & IconChoiceFlags::DownCtrl ) - { - // Ctrl & MultiSelection - ToggleSelection( pDocEntry ); - SetCursor( pDocEntry ); - bHandled = true; - } - else if( nFlags & IconChoiceFlags::DownDeselect ) - { - DeselectAllBut( pDocEntry ); - SetCursor( pDocEntry ); - SelectEntry( pDocEntry, true, false ); - bHandled = true; - } - } - - nFlags &= ~IconChoiceFlags(IconChoiceFlags::DownCtrl | IconChoiceFlags::DownDeselect); - - if((nWinBits & WB_HIGHLIGHTFRAME) && bHighlightFramePressed && pCurHighlightFrame) - { - bHandled = true; - SvxIconChoiceCtrlEntry* pEntry = pCurHighlightFrame; - pCurHighlightFrame = nullptr; // force repaint of frame - bHighlightFramePressed = false; - SetEntryHighlightFrame( pEntry, true ); - - pHdlEntry = pCurHighlightFrame; - pView->ClickIcon(); - - // set focus on Icon - SvxIconChoiceCtrlEntry* pOldCursor = pCursor; - SetCursor_Impl( pOldCursor, pHdlEntry, false, false ); - - pHdlEntry = nullptr; } return bHandled; } @@ -783,59 +539,24 @@ bool SvxIconChoiceCtrl_Impl::MouseMove( const MouseEvent& rMEvt ) else if( nWinBits & WB_HIGHLIGHTFRAME ) { SvxIconChoiceCtrlEntry* pEntry = GetEntry( aDocPos ); - SetEntryHighlightFrame( pEntry, false ); + SetEntryHighlightFrame(pEntry); } else return false; return true; } -void SvxIconChoiceCtrl_Impl::SetCursor_Impl( SvxIconChoiceCtrlEntry* pOldCursor, - SvxIconChoiceCtrlEntry* pNewCursor, bool bMod1, bool bShift ) +void SvxIconChoiceCtrl_Impl::SetCursor_Impl(SvxIconChoiceCtrlEntry* pNewCursor) { if( !pNewCursor ) return; - SvxIconChoiceCtrlEntry* pFilterEntry = nullptr; - bool bDeselectAll = false; - if( eSelectionMode != SelectionMode::Single ) - { - if( !bMod1 && !bShift ) - bDeselectAll = true; - else if( bShift && !bMod1 && !pAnchor ) - { - bDeselectAll = true; - pFilterEntry = pOldCursor; - } - } - if( bDeselectAll ) - DeselectAllBut( pFilterEntry ); ShowCursor( false ); MakeEntryVisible( pNewCursor ); SetCursor( pNewCursor ); - if( bMod1 && !bShift ) - { - if( pAnchor ) - { - AddSelectedRect( pAnchor, pOldCursor ); - pAnchor = nullptr; - } - } - else if( bShift ) - { - if( !pAnchor ) - pAnchor = pOldCursor; - if ( nWinBits & WB_ALIGN_LEFT ) - SelectRange( pAnchor, pNewCursor, bool(nFlags & IconChoiceFlags::AddMode) ); - else - SelectRect(pAnchor,pNewCursor, bool(nFlags & IconChoiceFlags::AddMode), &aSelectedRectList); - } - else - { - SelectEntry( pCursor, true, false ); - aCurSelectionRect = GetEntryBoundRect( pCursor ); - CallEventListeners( VclEventId::ListboxSelect, pCursor ); - } + + SelectEntry( pCursor, true, false ); + CallEventListeners( VclEventId::ListboxSelect, pCursor ); } bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) @@ -849,7 +570,7 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) SvxIconChoiceCtrlEntry* pNewCursor = GetEntry( nPos ); SvxIconChoiceCtrlEntry* pOldCursor = pCursor; if ( pNewCursor != pOldCursor ) - SetCursor_Impl( pOldCursor, pNewCursor, false, false ); + SetCursor_Impl(pNewCursor); return true; } @@ -858,20 +579,8 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) return false; bool bKeyUsed = true; - bool bMod1 = rKEvt.GetKeyCode().IsMod1(); - bool bShift = rKEvt.GetKeyCode().IsShift(); - - if( eSelectionMode == SelectionMode::Single || eSelectionMode == SelectionMode::NONE) - { - bShift = false; - bMod1 = false; - } - - if( bMod1 ) - nFlags |= IconChoiceFlags::AddMode; SvxIconChoiceCtrlEntry* pNewCursor; - SvxIconChoiceCtrlEntry* pOldCursor = pCursor; sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); switch( nCode ) @@ -885,7 +594,7 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) pNewCursor = pImpCursor->GoUpDown(pCursor,false); else pNewCursor = pImpCursor->GoPageUpDown(pCursor,false); - SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift ); + SetCursor_Impl(pNewCursor); if( !pNewCursor ) { tools::Rectangle aRect( GetEntryBoundRect( pCursor ) ); @@ -907,7 +616,7 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) pNewCursor=pImpCursor->GoUpDown( pCursor,true ); else pNewCursor=pImpCursor->GoPageUpDown( pCursor,true ); - SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift ); + SetCursor_Impl(pNewCursor); } break; @@ -915,7 +624,7 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) if( pCursor ) { pNewCursor=pImpCursor->GoLeftRight(pCursor,true ); - SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift ); + SetCursor_Impl(pNewCursor); } break; @@ -924,7 +633,7 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) { MakeEntryVisible( pCursor ); pNewCursor = pImpCursor->GoLeftRight(pCursor,false ); - SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift ); + SetCursor_Impl(pNewCursor); if( !pNewCursor ) { tools::Rectangle aRect( GetEntryBoundRect(pCursor)); @@ -939,8 +648,6 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) break; case KEY_F2: - if( bMod1 || bShift ) - bKeyUsed = false; break; case KEY_F8: @@ -956,23 +663,6 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) break; case KEY_SPACE: - if( pCursor && eSelectionMode != SelectionMode::Single ) - { - if( !bMod1 ) - { - //SelectAll( false ); - SetNoSelection(); - ClearSelectedRectList(); - - // click Icon with spacebar - SetEntryHighlightFrame( GetCurEntry(), true ); - pView->ClickIcon(); - pHdlEntry = pCurHighlightFrame; - pCurHighlightFrame=nullptr; - } - else - ToggleSelection( pCursor ); - } break; #ifdef DBG_UTIL @@ -980,12 +670,12 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) if( rKEvt.GetKeyCode().IsShift() ) { if( pCursor ) - pView->SetEntryTextMode( SvxIconChoiceCtrlTextMode::Full, pCursor ); + SetEntryTextMode(SvxIconChoiceCtrlTextMode::Full, *pCursor); } if( rKEvt.GetKeyCode().IsMod1() ) { if( pCursor ) - pView->SetEntryTextMode( SvxIconChoiceCtrlTextMode::Short, pCursor ); + SetEntryTextMode(SvxIconChoiceCtrlTextMode::Short, *pCursor); } break; #endif @@ -993,30 +683,23 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) case KEY_ADD: case KEY_DIVIDE : case KEY_A: - if( bMod1 && (eSelectionMode != SelectionMode::Single)) - SelectAll(); - else bKeyUsed = false; break; case KEY_SUBTRACT: case KEY_COMMA : - if( bMod1 ) - SetNoSelection(); - else - bKeyUsed = false; + bKeyUsed = false; break; case KEY_RETURN: - if( !bMod1 ) - bKeyUsed = false; + bKeyUsed = false; break; case KEY_END: if( pCursor ) { pNewCursor = maEntries.back().get(); - SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift ); + SetCursor_Impl(pNewCursor); } break; @@ -1024,7 +707,7 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) if( pCursor ) { pNewCursor = maEntries[ 0 ].get(); - SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift ); + SetCursor_Impl(pNewCursor); } break; @@ -1316,21 +999,6 @@ void SvxIconChoiceCtrl_Impl::LoseFocus() RepaintSelectedEntries(); } -void SvxIconChoiceCtrl_Impl::SetUpdateMode( bool bUpdate ) -{ - if( bUpdate != bUpdateMode ) - { - bUpdateMode = bUpdate; - if( bUpdate ) - { - AdjustScrollBars(); - pImpCursor->Clear(); - pGridMap->Clear(); - pView->Invalidate(InvalidateFlags::NoChildren); - } - } -} - // priorities of the emphasis: bSelected void SvxIconChoiceCtrl_Impl::PaintEmphasis(const tools::Rectangle& rTextRect, bool bSelected, vcl::RenderContext& rRenderContext) @@ -1363,16 +1031,10 @@ void SvxIconChoiceCtrl_Impl::PaintItem(const tools::Rectangle& rRect, { if (eItem == IcnViewFieldType::Text) { - OUString aText = SvtIconChoiceCtrl::GetEntryText(pEntry); - - rRenderContext.DrawText(rRect, aText, nCurTextDrawFlags); + rRenderContext.DrawText(rRect, pEntry->GetText(), nCurTextDrawFlags); if (pEntry->IsFocused()) - { - tools::Rectangle aRect (CalcFocusRect(pEntry)); - ShowFocus(aRect); - DrawFocusRect(rRenderContext); - } + DrawFocusRect(rRenderContext, pEntry); } else { @@ -1381,28 +1043,22 @@ void SvxIconChoiceCtrl_Impl::PaintItem(const tools::Rectangle& rRect, aPos.AdjustX((rRect.GetWidth() - aImageSize.Width()) / 2 ); if (nPaintFlags & PAINTFLAG_VER_CENTERED) aPos.AdjustY((rRect.GetHeight() - aImageSize.Height()) / 2 ); - SvtIconChoiceCtrl::DrawEntryImage(pEntry, aPos, rRenderContext); + rRenderContext.DrawImage(aPos, pEntry->GetImage()); } } void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Point& rPos, vcl::RenderContext& rRenderContext) { - bool bSelected = false; - - if (eSelectionMode != SelectionMode::NONE) - bSelected = pEntry->IsSelected(); + bool bSelected = pEntry->IsSelected(); rRenderContext.Push(vcl::PushFlags::FONT | vcl::PushFlags::TEXTCOLOR); - OUString aEntryText(SvtIconChoiceCtrl::GetEntryText(pEntry)); - tools::Rectangle aTextRect(CalcTextRect(pEntry, &rPos, &aEntryText)); + tools::Rectangle aTextRect(CalcTextRect(pEntry, &rPos)); tools::Rectangle aBmpRect(CalcBmpRect(pEntry, &rPos)); - bool bShowSelection = (bSelected && (eSelectionMode != SelectionMode::NONE)); - bool bActiveSelection = (0 != (nWinBits & WB_NOHIDESELECTION)) || pView->HasFocus(); - if (bShowSelection) + if (bSelected) { const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings(); vcl::Font aNewFont(rRenderContext.GetFont()); @@ -1446,9 +1102,9 @@ void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po PaintEmphasis(aTextRect, bSelected, rRenderContext); - if ( bShowSelection ) + if (bSelected) vcl::RenderTools::DrawSelectionBackground(rRenderContext, *pView, CalcFocusRect(pEntry), - bActiveSelection ? 1 : 2, false, true, false); + bActiveSelection ? 1 : 2, false, false, false); PaintItem(aBmpRect, IcnViewFieldType::Image, pEntry, nBmpPaintFlags, rRenderContext); @@ -1464,41 +1120,6 @@ void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po rRenderContext.SetClipRegion(); } -void SvxIconChoiceCtrl_Impl::SetEntryPos( SvxIconChoiceCtrlEntry* pEntry, const Point& rPos ) -{ - ShowCursor( false ); - tools::Rectangle aBoundRect( GetEntryBoundRect( pEntry )); - pView->Invalidate( aBoundRect ); - ToTop( pEntry ); - if( !IsAutoArrange() ) - { - bool bAdjustVirtSize = false; - if( rPos != aBoundRect.TopLeft() ) - { - Point aGridOffs( - pEntry->aGridRect.TopLeft() - pEntry->aRect.TopLeft() ); - pImpCursor->Clear(); - pGridMap->Clear(); - aBoundRect.SetPos( rPos ); - pEntry->aRect = aBoundRect; - pEntry->aGridRect.SetPos( rPos + aGridOffs ); - bAdjustVirtSize = true; - } - if( bAdjustVirtSize ) - AdjustVirtSize( pEntry->aRect ); - - pView->Invalidate( pEntry->aRect ); - pGridMap->OccupyGrids( pEntry ); - } - else - { - SvxIconChoiceCtrlEntry* pPrev = FindEntryPredecessor( pEntry, rPos ); - SetEntryPredecessor( pEntry, pPrev ); - aAutoArrangeIdle.Start(); - } - ShowCursor( true ); -} - void SvxIconChoiceCtrl_Impl::SetNoSelection() { // block recursive calls via SelectEntry @@ -1581,19 +1202,14 @@ tools::Rectangle SvxIconChoiceCtrl_Impl::CalcBmpRect( SvxIconChoiceCtrlEntry* pE } tools::Rectangle SvxIconChoiceCtrl_Impl::CalcTextRect( SvxIconChoiceCtrlEntry* pEntry, - const Point* pEntryPos, const OUString* pStr ) + const Point* pEntryPos) { - OUString aEntryText; - if( !pStr ) - aEntryText = SvtIconChoiceCtrl::GetEntryText( pEntry ); - else - aEntryText = *pStr; - const tools::Rectangle aMaxTextRect( CalcMaxTextRect( pEntry ) ); tools::Rectangle aBound( GetEntryBoundRect( pEntry ) ); if( pEntryPos ) aBound.SetPos( *pEntryPos ); + const OUString aEntryText = pEntry->GetText(); tools::Rectangle aTextRect = pView->GetTextRect( aMaxTextRect, aEntryText, nCurTextDrawFlags ); Size aTextSize( aTextRect.GetSize() ); @@ -1690,53 +1306,24 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() SvxIconChoiceCtrlEntry* pEntry; const size_t nCount = maEntries.size(); - if( !IsAutoArrange() || !pHead ) + for( nCur = 0; nCur < nCount; nCur++ ) { - for( nCur = 0; nCur < nCount; nCur++ ) + pEntry = maEntries[ nCur ].get(); + if( IsBoundingRectValid( pEntry->aRect )) { - pEntry = maEntries[ nCur ].get(); - if( IsBoundingRectValid( pEntry->aRect )) - { - Size aBoundSize( pEntry->aRect.GetSize() ); - if( aBoundSize.Height() > nMaxBoundHeight ) - nMaxBoundHeight = aBoundSize.Height(); - } - else - FindBoundingRect( pEntry ); - maZOrderList.push_back( pEntry ); - } - } - else - { - nCur = 0; - pEntry = pHead; - while( nCur != nCount ) - { - DBG_ASSERT(pEntry->pflink&&pEntry->pblink,"SvxIconChoiceCtrl_Impl::RecalcAllBoundingRect > Bad link(s)"); - if( IsBoundingRectValid( pEntry->aRect )) - { - Size aBoundSize( pEntry->aRect.GetSize() ); - if( aBoundSize.Height() > nMaxBoundHeight ) - nMaxBoundHeight = aBoundSize.Height(); - } - else - FindBoundingRect( pEntry ); - maZOrderList.push_back( pEntry ); - pEntry = pEntry->pflink; - nCur++; + Size aBoundSize( pEntry->aRect.GetSize() ); + if( aBoundSize.Height() > nMaxBoundHeight ) + nMaxBoundHeight = aBoundSize.Height(); } + else + FindBoundingRect( pEntry ); + maZOrderList.push_back( pEntry ); } AdjustScrollBars(); } void SvxIconChoiceCtrl_Impl::FindBoundingRect( SvxIconChoiceCtrlEntry* pEntry ) { - DBG_ASSERT(!pEntry->IsPosLocked(),"Locked entry pos in FindBoundingRect"); - if( pEntry->IsPosLocked() && IsBoundingRectValid( pEntry->aRect) ) - { - AdjustVirtSize( pEntry->aRect ); - return; - } Size aSize( CalcBoundingSize() ); Point aPos(pGridMap->GetGridRect(pGridMap->GetUnoccupiedGrid()).TopLeft()); SetBoundingRect_Impl( pEntry, aPos, aSize ); @@ -1757,8 +1344,7 @@ void SvxIconChoiceCtrl_Impl::SetCursor( SvxIconChoiceCtrlEntry* pEntry ) { if( pEntry == pCursor ) { - if( pCursor && eSelectionMode == SelectionMode::Single && - !pCursor->IsSelected() ) + if (pCursor && !pCursor->IsSelected()) SelectEntry( pCursor, true ); return; } @@ -1768,15 +1354,13 @@ void SvxIconChoiceCtrl_Impl::SetCursor( SvxIconChoiceCtrlEntry* pEntry ) if( pOldCursor ) { pOldCursor->ClearFlags( SvxIconViewFlags::FOCUSED ); - if( eSelectionMode == SelectionMode::Single ) - SelectEntry( pOldCursor, false ); // deselect old cursor + SelectEntry(pOldCursor, false); // deselect old cursor } if( pCursor ) { ToTop( pCursor ); pCursor->SetFlags( SvxIconViewFlags::FOCUSED ); - if( eSelectionMode == SelectionMode::Single ) - SelectEntry( pCursor, true ); + SelectEntry(pCursor, true); ShowCursor( true ); } } @@ -1793,12 +1377,6 @@ void SvxIconChoiceCtrl_Impl::ShowCursor( bool bShow ) /*pView->*/ShowFocus( aRect ); } - -void SvxIconChoiceCtrl_Impl::HideDDIcon() -{ - pView->PaintImmediately(); -} - bool SvxIconChoiceCtrl_Impl::HandleScrollCommand( const CommandEvent& rCmd ) { tools::Rectangle aDocRect( Point(), aVirtOutputSize ); @@ -1964,12 +1542,9 @@ void SvxIconChoiceCtrl_Impl::MakeVisible( const tools::Rectangle& rRect, bool bS aOrigin.AdjustX(nDx ); aOrigin.AdjustY(nDy ); aOutputArea.SetPos( aOrigin ); - if( GetUpdateMode() ) - { - HideDDIcon(); - pView->PaintImmediately(); - ShowCursor( false ); - } + + pView->PaintImmediately(); + ShowCursor(false); // invert origin for SV (so we can scroll/paint using document coordinates) aOrigin *= -1; @@ -1977,7 +1552,7 @@ void SvxIconChoiceCtrl_Impl::MakeVisible( const tools::Rectangle& rRect, bool bS bool bScrollable = pView->GetBackground().IsScrollable(); - if( bScrollable && GetUpdateMode() ) + if (bScrollable) { // scroll in reverse direction! pView->Control::Scroll( -nDx, -nDy, aOutputArea, @@ -1999,12 +1574,11 @@ void SvxIconChoiceCtrl_Impl::MakeVisible( const tools::Rectangle& rRect, bool bS } } - if( GetUpdateMode() ) - ShowCursor( true ); + ShowCursor(true); // check if we still need scrollbars CheckScrollBars(); - if( bScrollable && GetUpdateMode() ) + if (bScrollable) pView->PaintImmediately(); // If the requested area can not be made completely visible, the @@ -2014,13 +1588,6 @@ void SvxIconChoiceCtrl_Impl::MakeVisible( const tools::Rectangle& rRect, bool bS VisRectChanged(); } -sal_Int32 SvxIconChoiceCtrl_Impl::GetSelectionCount() const -{ - if( (nWinBits & WB_HIGHLIGHTFRAME) && pCurHighlightFrame ) - return 1; - return nSelectionCount; -} - void SvxIconChoiceCtrl_Impl::ToggleSelection( SvxIconChoiceCtrlEntry* pEntry ) { bool bSel; @@ -2030,8 +1597,6 @@ void SvxIconChoiceCtrl_Impl::ToggleSelection( SvxIconChoiceCtrlEntry* pEntry ) void SvxIconChoiceCtrl_Impl::DeselectAllBut( SvxIconChoiceCtrlEntry const * pThisEntryNot ) { - ClearSelectedRectList(); - // TODO: work through z-order list, if necessary! size_t nCount = maEntries.size(); @@ -2041,7 +1606,6 @@ void SvxIconChoiceCtrl_Impl::DeselectAllBut( SvxIconChoiceCtrlEntry const * pThi if( pEntry != pThisEntryNot && pEntry->IsSelected() ) SelectEntry( pEntry, false, true ); } - pAnchor = nullptr; nFlags &= ~IconChoiceFlags::AddMode; } @@ -2077,14 +1641,6 @@ void SvxIconChoiceCtrl_Impl::SetGrid( const Size& rSize ) aSize.setHeight( aMinSize.Height() ); nGridDX = aSize.Width(); - // HACK: Detail mode is not yet fully implemented, this workaround makes it - // fly with a single column - if( nWinBits & WB_DETAILS ) - { - const SvxIconChoiceCtrlColumnInfo* pCol = GetColumn( 0 ); - if( pCol ) - const_cast(pCol)->SetWidth( nGridDX ); - } nGridDY = aSize.Height(); SetDefaultTextSize(); } @@ -2214,210 +1770,20 @@ tools::Rectangle SvxIconChoiceCtrl_Impl::CalcFocusRect( SvxIconChoiceCtrlEntry* aTextRect.Bottom()); } -// the hot spot is the inner 50% of the rectangle -static tools::Rectangle GetHotSpot( const tools::Rectangle& rRect ) +bool SvxIconChoiceCtrl_Impl::IsOver(const std::vector& rRects, const tools::Rectangle& rBoundRect) { - tools::Rectangle aResult( rRect ); - aResult.Normalize(); - Size aSize( rRect.GetSize() ); - tools::Long nDelta = aSize.Width() / 4; - aResult.AdjustLeft(nDelta ); - aResult.AdjustRight( -nDelta ); - nDelta = aSize.Height() / 4; - aResult.AdjustTop(nDelta ); - aResult.AdjustBottom( -nDelta ); - return aResult; -} - -void SvxIconChoiceCtrl_Impl::SelectRect( SvxIconChoiceCtrlEntry* pEntry1, SvxIconChoiceCtrlEntry* pEntry2, - bool bAdd, std::vector* pOtherRects ) -{ - DBG_ASSERT(pEntry1 && pEntry2,"SelectEntry: Invalid Entry-Ptr"); - tools::Rectangle aRect( GetEntryBoundRect( pEntry1 ) ); - aRect.Union( GetEntryBoundRect( pEntry2 ) ); - SelectRect( aRect, bAdd, pOtherRects ); -} - -void SvxIconChoiceCtrl_Impl::SelectRect( const tools::Rectangle& rRect, bool bAdd, - std::vector* pOtherRects ) -{ - aCurSelectionRect = rRect; - if( maZOrderList.empty() ) - return; - - // set flag, so ToTop won't be called in Select - bool bAlreadySelectingRect(nFlags & IconChoiceFlags::SelectingRect); - nFlags |= IconChoiceFlags::SelectingRect; - - CheckBoundingRects(); - pView->PaintImmediately(); - const size_t nCount = maZOrderList.size(); - - tools::Rectangle aRect( rRect ); - aRect.Normalize(); - bool bCalcOverlap = (bAdd && pOtherRects && !pOtherRects->empty()); - - bool bResetClipRegion = false; - if( !pView->GetOutDev()->IsClipRegion() ) + for (const tools::Rectangle& rRect : rRects) { - bResetClipRegion = true; - pView->GetOutDev()->SetClipRegion(vcl::Region(GetOutputRect())); - } - - for( size_t nPos = 0; nPos < nCount; nPos++ ) - { - SvxIconChoiceCtrlEntry* pEntry = maZOrderList[ nPos ]; - - if( !IsBoundingRectValid( pEntry->aRect )) - FindBoundingRect( pEntry ); - tools::Rectangle aBoundRect( GetHotSpot( pEntry->aRect ) ); - bool bSelected = pEntry->IsSelected(); - - bool bOverlaps; - if( bCalcOverlap ) - bOverlaps = IsOver( pOtherRects, aBoundRect ); - else - bOverlaps = false; - bool bOver = aRect.Overlaps( aBoundRect ); - - if( bOver && !bOverlaps ) - { - // is inside the new selection rectangle and outside of any old one - // => select - if( !bSelected ) - SelectEntry( pEntry, true, true ); - } - else if( !bAdd ) - { - // is outside of the selection rectangle - // => deselect - if( bSelected ) - SelectEntry( pEntry, false, true ); - } - else if (bOverlaps) - { - // The entry is inside an old (=>span multiple rectangles with Ctrl) - // selection rectangle. - - // There is still a bug here! The selection status of an entry in a - // previous rectangle has to be restored, if it was touched by the - // current selection rectangle but is not inside it any more. - // For simplicity's sake, let's assume that all entries in the old - // rectangles were correctly selected. It is wrong to just deselect - // the intersection. - // Possible solution: remember a snapshot of the selection before - // spanning the rectangle. - if( aBoundRect.Overlaps( rRect)) - { - // deselect intersection between old rectangles and current rectangle - if( bSelected ) - SelectEntry( pEntry, false, true ); - } - else - { - // select entry of an old rectangle - if( !bSelected ) - SelectEntry( pEntry, true, true ); - } - } - else if( !bOver && bSelected ) - { - // this entry is completely outside the rectangle => deselect it - SelectEntry( pEntry, false, true ); - } - } - - if( !bAlreadySelectingRect ) - nFlags &= ~IconChoiceFlags::SelectingRect; - - pView->PaintImmediately(); - if( bResetClipRegion ) - pView->GetOutDev()->SetClipRegion(); -} - -void SvxIconChoiceCtrl_Impl::SelectRange( - SvxIconChoiceCtrlEntry const * pStart, - SvxIconChoiceCtrlEntry const * pEnd, - bool bAdd ) -{ - sal_uLong nFront = GetEntryListPos( pStart ); - sal_uLong nBack = GetEntryListPos( pEnd ); - sal_uLong nFirst = std::min( nFront, nBack ); - sal_uLong nLast = std::max( nFront, nBack ); - sal_uLong i; - SvxIconChoiceCtrlEntry* pEntry; - - if ( ! bAdd ) - { - // deselect everything before the first entry if not in - // adding mode - for ( i=0; iIsSelected() ) - SelectEntry( pEntry, false, true ); - } - } - - // select everything between nFirst and nLast - for ( i=nFirst; i<=nLast; i++ ) - { - pEntry = GetEntry( i ); - if( ! pEntry->IsSelected() ) - SelectEntry( pEntry, true, true ); - } - - if ( ! bAdd ) - { - // deselect everything behind the last entry if not in - // adding mode - sal_uLong nEnd = GetEntryCount(); - for ( ; iIsSelected() ) - SelectEntry( pEntry, false, true ); - } - } -} - -bool SvxIconChoiceCtrl_Impl::IsOver( std::vector* pRectList, const tools::Rectangle& rBoundRect ) -{ - const sal_uInt16 nCount = pRectList->size(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - tools::Rectangle& rRect = (*pRectList)[ nCur ]; if( rBoundRect.Overlaps( rRect )) return true; } return false; } -void SvxIconChoiceCtrl_Impl::AddSelectedRect( SvxIconChoiceCtrlEntry* pEntry1, - SvxIconChoiceCtrlEntry* pEntry2 ) -{ - DBG_ASSERT(pEntry1 && pEntry2,"SelectEntry: Invalid Entry-Ptr"); - tools::Rectangle aRect( GetEntryBoundRect( pEntry1 ) ); - aRect.Union( GetEntryBoundRect( pEntry2 ) ); - AddSelectedRect( aRect ); -} - -void SvxIconChoiceCtrl_Impl::AddSelectedRect( const tools::Rectangle& rRect ) -{ - tools::Rectangle newRect = rRect; - newRect.Normalize(); - aSelectedRectList.push_back( newRect ); -} - -void SvxIconChoiceCtrl_Impl::ClearSelectedRectList() -{ - aSelectedRectList.clear(); -} - IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, AutoArrangeHdl, Timer *, void) { aAutoArrangeIdle.Stop(); - Arrange( IsAutoArrange(), 0, 0 ); + Arrange(0, 0); } IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, VisRectChangedHdl, Timer *, void) @@ -2431,25 +1797,14 @@ IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, DocRectChangedHdl, Timer *, void) } #ifdef DBG_UTIL -void SvxIconChoiceCtrl_Impl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry ) +void SvxIconChoiceCtrl_Impl::SetEntryTextMode(SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry& rEntry) { - if( !pEntry ) + if (rEntry.eTextMode != eMode) { - if( eTextMode != eMode ) - { - eTextMode = eMode; - Arrange( true, 0, 0 ); - } - } - else - { - if( pEntry->eTextMode != eMode ) - { - pEntry->eTextMode = eMode; - InvalidateEntry( pEntry ); - pView->Invalidate( GetEntryBoundRect( pEntry ) ); - AdjustVirtSize( pEntry->aRect ); - } + rEntry.eTextMode = eMode; + InvalidateEntry(&rEntry ); + pView->Invalidate(GetEntryBoundRect(&rEntry)); + AdjustVirtSize(rEntry.aRect); } } #endif @@ -2472,8 +1827,11 @@ void SvxIconChoiceCtrl_Impl::ShowFocus ( tools::Rectangle const & rRect ) aFocus.aRect = rRect; } -void SvxIconChoiceCtrl_Impl::DrawFocusRect(vcl::RenderContext& rRenderContext) +void SvxIconChoiceCtrl_Impl::DrawFocusRect(vcl::RenderContext& rRenderContext, SvxIconChoiceCtrlEntry* pEntry) { + tools::Rectangle aRect (CalcFocusRect(pEntry)); + ShowFocus(aRect); + rRenderContext.SetLineColor(aFocus.aPenColor); rRenderContext.SetFillColor(); tools::Polygon aPolygon (aFocus.aRect); @@ -2541,62 +1899,19 @@ void SvxIconChoiceCtrl_Impl::InvalidateEntry( SvxIconChoiceCtrlEntry* pEntry ) } SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry() const -{ - if( !GetSelectionCount() ) - return nullptr; - - if( (nWinBits & WB_HIGHLIGHTFRAME) && (eSelectionMode == SelectionMode::NONE) ) - { - return pCurHighlightFrame; - } - - size_t nCount = maEntries.size(); - if( !pHead ) - { - for( size_t nCur = 0; nCur < nCount; nCur++ ) - { - SvxIconChoiceCtrlEntry* pEntry = maEntries[ nCur ].get(); - if( pEntry->IsSelected() ) - { - return pEntry; - } - } - } - else - { - SvxIconChoiceCtrlEntry* pEntry = pHead; - while( nCount-- ) - { - if( pEntry->IsSelected() ) - { - return pEntry; - } - pEntry = pEntry->pflink; - if( nCount && pEntry == pHead ) - { - OSL_FAIL("SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry > infinite loop!"); - return nullptr; - } - } - } - return nullptr; -} - -void SvxIconChoiceCtrl_Impl::SelectAll() { size_t nCount = maEntries.size(); for( size_t nCur = 0; nCur < nCount; nCur++ ) { SvxIconChoiceCtrlEntry* pEntry = maEntries[ nCur ].get(); - SelectEntry( pEntry, true/*bSelect*/, true ); + if( pEntry->IsSelected() ) + { + return pEntry; + } } - nFlags &= ~IconChoiceFlags::AddMode; - pAnchor = nullptr; + return nullptr; } - - - sal_Int32 SvxIconChoiceCtrl_Impl::GetEntryListPos( SvxIconChoiceCtrlEntry const * pEntry ) const { if( !(nFlags & IconChoiceFlags::EntryListPosValid )) @@ -2647,7 +1962,6 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod SvxIconChoiceCtrlPositionMode eOldMode = ePositionMode; ePositionMode = eMode; - size_t nCount = maEntries.size(); if( eOldMode == SvxIconChoiceCtrlPositionMode::AutoArrange ) { @@ -2661,114 +1975,11 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod if( ePositionMode == SvxIconChoiceCtrlPositionMode::AutoArrange ) { - for( size_t nCur = 0; nCur < nCount; nCur++ ) - { - SvxIconChoiceCtrlEntry* pEntry = maEntries[ nCur ].get(); - if( pEntry->GetFlags() & SvxIconViewFlags(SvxIconViewFlags::POS_LOCKED | SvxIconViewFlags::POS_MOVED)) - SetEntryPos(pEntry, GetEntryBoundRect( pEntry ).TopLeft()); - } - if( maEntries.size() ) aAutoArrangeIdle.Start(); } } -void SvxIconChoiceCtrl_Impl::SetEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, - SvxIconChoiceCtrlEntry* pPredecessor ) -{ - if( !IsAutoArrange() ) - return; - - if( pEntry == pPredecessor ) - return; - - sal_uLong nPos1 = GetEntryListPos( pEntry ); - if( !pHead ) - { - if( pPredecessor ) - { - sal_uLong nPos2 = GetEntryListPos( pPredecessor ); - if( nPos1 == (nPos2 + 1) ) - return; // is already the predecessor - } - else if( !nPos1 ) - return; - - InitPredecessors(); - } - - if( !pPredecessor && pHead == pEntry ) - return; // is already the first one - - bool bSetHead = false; - if( !pPredecessor ) - { - bSetHead = true; - pPredecessor = pHead->pblink; - } - if( pEntry == pHead ) - { - pHead = pHead->pflink; - bSetHead = false; - } - if( pEntry != pPredecessor ) - { - pEntry->Unlink(); - pEntry->SetBacklink( pPredecessor ); - } - if( bSetHead ) - pHead = pEntry; - aAutoArrangeIdle.Start(); -} - -SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, - const Point& rPosTopLeft ) -{ - Point aPos( rPosTopLeft ); //TopLeft - tools::Rectangle aCenterRect( CalcBmpRect( pEntry, &aPos )); - Point aNewPos( aCenterRect.Center() ); - GridId nGrid = GetPredecessorGrid( aNewPos ); - size_t nCount = maEntries.size(); - if( nGrid == GRID_NOT_FOUND ) - return nullptr; - if( nGrid >= nCount ) - nGrid = nCount - 1; - if( !pHead ) - return maEntries[ nGrid ].get(); - - SvxIconChoiceCtrlEntry* pCur = pHead; // Grid 0 - // TODO: go through list from the end if nGrid > nCount/2 - for( GridId nCur = 0; nCur < nGrid; nCur++ ) - pCur = pCur->pflink; - - return pCur; -} - -GridId SvxIconChoiceCtrl_Impl::GetPredecessorGrid( const Point& rPos) const -{ - Point aPos( rPos ); - aPos.AdjustX( -(LROFFS_WINBORDER) ); - aPos.AdjustY( -(TBOFFS_WINBORDER) ); - tools::Long nMaxCol = aVirtOutputSize.Width() / nGridDX; - if( nMaxCol ) - nMaxCol--; - tools::Long nGridX = aPos.X() / nGridDX; - if( nGridX > nMaxCol ) - nGridX = nMaxCol; - tools::Long nGridY = aPos.Y() / nGridDY; - tools::Long nGridsX = aOutputSize.Width() / nGridDX; - GridId nGrid = (nGridY * nGridsX) + nGridX; - tools::Long nMiddle = (nGridX * nGridDX) + (nGridDX / 2); - if( rPos.X() < nMiddle ) - { - if( !nGrid ) - nGrid = GRID_NOT_FOUND; - else - nGrid--; - } - return nGrid; -} - bool SvxIconChoiceCtrl_Impl::RequestHelp( const HelpEvent& rHEvt ) { if ( !(rHEvt.GetMode() & HelpEventMode::QUICK ) ) @@ -2782,8 +1993,8 @@ bool SvxIconChoiceCtrl_Impl::RequestHelp( const HelpEvent& rHEvt ) return false; OUString sQuickHelpText = pEntry->GetQuickHelpText(); - OUString aEntryText( SvtIconChoiceCtrl::GetEntryText( pEntry ) ); - tools::Rectangle aTextRect( CalcTextRect( pEntry, nullptr, &aEntryText ) ); + tools::Rectangle aTextRect(CalcTextRect(pEntry, nullptr)); + const OUString aEntryText = pEntry->GetText(); if ( ( !aTextRect.Contains( aPos ) || aEntryText.isEmpty() ) && sQuickHelpText.isEmpty() ) return false; @@ -2813,33 +2024,6 @@ bool SvxIconChoiceCtrl_Impl::RequestHelp( const HelpEvent& rHEvt ) return true; } -void SvxIconChoiceCtrl_Impl::SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& rInfo) -{ - if (!m_pColumns) - m_pColumns.reset(new SvxIconChoiceCtrlColumnInfoMap); - - SvxIconChoiceCtrlColumnInfo* pInfo = new SvxIconChoiceCtrlColumnInfo( rInfo ); - m_pColumns->insert(std::make_pair(nIndex, std::unique_ptr(pInfo))); - - // HACK: Detail mode is not yet fully implemented, this workaround makes it - // fly with a single column - if( !nIndex && (nWinBits & WB_DETAILS) ) - nGridDX = pInfo->GetWidth(); - - if( GetUpdateMode() ) - Arrange( IsAutoArrange(), 0, 0 ); -} - -const SvxIconChoiceCtrlColumnInfo* SvxIconChoiceCtrl_Impl::GetColumn( sal_uInt16 nIndex ) const -{ - if (!m_pColumns) - return nullptr; - auto const it = m_pColumns->find( nIndex ); - if (it == m_pColumns->end()) - return nullptr; - return it->second.get(); -} - void SvxIconChoiceCtrl_Impl::DrawHighlightFrame(vcl::RenderContext& rRenderContext, const tools::Rectangle& rBmpRect) { tools::Rectangle aBmpRect(rBmpRect); @@ -2852,23 +2036,14 @@ void SvxIconChoiceCtrl_Impl::DrawHighlightFrame(vcl::RenderContext& rRenderConte aBmpRect.AdjustTop( -nBorder ); DecorationView aDecoView(&rRenderContext); - DrawHighlightFrameStyle nDecoFlags; - if (bHighlightFramePressed) - nDecoFlags = DrawHighlightFrameStyle::In; - else - nDecoFlags = DrawHighlightFrameStyle::Out; - aDecoView.DrawHighlightFrame(aBmpRect, nDecoFlags); + aDecoView.DrawHighlightFrame(aBmpRect, DrawHighlightFrameStyle::Out); } -void SvxIconChoiceCtrl_Impl::SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEntry, - bool bKeepHighlightFlags ) +void SvxIconChoiceCtrl_Impl::SetEntryHighlightFrame(SvxIconChoiceCtrlEntry* pEntry) { if( pEntry == pCurHighlightFrame ) return; - if( !bKeepHighlightFlags ) - bHighlightFramePressed = false; - if (pCurHighlightFrame) { tools::Rectangle aInvalidationRect(GetEntryBoundRect(pCurHighlightFrame)); @@ -2886,33 +2061,6 @@ void SvxIconChoiceCtrl_Impl::SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEn } } -void SvxIconChoiceCtrl_Impl::CallSelectHandler() -{ - // When single-click mode is active, the selection handler should be called - // synchronously, as the selection is automatically taken away once the - // mouse cursor doesn't touch the object any more. Else, we might run into - // missing calls to Select if the object is selected from a mouse movement, - // because when starting the timer, the mouse cursor might have already left - // the object. - // In special cases (=>SfxFileDialog!), synchronous calls can be forced via - // WB_NOASYNCSELECTHDL. - if( nWinBits & (WB_NOASYNCSELECTHDL | WB_HIGHLIGHTFRAME) ) - { - pHdlEntry = nullptr; - pView->ClickIcon(); - //pView->Select(); - } - else - aCallSelectHdlIdle.Start(); -} - -IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, CallSelectHdlHdl, Timer *, void) -{ - pHdlEntry = nullptr; - pView->ClickIcon(); - //pView->Select(); -} - void SvxIconChoiceCtrl_Impl::SetOrigin( const Point& rPos ) { MapMode aMapMode( pView->GetMapMode() ); diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx index c17a0caf359d..1cab3e097c77 100644 --- a/vcl/source/control/ivctrl.cxx +++ b/vcl/source/control/ivctrl.cxx @@ -59,8 +59,6 @@ SvxIconChoiceCtrlEntry::SvxIconChoiceCtrlEntry( OUString _aText, : aImage(std::move(_aImage)) , aText(std::move(_aText)) , nPos(0) - , pblink(nullptr) - , pflink(nullptr) , eTextMode(SvxIconChoiceCtrlTextMode::Short) , nX(0) , nY(0) @@ -73,12 +71,6 @@ OUString SvxIconChoiceCtrlEntry::GetDisplayText() const return MnemonicGenerator::EraseAllMnemonicChars( aText ); } - -SvxIconChoiceCtrlColumnInfo::SvxIconChoiceCtrlColumnInfo( const SvxIconChoiceCtrlColumnInfo& rInfo ) -{ - nWidth = rInfo.nWidth; -} - /***************************************************************************** | | class : SvtIconChoiceCtrl @@ -97,11 +89,6 @@ SvtIconChoiceCtrl::SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle ) _pImpl->SetPositionMode( SvxIconChoiceCtrlPositionMode::AutoArrange ); } -void SvtIconChoiceCtrl::SetSelectionMode(SelectionMode eMode) -{ - _pImpl->SetSelectionMode(eMode); -} - SvtIconChoiceCtrl::~SvtIconChoiceCtrl() { disposeOnce(); @@ -131,16 +118,6 @@ void SvtIconChoiceCtrl::RemoveEntry(sal_Int32 nIndex) _pImpl->RemoveEntry(nIndex); } -void SvtIconChoiceCtrl::DrawEntryImage( SvxIconChoiceCtrlEntry const * pEntry, const Point& rPos, OutputDevice& rDev ) -{ - rDev.DrawImage( rPos, pEntry->GetImage() ); -} - -OUString SvtIconChoiceCtrl::GetEntryText( SvxIconChoiceCtrlEntry const * pEntry ) -{ - return pEntry->GetText(); -} - void SvtIconChoiceCtrl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) { _pImpl->Paint(rRenderContext, rRect); @@ -152,12 +129,6 @@ void SvtIconChoiceCtrl::MouseButtonDown( const MouseEvent& rMEvt ) Control::MouseButtonDown( rMEvt ); } -void SvtIconChoiceCtrl::MouseButtonUp( const MouseEvent& rMEvt ) -{ - if( !_pImpl->MouseButtonUp( rMEvt ) ) - Control::MouseButtonUp( rMEvt ); -} - void SvtIconChoiceCtrl::MouseMove( const MouseEvent& rMEvt ) { if( !_pImpl->MouseMove( rMEvt ) ) @@ -178,7 +149,7 @@ void SvtIconChoiceCtrl::ArrangeIcons() aFullSize.setWidth ( aFullSize.getWidth()+aEntryRect.GetWidth() ); } - _pImpl->Arrange ( false, aFullSize.getWidth(), 0 ); + _pImpl->Arrange(aFullSize.getWidth(), 0); } else if ( GetStyle() & WB_ALIGN_LEFT ) { @@ -193,13 +164,13 @@ void SvtIconChoiceCtrl::ArrangeIcons() aFullSize.setHeight ( aFullSize.getHeight()+aEntryRect.GetHeight() ); } - _pImpl->Arrange ( false, 0, aFullSize.getHeight() ); + _pImpl->Arrange(0, aFullSize.getHeight()); } else { - _pImpl->Arrange(false, 0, 0); + _pImpl->Arrange(0, 0); } - _pImpl->Arrange( false, 0, 1000 ); + _pImpl->Arrange(0, 1000 ); } void SvtIconChoiceCtrl::Resize() { @@ -254,13 +225,6 @@ void SvtIconChoiceCtrl::Command(const CommandEvent& rCEvt) Control::Command(rCEvt); } -#ifdef DBG_UTIL -void SvtIconChoiceCtrl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry ) -{ - _pImpl->SetEntryTextMode( eMode, pEntry ); -} -#endif - sal_Int32 SvtIconChoiceCtrl::GetEntryCount() const { return _pImpl ? _pImpl->GetEntryCount() : 0; @@ -445,7 +409,6 @@ VerticalTabControl::VerticalTabControl(vcl::Window* pParent, bool bWithIcons) { SetStyle(GetStyle() | WB_DIALOGCONTROL); SetType(WindowType::VERTICALTABCONTROL); - m_xChooser->SetSelectionMode(SelectionMode::Single); m_xChooser->SetClickHdl(LINK(this, VerticalTabControl, ChosePageHdl_Impl)); m_xChooser->set_width_request(150); m_xChooser->set_height_request(400); diff --git a/vcl/source/filter/GraphicFormatDetector.cxx b/vcl/source/filter/GraphicFormatDetector.cxx index a878a8ca111d..7963505f4b2e 100644 --- a/vcl/source/filter/GraphicFormatDetector.cxx +++ b/vcl/source/filter/GraphicFormatDetector.cxx @@ -28,6 +28,7 @@ #include #include #include +#include "igif/gifread.hxx" #include #include #include @@ -824,6 +825,8 @@ bool GraphicFormatDetector::checkTIF() bool GraphicFormatDetector::checkGIF() { + SeekGuard aGuard(mrStream, mnStreamPosition); + if (mnFirstLong == 0x47494638 && (maFirstBytes[4] == 0x37 || maFirstBytes[4] == 0x39) && maFirstBytes[5] == 0x61) { @@ -834,6 +837,14 @@ bool GraphicFormatDetector::checkGIF() sal_uInt16 nHeight = maFirstBytes[8] | (maFirstBytes[9] << 8); maMetadata.maPixSize = Size(nWidth, nHeight); maMetadata.mnBitsPerPixel = ((maFirstBytes[10] & 112) >> 4) + 1; + + Size aLogicSize; + bool bAnimated = IsGIFAnimated(mrStream, aLogicSize); + if (aLogicSize.getWidth() && aLogicSize.getHeight()) + { + maMetadata.maLogSize = aLogicSize; + } + maMetadata.mbIsAnimated = bAnimated; } return true; } @@ -954,6 +965,7 @@ bool GraphicFormatDetector::checkAPNG() if (PngImageReader::isAPng(mrStream)) { maMetadata.mnFormat = GraphicFileFormat::APNG; + maMetadata.mbIsAnimated = true; return true; } return false; diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index e4a9f97f3188..18bd05d107ba 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -710,20 +710,143 @@ void GraphicFilter::MakeGraphicsAvailableThreaded(std::vector& graphic } } +namespace +{ + +BinaryDataContainer insertContentOrDecompressFromZ(SvStream& rStream, sal_uInt32 nStreamLength) +{ + BinaryDataContainer aGraphicContent; + + if (ZCodec::IsZCompressed(rStream)) + { + ZCodec aCodec; + SvMemoryStream aMemStream; + tools::Long nMemoryLength; + aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true); + nMemoryLength = aCodec.Decompress(rStream, aMemStream); + aCodec.EndCompression(); + + if (rStream.good() && nMemoryLength >= 0) + { + aMemStream.Seek(STREAM_SEEK_TO_BEGIN); + aGraphicContent = BinaryDataContainer(aMemStream, nMemoryLength); + } + } + else + { + aGraphicContent = BinaryDataContainer(rStream, nStreamLength); + } + return aGraphicContent; +} + + +ErrCode prepareImageTypeAndData(SvStream& rStream, sal_uInt32 nStreamLength, BinaryDataContainer& rGraphicContent, std::u16string_view rFilterName, GfxLinkType& rLinkType) +{ + const sal_uInt64 nStreamBegin = rStream.Tell(); + ErrCode nStatus = ERRCODE_GRFILTER_FILTERERROR; + + if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_GIF)) + { + rLinkType = GfxLinkType::NativeGif; + nStatus = ERRCODE_NONE; + } + else if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_PNG)) + { + // check if this PNG contains a GIF chunk! + rGraphicContent = vcl::PngImageReader::getMicrosoftGifChunk(rStream); + if (!rGraphicContent.isEmpty()) + rLinkType = GfxLinkType::NativeGif; + else + rLinkType = GfxLinkType::NativePng; + nStatus = ERRCODE_NONE; + } + else if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_JPEG)) + { + rLinkType = GfxLinkType::NativeJpg; + nStatus = ERRCODE_NONE; + } + else if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_SVG)) + { + rStream.Seek(nStreamBegin); + rGraphicContent = insertContentOrDecompressFromZ(rStream, nStreamLength); + if (rStream.good()) + { + rLinkType = GfxLinkType::NativeSvg; + nStatus = ERRCODE_NONE; + } + } + else if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_BMP)) + { + rLinkType = GfxLinkType::NativeBmp; + nStatus = ERRCODE_NONE; + } + else if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_MOV)) + { + rLinkType = GfxLinkType::NativeMov; + nStatus = ERRCODE_NONE; + } + else if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_WMF) || + o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_EMF) || + o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_WMZ) || + o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_EMZ)) + { + rStream.Seek(nStreamBegin); + rGraphicContent = insertContentOrDecompressFromZ(rStream, nStreamLength); + if (rStream.good()) + { + rLinkType = GfxLinkType::NativeWmf; + nStatus = ERRCODE_NONE; + } + } + else if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_PDF)) + { + rLinkType = GfxLinkType::NativePdf; + nStatus = ERRCODE_NONE; + } + else if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_TIFF)) + { + rLinkType = GfxLinkType::NativeTif; + nStatus = ERRCODE_NONE; + } + else if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_PICT)) + { + rLinkType = GfxLinkType::NativePct; + nStatus = ERRCODE_NONE; + } + else if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_MET)) + { + rLinkType = GfxLinkType::NativeMet; + nStatus = ERRCODE_NONE; + } + else if (o3tl::equalsIgnoreAsciiCase(rFilterName, IMP_WEBP)) + { + if (supportNativeWebp()) + { + rLinkType = GfxLinkType::NativeWebp; + nStatus = ERRCODE_NONE; + } + } + + return nStatus; +} + +} // end anonymous namespace + Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 sizeLimit, const Size* pSizeHint) { Graphic aGraphic; sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW; - GfxLinkType eLinkType = GfxLinkType::NONE; ResetLastError(); const sal_uInt64 nStreamBegin = rIStream.Tell(); + // Get the image format rIStream.Seek(nStreamBegin); - ErrCode nStatus = ImpTestOrFindFormat(u"", rIStream, nFormat); + if (nStatus != ERRCODE_NONE) + return aGraphic; rIStream.Seek(nStreamBegin); sal_uInt32 nStreamLength(rIStream.remainingSize()); @@ -732,175 +855,43 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size OUString aFilterName = pConfig->GetImportFilterName(nFormat); - BinaryDataContainer aGraphicContent; + BinaryDataContainer aBinaryDataContainer; - // read graphic - { - if (aFilterName.equalsIgnoreAsciiCase(IMP_GIF)) - { - eLinkType = GfxLinkType::NativeGif; - } - else if (aFilterName.equalsIgnoreAsciiCase(IMP_PNG)) - { - // check if this PNG contains a GIF chunk! - aGraphicContent = vcl::PngImageReader::getMicrosoftGifChunk(rIStream); - if (!aGraphicContent.isEmpty()) - eLinkType = GfxLinkType::NativeGif; - else - eLinkType = GfxLinkType::NativePng; - } - else if (aFilterName.equalsIgnoreAsciiCase(IMP_JPEG)) - { - eLinkType = GfxLinkType::NativeJpg; - } - else if (aFilterName.equalsIgnoreAsciiCase(IMP_SVG)) - { - bool bOkay(false); - - if (nStreamLength > 0) - { - std::vector aTwoBytes(2); - rIStream.ReadBytes(aTwoBytes.data(), 2); - rIStream.Seek(nStreamBegin); - - if (aTwoBytes[0] == 0x1F && aTwoBytes[1] == 0x8B) - { - SvMemoryStream aMemStream; - ZCodec aCodec; - tools::Long nMemoryLength; - - aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true); - nMemoryLength = aCodec.Decompress(rIStream, aMemStream); - aCodec.EndCompression(); - - if (!rIStream.GetError() && nMemoryLength >= 0) - { - aMemStream.Seek(STREAM_SEEK_TO_BEGIN); - aGraphicContent = BinaryDataContainer(aMemStream, nMemoryLength); - - bOkay = true; - } - } - else - { - aGraphicContent = BinaryDataContainer(rIStream, nStreamLength); - - bOkay = true; - } - } - - if (bOkay) - { - eLinkType = GfxLinkType::NativeSvg; - } - else - { - nStatus = ERRCODE_GRFILTER_FILTERERROR; - } - } - else if (aFilterName.equalsIgnoreAsciiCase(IMP_BMP)) - { - eLinkType = GfxLinkType::NativeBmp; - } - else if (aFilterName.equalsIgnoreAsciiCase(IMP_MOV)) - { - eLinkType = GfxLinkType::NativeMov; - } - else if (aFilterName.equalsIgnoreAsciiCase(IMP_WMF) || - aFilterName.equalsIgnoreAsciiCase(IMP_EMF) || - aFilterName.equalsIgnoreAsciiCase(IMP_WMZ) || - aFilterName.equalsIgnoreAsciiCase(IMP_EMZ)) - { - rIStream.Seek(nStreamBegin); - if (ZCodec::IsZCompressed(rIStream)) - { - ZCodec aCodec; - SvMemoryStream aMemStream; - tools::Long nMemoryLength; - aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true); - nMemoryLength = aCodec.Decompress(rIStream, aMemStream); - aCodec.EndCompression(); - - if (!rIStream.GetError() && nMemoryLength >= 0) - { - aMemStream.Seek(STREAM_SEEK_TO_BEGIN); - aGraphicContent = BinaryDataContainer(aMemStream, nMemoryLength); - } - } - else - { - aGraphicContent = BinaryDataContainer(rIStream, nStreamLength); - } - if (!rIStream.GetError()) - { - eLinkType = GfxLinkType::NativeWmf; - } - else - { - nStatus = ERRCODE_GRFILTER_FILTERERROR; - } - } - else if (aFilterName == IMP_PDF) - { - eLinkType = GfxLinkType::NativePdf; - } - else if (aFilterName == IMP_TIFF) - { - eLinkType = GfxLinkType::NativeTif; - } - else if (aFilterName == IMP_PICT) - { - eLinkType = GfxLinkType::NativePct; - } - else if (aFilterName == IMP_MET) - { - eLinkType = GfxLinkType::NativeMet; - } - else if (aFilterName.equalsIgnoreAsciiCase(IMP_WEBP)) - { - if(supportNativeWebp()) - eLinkType = GfxLinkType::NativeWebp; - else - nStatus = ERRCODE_GRFILTER_FILTERERROR; - } - else - { - nStatus = ERRCODE_GRFILTER_FILTERERROR; - } - } + GfxLinkType eLinkType = GfxLinkType::NONE; + rIStream.Seek(nStreamBegin); + nStatus = prepareImageTypeAndData(rIStream, nStreamLength, aBinaryDataContainer, aFilterName, eLinkType); if (nStatus == ERRCODE_NONE && eLinkType != GfxLinkType::NONE) { - if (aGraphicContent.isEmpty()) + if (aBinaryDataContainer.isEmpty() && nStreamLength > 0) { - if (nStreamLength > 0) + try { - try - { - rIStream.Seek(nStreamBegin); - aGraphicContent = BinaryDataContainer(rIStream, nStreamLength); - } - catch (const std::bad_alloc&) - { - nStatus = ERRCODE_GRFILTER_TOOBIG; - } + rIStream.Seek(nStreamBegin); + aBinaryDataContainer = BinaryDataContainer(rIStream, nStreamLength); + } + catch (const std::bad_alloc&) + { + nStatus = ERRCODE_GRFILTER_TOOBIG; } } - if( nStatus == ERRCODE_NONE ) + if (nStatus == ERRCODE_NONE) { bool bAnimated = false; Size aLogicSize; - if (eLinkType == GfxLinkType::NativeGif && !aGraphicContent.isEmpty()) + + if (eLinkType == GfxLinkType::NativeGif && !aBinaryDataContainer.isEmpty()) { - std::shared_ptr pMemoryStream = aGraphicContent.getAsStream(); + std::shared_ptr pMemoryStream = aBinaryDataContainer.getAsStream(); bAnimated = IsGIFAnimated(*pMemoryStream, aLogicSize); if (!pSizeHint && aLogicSize.getWidth() && aLogicSize.getHeight()) { pSizeHint = &aLogicSize; } } - aGraphic.SetGfxLink(std::make_shared(aGraphicContent, eLinkType)); + + aGraphic.SetGfxLink(std::make_shared(aBinaryDataContainer, eLinkType)); aGraphic.ImplGetImpGraphic()->setPrepared(bAnimated, pSizeHint); } } @@ -908,6 +899,7 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size // Set error code or try to set native buffer if (nStatus != ERRCODE_NONE) ImplSetError(nStatus, &rIStream); + if (nStatus != ERRCODE_NONE || eLinkType == GfxLinkType::NONE) rIStream.Seek(nStreamBegin); diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index d7161b2808ea..d1a84c7b1ad9 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -32,15 +32,12 @@ GraphicDescriptor::GraphicDescriptor( const INetURLObject& rPath ) : aPathExt( rPath.GetFileExtension().toAsciiLowerCase() ), bOwnStream( true ) { - ImpConstruct(); } GraphicDescriptor::GraphicDescriptor( SvStream& rInStream, const OUString* pPath) : pFileStm ( &rInStream ), bOwnStream ( false ) { - ImpConstruct(); - if ( pPath ) { INetURLObject aURL( *pPath ); @@ -92,16 +89,6 @@ bool GraphicDescriptor::Detect( bool bExtendedInfo ) return bRet; } -void GraphicDescriptor::ImpConstruct() -{ - aMetadata.mnFormat = GraphicFileFormat::NOT; - aMetadata.mnBitsPerPixel = 0; - aMetadata.mnPlanes = 0; - aMetadata.mnNumberOfImageComponents = 0; - aMetadata.mbIsTransparent = false; - aMetadata.mbIsAlpha = false; -} - bool GraphicDescriptor::ImpDetectBMP( SvStream& rStm, bool bExtendedInfo ) { vcl::GraphicFormatDetector aDetector( rStm, aPathExt, bExtendedInfo ); diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index 70b00a895720..e89180073cba 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -658,7 +658,7 @@ void WMFWriter::WMFRecord_PolyPolygon(const tools::PolyPolygon & rPolyPoly) { tools::Polygon aSimplePoly; aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly ); - aSimplePolyPoly[ i ] = aSimplePoly; + aSimplePolyPoly[ i ] = std::move(aSimplePoly); } } WriteRecordHeader(0,W_META_POLYPOLYGON); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 65325a0c938d..3f6d9bbcbfdd 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -3771,13 +3771,13 @@ we check in the following sequence: } else { - INetURLObject aNewURL(rtl::Uri::convertRelToAbs( + //reassign the new target URL + aTargetURL = INetURLObject(rtl::Uri::convertRelToAbs( (m_aContext.BaseURL.getLength() > 0 ? m_aContext.BaseURL : //use dummy location if empty u"http://ahost.ax"_ustr), url)); - aTargetURL = aNewURL; //reassign the new target URL //recompute the target protocol, with the new URL //normal URL processing resumes diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 06625a4227bd..b2f821613ba4 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1335,7 +1335,7 @@ bool Printer::SetPaperSizeUser( const Size& rSize ) if ( IsDisplayPrinter() ) { mbNewJobSetup = true; - maJobSetup = aJobSetup; + maJobSetup = std::move(aJobSetup); return true; } @@ -1347,7 +1347,7 @@ bool Printer::SetPaperSizeUser( const Size& rSize ) { ImplUpdateJobSetupPaper( aJobSetup ); mbNewJobSetup = true; - maJobSetup = aJobSetup; + maJobSetup = std::move(aJobSetup); ImplUpdatePageData(); ImplUpdateFontList(); return true; diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx index 84b4efadc27b..034e6d1056a5 100644 --- a/vcl/source/window/stacking.cxx +++ b/vcl/source/window/stacking.cxx @@ -200,7 +200,10 @@ void Window::ImplToBottomChild() if ( mpWindowImpl->mpPrev ) mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext; else + { + // coverity[copy_paste_error : FALSE] - this is correct mpFirstChild, not mpNext mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = mpWindowImpl->mpNext; + } mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev; mpWindowImpl->mpPrev = mpWindowImpl->mpParent->mpWindowImpl->mpLastChild; mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = this; @@ -268,7 +271,10 @@ void Window::ImplToTop( ToTopFlags nFlags ) if ( mpWindowImpl->mpNext ) mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev; else + { + // coverity[copy_paste_error : FALSE] - this is correct mpLastOverlap, not mpPrev mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = mpWindowImpl->mpPrev; + } // take AlwaysOnTop into account bool bOnTop = IsAlwaysOnTopEnabled(); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index d8261ec5acf0..dcb68b9cf142 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -779,14 +779,14 @@ ImplFrameData::ImplFrameData( vcl::Window *pWindow ) mxFontCache = pSVData->maGDIData.mxScreenFontCache; mnFocusId = nullptr; mnMouseMoveId = nullptr; - mnLastMouseX = -1; - mnLastMouseY = -1; - mnBeforeLastMouseX = -1; - mnBeforeLastMouseY = -1; - mnFirstMouseX = -1; - mnFirstMouseY = -1; - mnLastMouseWinX = -1; - mnLastMouseWinY = -1; + mnLastMouseX = -32767; + mnLastMouseY = -32767; + mnBeforeLastMouseX = -32767; + mnBeforeLastMouseY = -32767; + mnFirstMouseX = -32767; + mnFirstMouseY = -32767; + mnLastMouseWinX = -32767; + mnLastMouseWinY = -32767; mnModalMode = 0; mnMouseDownTime = 0; mnClickCount = 0; diff --git a/vcl/uiconfig/ui/wizard.ui b/vcl/uiconfig/ui/wizard.ui index 6a3b45f41cc4..5fd9a647c259 100644 --- a/vcl/uiconfig/ui/wizard.ui +++ b/vcl/uiconfig/ui/wizard.ui @@ -9,16 +9,9 @@ 0 0 dialog + 0 - - - False - - - False - - diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 12be50e7a685..e8e974c60579 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -33,7 +33,10 @@ #include #include + +#if ENABLE_CPDB #include +#endif #include #include diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index 2b9eb6aef70a..d2f7173ffa26 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -19,7 +19,10 @@ #include +#if ENABLE_CPDB #include +#endif + #include #include #include diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java index 69fbf5ab76b2..689ae82b9e2b 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -53,7 +53,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL private String[] sRMItemLabels; private Object oRoadmap; private XSingleServiceFactory xSSFRoadmap; - public XIndexContainer xIndexContRoadmap; + protected XIndexContainer xIndexContRoadmap; private final Resource oWizardResource; private final int hid; private boolean bTerminateListenermustberemoved = true; diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index cb38c64e4d21..98471c607a03 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -77,8 +77,7 @@ void EPUBExportTest::createDoc(std::u16string_view rFile, else aMediaDescriptor[u"FilterOptions"_ustr] <<= maFilterOptions; xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); - mxZipFile - = packages::zip::ZipFileAccess::createWithURL(mxComponentContext, maTempFile.GetURL()); + mxZipFile = packages::zip::ZipFileAccess::createWithURL(m_xContext, maTempFile.GetURL()); } std::map> EPUBExportTest::parseCss(const OUString& rName) @@ -165,7 +164,7 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testMimetype) mpXmlDoc, "/opf:package/opf:metadata/opf:meta[@name='generator']"_ostr, "content"_ostr); CPPUNIT_ASSERT(aGenerator.startsWith(utl::DocInfoHelper::GetGeneratorString())); - uno::Reference xMSF(mxComponentContext->getServiceManager(), + uno::Reference xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY); constexpr OUString aServiceName(u"com.sun.star.comp.Writer.EPUBExportFilter"_ustr); uno::Reference xFilter(xMSF->createInstance(aServiceName), uno::UNO_QUERY); diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index 512e629ff106..55dfe4a8fecd 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -932,8 +932,8 @@ bool XMLChartImportPropertyMapper::handleSpecialItem( { // convert from degrees (double) to 100th degrees (integer) double fVal; - ::sax::Converter::convertDouble( fVal, rValue ); - nValue = static_cast( fVal * 100.0 ); + ::sax::Converter::convertAngle(fVal, rValue, 100); + nValue = static_cast(basegfx::fround(fVal)); rProperty.maValue <<= nValue; } break; diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx index d9d57af9f664..91b9ee234954 100644 --- a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx +++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx @@ -118,8 +118,8 @@ void XMLEmbeddedObjectImportContext::SetComponent( Reference< XComponent > const return; assert(dynamic_cast(xFilter.get())); - SvXMLImport *pFastHandler = dynamic_cast(xFilter.get()); - mxFastHandler = pFastHandler; + SvXMLImport& rFastHandler = dynamic_cast(*xFilter); + mxFastHandler = &rFastHandler; try { @@ -138,7 +138,7 @@ void XMLEmbeddedObjectImportContext::SetComponent( Reference< XComponent > const // #i34042: copy namespace declarations // We created a new instance of XMLImport, so we need to propagate the namespace // declarations to it. - pFastHandler->GetNamespaceMap() = GetImport().GetNamespaceMap(); + rFastHandler.GetNamespaceMap() = GetImport().GetNamespaceMap(); } XMLEmbeddedObjectImportContext::XMLEmbeddedObjectImportContext( diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 87752f73b199..5c293c7670c2 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -271,17 +271,26 @@ XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl( const SdXMLImExViewBox aViewBox( sViewBox, GetImport().GetMM100UnitConverter()); basegfx::B2DPolyPolygon aPolyPolygon; - if( bPath ) + // Related tdf#161833: ignore saved polygon for "recreate on edit" contours + // tdf#161833 would cause semi-transparent pixels to be treated as fully + // transparent pixels when calculating the wrap contour for an image. To + // force the correct contour when loading a document, force the contour + // to be recalculated by ignoring the saved polygon if the contour is set + // to "recreate on edit". + if( !bAuto ) { - basegfx::utils::importFromSvgD(aPolyPolygon, sD, GetImport().needFixPositionAfterZ(), nullptr); - } - else - { - basegfx::B2DPolygon aPolygon; - - if(basegfx::utils::importFromSvgPoints(aPolygon, sPoints)) + if( bPath ) { - aPolyPolygon = basegfx::B2DPolyPolygon(aPolygon); + basegfx::utils::importFromSvgD(aPolyPolygon, sD, GetImport().needFixPositionAfterZ(), nullptr); + } + else + { + basegfx::B2DPolygon aPolygon; + + if(basegfx::utils::importFromSvgPoints(aPolygon, sPoints)) + { + aPolyPolygon = basegfx::B2DPolyPolygon(aPolygon); + } } } diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 80a98f3dc5c6..d13c54c9707e 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -774,11 +774,12 @@ void XMLTextFieldExport::ExportFieldAutoStyle( // insert a list for our XText (if necessary) if (aMapIter == moUsedMasters->end()) { - std::set aSet; - (*moUsedMasters)[xOurText] = aSet; + (*moUsedMasters)[xOurText] = std::set(); aMapIter = moUsedMasters->find(xOurText); } + assert(aMapIter != moUsedMasters->end()); + // insert this text field master OUString sFieldMasterName = GetStringProperty( gsPropertyInstanceName, xDepField->getTextFieldMaster()); diff --git a/xmlscript/qa/cppunit/test.cxx b/xmlscript/qa/cppunit/test.cxx index f09bfac589dd..8f40e4fb8269 100644 --- a/xmlscript/qa/cppunit/test.cxx +++ b/xmlscript/qa/cppunit/test.cxx @@ -70,7 +70,7 @@ void XmlScriptTest::setUp() test::BootstrapFixture::setUp(); maDataPath = "/xmlscript/qa/cppunit/data/"; - mxDesktop.set(frame::Desktop::create(mxComponentContext)); + mxDesktop.set(frame::Desktop::create(m_xContext)); } Reference XmlScriptTest::importFile(std::u16string_view sFileName) @@ -87,12 +87,12 @@ Reference XmlScriptTest::importFile(std::u16string_vi aFile.close(); Reference xDialogModel( - mxComponentContext->getServiceManager()->createInstanceWithContext( - u"com.sun.star.awt.UnoControlDialogModel"_ustr, mxComponentContext), + m_xContext->getServiceManager()->createInstanceWithContext( + u"com.sun.star.awt.UnoControlDialogModel"_ustr, m_xContext), UNO_QUERY); ::xmlscript::importDialogModel(::xmlscript::createInputStream(std::move(bytes)), xDialogModel, - mxComponentContext, nullptr); + m_xContext, nullptr); Reference xDialogModelComp(xDialogModel, UNO_QUERY); if (xDialogModelComp) @@ -105,7 +105,7 @@ void XmlScriptTest::exportToFile(std::u16string_view sURL, Reference const& xDialogModel) { Reference xProvider( - ::xmlscript::exportDialogModel(xDialogModel, mxComponentContext, nullptr)); + ::xmlscript::exportDialogModel(xDialogModel, m_xContext, nullptr)); Reference xStream(xProvider->createInputStream()); Sequence bytes; diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx index 9d774735d30c..cc688397b630 100644 --- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx +++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx @@ -73,7 +73,7 @@ void PDFSigningTest::setUp() MacrosTest::setUpX509(m_directories, u"xmlsecurity_pdfsigning"_ustr); uno::Reference xSEInitializer - = xml::crypto::SEInitializer::create(mxComponentContext); + = xml::crypto::SEInitializer::create(m_xContext); uno::Reference xSecurityContext = xSEInitializer->createSecurityContext(OUString()); #if USE_CRYPTO_NSS @@ -88,7 +88,7 @@ void PDFSigningTest::setUp() std::vector PDFSigningTest::verify(const OUString& rURL, size_t nCount) { uno::Reference xSEInitializer - = xml::crypto::SEInitializer::create(mxComponentContext); + = xml::crypto::SEInitializer::create(m_xContext); uno::Reference xSecurityContext = xSEInitializer->createSecurityContext(OUString()); std::vector aRet; @@ -116,7 +116,7 @@ bool PDFSigningTest::sign(const OUString& rInURL, const OUString& rOutURL, { // Make sure that input has nOriginalSignatureCount signatures. uno::Reference xSEInitializer - = xml::crypto::SEInitializer::create(mxComponentContext); + = xml::crypto::SEInitializer::create(m_xContext); uno::Reference xSecurityContext = xSEInitializer->createSecurityContext(OUString()); vcl::filter::PDFDocument aDocument; @@ -238,7 +238,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemove) // Make sure that good.pdf has 1 valid signature. uno::Reference xSEInitializer - = xml::crypto::SEInitializer::create(mxComponentContext); + = xml::crypto::SEInitializer::create(m_xContext); uno::Reference xSecurityContext = xSEInitializer->createSecurityContext(OUString()); vcl::filter::PDFDocument aDocument; @@ -284,7 +284,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemoveAll) // testPDFRemove(), here intentionally test DocumentSignatureManager and // PDFSignatureHelper code as well. uno::Reference xSEInitializer - = xml::crypto::SEInitializer::create(mxComponentContext); + = xml::crypto::SEInitializer::create(m_xContext); uno::Reference xSecurityContext = xSEInitializer->createSecurityContext(OUString()); @@ -296,7 +296,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemoveAll) osl::File::RC::E_None, osl::File::copy(m_directories.getURLFromSrc(DATA_DIRECTORY) + "2good.pdf", aOutURL)); // Load the test document as a storage and read its two signatures. - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); std::unique_ptr pStream = utl::UcbStreamHelper::CreateStream(aOutURL, StreamMode::READ | StreamMode::WRITE); uno::Reference xStream(new utl::OStreamWrapper(std::move(pStream))); @@ -320,12 +320,12 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemoveAll) CPPUNIT_TEST_FIXTURE(PDFSigningTest, testTdf107782) { uno::Reference xSEInitializer - = xml::crypto::SEInitializer::create(mxComponentContext); + = xml::crypto::SEInitializer::create(m_xContext); uno::Reference xSecurityContext = xSEInitializer->createSecurityContext(OUString()); // Load the test document as a storage and read its signatures. - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf107782.pdf"; std::unique_ptr pStream = utl::UcbStreamHelper::CreateStream(aURL, StreamMode::READ | StreamMode::WRITE); @@ -590,13 +590,13 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testUnknownSubFilter) // Tokenize the bugdoc. uno::Reference xSEInitializer - = xml::crypto::SEInitializer::create(mxComponentContext); + = xml::crypto::SEInitializer::create(m_xContext); uno::Reference xSecurityContext = xSEInitializer->createSecurityContext(OUString()); std::unique_ptr pStream = utl::UcbStreamHelper::CreateStream( m_directories.getURLFromSrc(DATA_DIRECTORY) + "cr-comment.pdf", StreamMode::STD_READ); uno::Reference xStream(new utl::OStreamWrapper(std::move(pStream))); - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); aManager.setSignatureStream(xStream); aManager.read(/*bUseTempStream=*/false); @@ -615,14 +615,14 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testGoodCustomMagic) // Tokenize the bugdoc. uno::Reference xSEInitializer - = xml::crypto::SEInitializer::create(mxComponentContext); + = xml::crypto::SEInitializer::create(m_xContext); uno::Reference xSecurityContext = xSEInitializer->createSecurityContext(OUString()); std::unique_ptr pStream = utl::UcbStreamHelper::CreateStream( m_directories.getURLFromSrc(DATA_DIRECTORY) + "good-custom-magic.pdf", StreamMode::STD_READ); uno::Reference xStream(new utl::OStreamWrapper(std::move(pStream))); - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); aManager.setSignatureStream(xStream); aManager.read(/*bUseTempStream=*/false); diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index 5c91c17ffb1c..0f0a4a7249f2 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -96,7 +96,7 @@ void SigningTest::setUp() MacrosTest::setUpGpg(m_directories, u"xmlsecurity_signing"_ustr); // Initialize crypto after setting up the environment variables. - mxSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); + mxSEInitializer = xml::crypto::SEInitializer::create(m_xContext); mxSecurityContext = mxSEInitializer->createSecurityContext(OUString()); #if USE_CRYPTO_NSS #ifdef NSS_USE_ALG_IN_ANY_SIGNATURE @@ -141,7 +141,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDescription) save(u"writer8"_ustr); - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); uno::Reference xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( @@ -173,7 +173,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSA) save(u"writer8"_ustr); - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); uno::Reference xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( @@ -207,7 +207,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAOOXML) save(u"MS Word 2007 XML"_ustr); - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); uno::Reference xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( @@ -243,7 +243,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAPDF) save(u"writer_pdf_Export"_ustr); - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); std::unique_ptr pStream(utl::UcbStreamHelper::CreateStream( maTempFile.GetURL(), StreamMode::READ | StreamMode::WRITE)); @@ -283,7 +283,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLDescription) save(u"MS Word 2007 XML"_ustr); - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); uno::Reference xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( @@ -314,7 +314,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLAppend) // Copy the test document to a temporary file, as it'll be modified. createTempCopy(u"partial.docx"); // Load the test document as a storage and read its single signature. - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); uno::Reference xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( @@ -344,7 +344,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLAppend) CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLRemove) { // Load the test document as a storage and read its signatures: purpose1 and purpose2. - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); createTempCopy(u"multi.docx"); uno::Reference xStorage @@ -376,7 +376,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLRemoveAll) // Copy the test document to a temporary file, as it'll be modified. createTempCopy(u"partial.docx"); // Load the test document as a storage and read its single signature. - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); uno::Reference xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( @@ -406,7 +406,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLRemoveAll) = xStorage->openStreamElement(u"[Content_Types].xml"_ustr, embed::ElementModes::READWRITE); uno::Reference xInputStream = xStream->getInputStream(); uno::Sequence> aContentTypeInfo - = comphelper::OFOPXMLHelper::ReadContentTypeSequence(xInputStream, mxComponentContext); + = comphelper::OFOPXMLHelper::ReadContentTypeSequence(xInputStream, m_xContext); const uno::Sequence& rOverrides = aContentTypeInfo[1]; CPPUNIT_ASSERT( std::none_of(rOverrides.begin(), rOverrides.end(), [](const beans::StringPair& rPair) { @@ -841,7 +841,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdESNotype) createTempCopy(u"notype-xades.odt"); // Read existing signature. - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); uno::Reference xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( @@ -897,7 +897,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdES) save(u"writer8"_ustr); - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); uno::Reference xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( @@ -950,7 +950,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_ODT) save(u"writer8"_ustr); { - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); uno::Reference xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( @@ -1023,7 +1023,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_OOXML) save(u"MS Word 2007 XML"_ustr); { - DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); + DocumentSignatureManager aManager(m_xContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); uno::Reference xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL( diff --git a/xmlsecurity/qa/unit/signing/signing2.cxx b/xmlsecurity/qa/unit/signing/signing2.cxx index d59cfbec92eb..c84fa0b1051a 100644 --- a/xmlsecurity/qa/unit/signing/signing2.cxx +++ b/xmlsecurity/qa/unit/signing/signing2.cxx @@ -60,7 +60,7 @@ void SigningTest2::setUp() MacrosTest::setUpGpg(m_directories, u"xmlsecurity_signing2"_ustr); // Initialize crypto after setting up the environment variables. - mxSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); + mxSEInitializer = xml::crypto::SEInitializer::create(m_xContext); mxSecurityContext = mxSEInitializer->createSecurityContext(OUString()); #if USE_CRYPTO_NSS #ifdef NSS_USE_ALG_IN_ANY_SIGNATURE