diff --git a/Makefile.fetch b/Makefile.fetch
index 04d38de2172c..370e8bbb8dba 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -206,7 +206,6 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S
$(call fetch_Optional,MORE_FONTS,FONT_ALEF_TARBALL) \
$(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,MESON,MESON_TARBALL) \
$(call fetch_Optional,MSPUB,MSPUB_TARBALL) \
$(call fetch_Optional,MWAW,MWAW_TARBALL) \
diff --git a/Repository.mk b/Repository.mk
index f9002d087c2a..d7b5fa525e0b 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -1080,7 +1080,6 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo_fonts,\
fonts_noto_serif_hebrew \
fonts_noto_serif_lao \
fonts_reem \
- fonts_scheherazade \
) \
))
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index fa7288206da6..65c8cf703290 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1388,7 +1388,7 @@ endif
define gb_LinkTarget__use_cairo
$(call gb_LinkTarget_use_package,$(1),cairo)
$(call gb_LinkTarget_use_package,$(1),pixman)
-$(call gb_LinkTarget_use_external,$(1),freetype_headers)
+$(call gb_LinkTarget_use_external,$(1),freetype)
$(call gb_LinkTarget_set_include,$(1),\
-I$(gb_UnpackedTarball_workdir)/cairo \
-I$(gb_UnpackedTarball_workdir)/cairo/src \
@@ -4251,7 +4251,7 @@ gb_ExternalExecutable__register_xmllint :=
else # ! SYSTEM_LIBXML_FOR_BUILD
define gb_ExternalExecutable__register_xmllint
-$(call gb_ExternalExecutable_set_internal,xmllint,$(WORKDIR_FOR_BUILD)/UnpackedTarball/libxml2/$(if $(filter MSC,$(COM)),$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release))/xmllint$(gb_Executable_EXT_for_build),libxml2)
+$(call gb_ExternalExecutable_set_internal,xmllint,$(WORKDIR_FOR_BUILD)/UnpackedTarball/libxml2/xmllint$(gb_Executable_EXT_for_build),libxml2)
$(call gb_ExternalExecutable_add_dependencies,xmllint,\
$(if $(filter WNT,$(OS)),$(call gb_Package_get_target,icu_ure)) \
$(call gb_Package_get_target,libxml2) \
diff --git a/android/app/AndroidManifest.xml b/android/app/AndroidManifest.xml
index 098f7e6abba7..96cf5b32da4d 100644
--- a/android/app/AndroidManifest.xml
+++ b/android/app/AndroidManifest.xml
@@ -74,6 +74,7 @@
+
diff --git a/android/app/res/values-nl/strings.xml b/android/app/res/values-nl/strings.xml
index c521790d56c4..24214bcf70cf 100644
--- a/android/app/res/values-nl/strings.xml
+++ b/android/app/res/values-nl/strings.xml
@@ -86,7 +86,7 @@
OK
Annuleren
Huidige UNO-opdracht
- PDF-export voltooit
+ PDF-export voltooid
Kan niet exporteren naar PDF
Kan bestand niet opslaan
Fout
@@ -106,7 +106,7 @@
Experimentele modus
Schakel de ontwikkelaarsmodus in, waarin u UNO-opdrachten binnen de app kunt verzenden. Gebruik op eigen risico.
Opslaan als…
- Opslaan voltooit
+ Opslaan voltooid
Het document opslaan voordat u het sluit?
Extra lengte invoeren in 100ste/mm
Maximale kwaliteit
diff --git a/android/app/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/app/src/java/org/libreoffice/LibreOfficeMainActivity.java
index 215515a207e9..896c448fd9f4 100644
--- a/android/app/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/app/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -330,11 +330,16 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Shared
private boolean copyFileToTemp(Uri documentUri) {
// CSV files need a .csv suffix to be opened in Calc.
+ // Markdown files need an .md suffix to be imported as Markdown and not plain text
String suffix = null;
String intentType = getIntent().getType();
+ if (intentType == null)
+ intentType = getContentResolver().getType(documentUri);
// K-9 mail uses the first, GMail uses the second variant.
if ("text/comma-separated-values".equals(intentType) || "text/csv".equals(intentType))
suffix = ".csv";
+ else if ("text/markdown".equals(intentType))
+ suffix = ".md";
try {
mTempFile = File.createTempFile("LibreOffice", suffix, this.getCacheDir());
diff --git a/android/app/src/java/org/libreoffice/ui/FileUtilities.java b/android/app/src/java/org/libreoffice/ui/FileUtilities.java
index f7fa856217fc..3af0a624e438 100644
--- a/android/app/src/java/org/libreoffice/ui/FileUtilities.java
+++ b/android/app/src/java/org/libreoffice/ui/FileUtilities.java
@@ -85,6 +85,7 @@ public class FileUtilities {
// Other
mExtnMap.put(".csv", CALC);
+ mExtnMap.put(".md", DOC);
mExtnMap.put(".wps", DOC);
mExtnMap.put(".key", IMPRESS);
mExtnMap.put(".abw", DOC);
diff --git a/android/app/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/app/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index a6fa8fe44af2..b7326a34ed70 100644
--- a/android/app/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/app/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -111,6 +111,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements View.OnC
"application/vnd.openxmlformats-officedocument.presentationml.template",
"text/csv",
"text/comma-separated-values",
+ "text/markdown",
"application/vnd.ms-works",
"application/vnd.apple.keynote",
"application/x-abiword",
diff --git a/android/gradle/libs.versions.toml b/android/gradle/libs.versions.toml
index 4829d80d5481..4ffd8d7a6dce 100644
--- a/android/gradle/libs.versions.toml
+++ b/android/gradle/libs.versions.toml
@@ -1,6 +1,6 @@
[versions]
constraintlayout_version = "2.2.1"
-gradle_version = "9.3.1"
+gradle_version = "9.4.1"
material_version = "1.13.0"
preference_version = "1.2.1"
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 22e55d385d22..a9b345fd3a39 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionSha256Sum=a3c4ba4aca8f0075688b9c5b18939fd28e8cb4357c227da5c1d9f38343791439
-distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-all.zip
+distributionSha256Sum=87a2216cc1f9122192d4e0fe905ffdf1b4c72cff797e9f733b174e157cadd396
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-all.zip
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx
index 41e5c53d84de..b0bc4fd0064d 100644
--- a/basic/source/runtime/ddectrl.cxx
+++ b/basic/source/runtime/ddectrl.cxx
@@ -22,8 +22,8 @@
#include "ddectrl.hxx"
#include
-#define DDE_FIRSTERR 0x4000
-#define DDE_LASTERR 0x4011
+constexpr tools::Long DDE_FIRSTERR = 0x4000;
+constexpr tools::Long DDE_LASTERR = 0x4011;
const ErrCode nDdeErrMap[] =
{
diff --git a/chart2/inc/strings.hrc b/chart2/inc/strings.hrc
index 9d09aef45c36..7cb8c04eba1d 100644
--- a/chart2/inc/strings.hrc
+++ b/chart2/inc/strings.hrc
@@ -185,6 +185,8 @@
#define STR_INVALID_TIME_UNIT NC_("STR_INVALID_TIME_UNIT", "The major and minor interval need to be greater or equal to the resolution. Check your input.")
#define STR_UNSUPPORTED_CHART_TYPE NC_("STR_UNSUPPORTED_CHART_TYPE", "One or more chart types are unsupported in this version of %PRODUCTNAME")
+#define STR_RANGE_FOR_VALUETYPE NC_("STR_RANGE_FOR_VALUETYPE", "Ran~ge for %VALUETYPE")
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/qa/extras/chart2import2.cxx b/chart2/qa/extras/chart2import2.cxx
index 04e0770dd143..27758c956449 100644
--- a/chart2/qa/extras/chart2import2.cxx
+++ b/chart2/qa/extras/chart2import2.cxx
@@ -14,6 +14,9 @@
#include
#include
#include
+#include
+#include
+#include
#include
#include
#include
@@ -2038,6 +2041,66 @@ CPPUNIT_TEST_FIXTURE(Chart2ImportTest2, TestParetoDefaultColor)
CPPUNIT_ASSERT_EQUAL(nCorrectColor, nFillColor);
}
+CPPUNIT_TEST_FIXTURE(Chart2ImportTest2, testTdf164516BarOfPieDiagram)
+{
+ loadFromFile(u"ods/chart.ods");
+
+ uno::Reference xChartComp = getChartCompFromSheet(0, 0);
+ uno::Reference xChartDoc(xChartComp, uno::UNO_QUERY_THROW);
+ uno::Reference xFactory(xChartDoc, uno::UNO_QUERY_THROW);
+
+ // tdf#164516 - switch the chart type to bar-of-pie using the chart API
+ uno::Reference xDiagram(
+ xFactory->createInstance(u"com.sun.star.chart.BarOfPieDiagram"_ustr), uno::UNO_QUERY);
+ xChartDoc->setDiagram(xDiagram);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: com.sun.star.chart.BarOfPieDiagram
+ // - Actual : com.sun.star.chart.BarDiagram
+ // i.e. the service name was unknown and the chart stays a bar chart
+ CPPUNIT_ASSERT_EQUAL(u"com.sun.star.chart.BarOfPieDiagram"_ustr,
+ xChartDoc->getDiagram()->getDiagramType());
+
+ uno::Reference xChart2Doc(xChartComp, uno::UNO_QUERY_THROW);
+ uno::Reference xChartType = getChartTypeFromDoc(xChart2Doc, 0);
+ CPPUNIT_ASSERT_EQUAL(u"com.sun.star.chart2.PieChartType"_ustr, xChartType->getChartType());
+
+ uno::Reference xPropSet(xChartType, uno::UNO_QUERY_THROW);
+ chart2::PieChartSubType eSubType;
+ CPPUNIT_ASSERT(xPropSet->getPropertyValue(u"SubPieType"_ustr) >>= eSubType);
+ CPPUNIT_ASSERT_EQUAL(chart2::PieChartSubType_BAR, eSubType);
+}
+
+CPPUNIT_TEST_FIXTURE(Chart2ImportTest2, testTdf164516PieOfPieDiagram)
+{
+ loadFromFile(u"ods/chart.ods");
+
+ uno::Reference xChartComp = getChartCompFromSheet(0, 0);
+ uno::Reference xChartDoc(xChartComp, uno::UNO_QUERY_THROW);
+ uno::Reference xFactory(xChartDoc, uno::UNO_QUERY_THROW);
+
+ // tdf#164516 - switch the chart type to pie-of-pie using the chart API
+ uno::Reference xDiagram(
+ xFactory->createInstance(u"com.sun.star.chart.PieOfPieDiagram"_ustr), uno::UNO_QUERY);
+ xChartDoc->setDiagram(xDiagram);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: com.sun.star.chart.PieOfPieDiagram
+ // - Actual : com.sun.star.chart.BarDiagram
+ // i.e. the service name was unknown and the chart stays a bar chart
+ CPPUNIT_ASSERT_EQUAL(u"com.sun.star.chart.PieOfPieDiagram"_ustr,
+ xChartDoc->getDiagram()->getDiagramType());
+
+ uno::Reference xChart2Doc(xChartComp, uno::UNO_QUERY_THROW);
+ uno::Reference xChartType = getChartTypeFromDoc(xChart2Doc, 0);
+ CPPUNIT_ASSERT_EQUAL(u"com.sun.star.chart2.PieChartType"_ustr, xChartType->getChartType());
+
+ uno::Reference xPropSet(xChartType, uno::UNO_QUERY_THROW);
+ chart2::PieChartSubType eSubType;
+ CPPUNIT_ASSERT(xPropSet->getPropertyValue(u"SubPieType"_ustr) >>= eSubType);
+ CPPUNIT_ASSERT_EQUAL(chart2::PieChartSubType_PIE, eSubType);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 2888ee9b0672..59fddcc390e2 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -84,6 +84,8 @@ enum eServiceType
SERVICE_NAME_NET_DIAGRAM,
SERVICE_NAME_FILLED_NET_DIAGRAM,
SERVICE_NAME_PIE_DIAGRAM,
+ SERVICE_NAME_BAR_OF_PIE_DIAGRAM,
+ SERVICE_NAME_PIE_OF_PIE_DIAGRAM,
SERVICE_NAME_STOCK_DIAGRAM,
SERVICE_NAME_XY_DIAGRAM,
SERVICE_NAME_BUBBLE_DIAGRAM,
@@ -114,6 +116,8 @@ tServiceNameMap & lcl_getStaticServiceNameMap()
{"com.sun.star.chart.NetDiagram", SERVICE_NAME_NET_DIAGRAM},
{"com.sun.star.chart.FilledNetDiagram", SERVICE_NAME_FILLED_NET_DIAGRAM},
{"com.sun.star.chart.PieDiagram", SERVICE_NAME_PIE_DIAGRAM},
+ {"com.sun.star.chart.BarOfPieDiagram", SERVICE_NAME_BAR_OF_PIE_DIAGRAM},
+ {"com.sun.star.chart.PieOfPieDiagram", SERVICE_NAME_PIE_OF_PIE_DIAGRAM},
{"com.sun.star.chart.StockDiagram", SERVICE_NAME_STOCK_DIAGRAM},
{"com.sun.star.chart.XYDiagram", SERVICE_NAME_XY_DIAGRAM},
{"com.sun.star.chart.BubbleDiagram", SERVICE_NAME_BUBBLE_DIAGRAM},
@@ -1207,6 +1211,22 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
bCreateDiagram = true;
}
break;
+ case SERVICE_NAME_BAR_OF_PIE_DIAGRAM:
+ if (xChartTypeManager.is())
+ {
+ xTemplate = xChartTypeManager->createTemplate(
+ u"com.sun.star.chart2.template.BarOfPie"_ustr);
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_PIE_OF_PIE_DIAGRAM:
+ if (xChartTypeManager.is())
+ {
+ xTemplate = xChartTypeManager->createTemplate(
+ u"com.sun.star.chart2.template.PieOfPie"_ustr);
+ bCreateDiagram = true;
+ }
+ break;
case SERVICE_NAME_STOCK_DIAGRAM:
if( xChartTypeManager.is())
{
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index 2206e89c7f1f..27b9b2f016dd 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -183,7 +183,6 @@ DataSourceTabPage::DataSourceTabPage(weld::Container* pPage, weld::DialogControl
m_xLB_ROLE->get_height_rows(5));
m_xFT_CAPTION->set_visible(!bHideDescription);
- m_aFixedTextRange = m_xFT_RANGE->get_label();
SetPageTitle(SchResId(STR_OBJECT_DATASERIES_PLURAL));
// set handlers
@@ -473,15 +472,9 @@ IMPL_LINK_NOARG(DataSourceTabPage, RoleSelectionChangedHdl, weld::ItemView&, voi
OUString aSelectedRoleUI = lcl_GetSelectedRole( *m_xLB_ROLE, true );
OUString aSelectedRange = lcl_GetSelectedRolesRange( *m_xLB_ROLE );
- // replace role in fixed text label
- static constexpr OUString aReplacementStr( u"%VALUETYPE"_ustr );
- sal_Int32 nIndex = m_aFixedTextRange.indexOf( aReplacementStr );
- if( nIndex != -1 )
- {
- m_xFT_RANGE->set_label(
- m_aFixedTextRange.replaceAt(
- nIndex, aReplacementStr.getLength(), aSelectedRoleUI ));
- }
+ // add the role in fixed text label
+ m_xFT_RANGE->set_label(
+ SchResId(STR_RANGE_FOR_VALUETYPE).replaceFirst(u"%VALUETYPE", aSelectedRoleUI));
m_xEDT_RANGE->set_text(aSelectedRange);
isValid();
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx
index 0ecb3dffd2bc..22efd8449d34 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.hxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.hxx
@@ -121,8 +121,6 @@ private:
std::vector> m_aEntries;
- OUString m_aFixedTextRange;
-
ChartTypeTemplateProvider * m_pTemplateProvider;
DialogModel & m_rDialogModel;
weld::Entry* m_pCurrentRangeChoosingField;
diff --git a/chart2/source/model/template/FunnelChartTypeTemplate.cxx b/chart2/source/model/template/FunnelChartTypeTemplate.cxx
index 1dff397bccd2..1137eca284aa 100644
--- a/chart2/source/model/template/FunnelChartTypeTemplate.cxx
+++ b/chart2/source/model/template/FunnelChartTypeTemplate.cxx
@@ -13,12 +13,19 @@
#include
#include
#include
+#include
+#include
+#include
+#include
#include
#include
#include
#include
+#include
#include
+#include
+
#include
using namespace ::com::sun::star;
@@ -188,6 +195,42 @@ void FunnelChartTypeTemplate::resetStyles2(const rtl::Reference<::chart::Diagram
xDiagram->setVertical(false);
}
+bool FunnelChartTypeTemplate::isSwapXAndY() const
+{
+ // Ordinate axis is vertical
+ return true;
+}
+
+void FunnelChartTypeTemplate::createCoordinateSystems(
+ const rtl::Reference<::chart::Diagram>& xDiagram)
+{
+ ChartTypeTemplate::createCoordinateSystems(xDiagram);
+
+ xDiagram->setVertical(isSwapXAndY());
+}
+
+void FunnelChartTypeTemplate::adaptAxes(
+ const std::vector>& rCoordSys)
+{
+ // override to hide the horizontal (value) axis
+ ChartTypeTemplate::adaptAxes(rCoordSys);
+
+ if (rCoordSys.empty())
+ return;
+
+ for (rtl::Reference const& xCooSys : rCoordSys)
+ {
+ if (!xCooSys.is())
+ continue;
+
+ rtl::Reference xAxis = AxisHelper::getAxis(1, 0, xCooSys);
+ if (!xAxis.is())
+ continue;
+
+ xAxis->setPropertyValue(u"Show"_ustr, uno::Any(false));
+ }
+}
+
IMPLEMENT_FORWARD_XINTERFACE2(FunnelChartTypeTemplate, ChartTypeTemplate, OPropertySet)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(FunnelChartTypeTemplate, ChartTypeTemplate, OPropertySet)
diff --git a/chart2/source/model/template/FunnelChartTypeTemplate.hxx b/chart2/source/model/template/FunnelChartTypeTemplate.hxx
index ffaefeace151..a6b3ab061472 100644
--- a/chart2/source/model/template/FunnelChartTypeTemplate.hxx
+++ b/chart2/source/model/template/FunnelChartTypeTemplate.hxx
@@ -45,12 +45,16 @@ protected:
::sal_Int32 nChartTypeGroupIndex, ::sal_Int32 nSeriesIndex,
::sal_Int32 nSeriesCount) override;
virtual void resetStyles2(const rtl::Reference<::chart::Diagram>& xDiagram) override;
+ virtual void createCoordinateSystems(const rtl::Reference<::chart::Diagram>& xDiagram) override;
// ____ ChartTypeTemplate ____
virtual sal_Int32 getDimension() const override;
virtual rtl::Reference<::chart::ChartType>
getChartTypeForIndex(sal_Int32 nChartTypeIndex) override;
+ virtual bool isSwapXAndY() const override;
+ virtual void
+ adaptAxes(const std::vector>& rCoordSys) override;
private:
sal_Int32 m_nDim;
diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx
index fe2c67792ad5..ba4fe5a67bc0 100644
--- a/chart2/source/view/charttypes/Splines.cxx
+++ b/chart2/source/view/charttypes/Splines.cxx
@@ -38,6 +38,75 @@ typedef std::pair< double, double > tPointType;
typedef std::vector< tPointType > tPointVecType;
typedef tPointVecType::size_type lcl_tSizeType;
+bool lcl_CalculateUpperTriangularForm(
+ tPointVecType& rPointsIn
+ , std::vector>& rMatN
+ , std::vector& rShift )
+{
+ lcl_tSizeType r = 0; // true row index
+ lcl_tSizeType c = 0; // true column index
+ double fDivisor = 1.0; // used for diagonal element
+ double fEliminate = 1.0; // used for the element, that will become zero
+ bool bIsSuccessful = true;
+ const lcl_tSizeType n = rPointsIn.size() - 1;
+ for (c = 0 ; c <= n && bIsSuccessful; ++c)
+ {
+ // search for first non-zero downwards
+ r = c;
+ while ( r < n && rMatN[r][c-rShift[r]] == 0 )
+ {
+ ++r;
+ }
+ if (rMatN[r][c-rShift[r]] == 0.0)
+ {
+ // Matrix N is singular, although this is mathematically impossible
+ bIsSuccessful = false;
+ }
+ else
+ {
+ // exchange total row r with total row c if necessary
+ if (r != c)
+ {
+ std::swap( rMatN[r], rMatN[c] );
+ std::swap( rPointsIn[r], rPointsIn[c] );
+ std::swap( rShift[r], rShift[c] );
+ }
+
+ sal_uInt32 p = rMatN[c].size() - 1;
+
+ // divide row c, so that element(c,c) becomes 1
+ fDivisor = rMatN[c][c-rShift[c]]; // not zero, see above
+ for (sal_uInt32 i = 0; i <= p; ++i)
+ {
+ rMatN[c][i] /= fDivisor;
+ }
+ rPointsIn[c].first /= fDivisor;
+ rPointsIn[c].second /= fDivisor;
+
+ // eliminate forward, examine row c+1 to n-1 (worst case)
+ // stop if first non-zero element in row has an higher column as c
+ // look at nShift for that, elements in nShift are equal or increasing
+ for ( r = c+1; r < n && rShift[r]<=c ; ++r)
+ {
+ fEliminate = rMatN[r][0];
+ if (fEliminate != 0.0) // else accidentally zero, nothing to do
+ {
+ for (sal_uInt32 i = 1; i <= p; ++i)
+ {
+ rMatN[r][i-1] = rMatN[r][i] - fEliminate * rMatN[c][i];
+ }
+ rMatN[r][p]=0;
+ rPointsIn[r].first -= fEliminate * rPointsIn[c].first;
+ rPointsIn[r].second -= fEliminate * rPointsIn[c].second;
+ ++rShift[r];
+ }
+ }
+ }
+ }
+
+ return bIsSuccessful;
+}
+
class lcl_SplineCalculation
{
public:
@@ -719,63 +788,9 @@ void SplineCalculator::CalculateBSplines(
// Get matrix C of control points from the matrix equation aMatN * C = aPointsIn
// aPointsIn is overwritten with C.
// Gaussian elimination is possible without pivoting, see reference
- lcl_tSizeType r = 0; // true row index
- lcl_tSizeType c = 0; // true column index
- double fDivisor = 1.0; // used for diagonal element
- double fEliminate = 1.0; // used for the element, that will become zero
- bool bIsSuccessful = true;
- for (c = 0 ; c <= n && bIsSuccessful; ++c)
- {
- // search for first non-zero downwards
- r = c;
- while ( r < n && aMatN[r][c-aShift[r]] == 0 )
- {
- ++r;
- }
- if (aMatN[r][c-aShift[r]] == 0.0)
- {
- // Matrix N is singular, although this is mathematically impossible
- bIsSuccessful = false;
- }
- else
- {
- // exchange total row r with total row c if necessary
- if (r != c)
- {
- std::swap( aMatN[r], aMatN[c] );
- std::swap( aPointsIn[r], aPointsIn[c] );
- std::swap( aShift[r], aShift[c] );
- }
- // divide row c, so that element(c,c) becomes 1
- fDivisor = aMatN[c][c-aShift[c]]; // not zero, see above
- for (sal_uInt32 i = 0; i <= p; ++i)
- {
- aMatN[c][i] /= fDivisor;
- }
- aPointsIn[c].first /= fDivisor;
- aPointsIn[c].second /= fDivisor;
+ bool bIsSuccessful = lcl_CalculateUpperTriangularForm(aPointsIn, aMatN, aShift);
- // eliminate forward, examine row c+1 to n-1 (worst case)
- // stop if first non-zero element in row has an higher column as c
- // look at nShift for that, elements in nShift are equal or increasing
- for ( r = c+1; r < n && aShift[r]<=c ; ++r)
- {
- fEliminate = aMatN[r][0];
- if (fEliminate != 0.0) // else accidentally zero, nothing to do
- {
- for (sal_uInt32 i = 1; i <= p; ++i)
- {
- aMatN[r][i-1] = aMatN[r][i] - fEliminate * aMatN[c][i];
- }
- aMatN[r][p]=0;
- aPointsIn[r].first -= fEliminate * aPointsIn[c].first;
- aPointsIn[r].second -= fEliminate * aPointsIn[c].second;
- ++aShift[r];
- }
- }
- }
- }// upper triangle form is reached
if( bIsSuccessful)
{
// eliminate backwards, begin with last column
@@ -785,10 +800,11 @@ void SplineCalculator::CalculateBSplines(
// diagonal are zero and do not influence other rows.
// Full matrix N has semibandwidth < p, therefore element(r,c) is
// zero, if abs(r-cc)>=p. abs(r-cc)=cc-r, because r
True
False
- Ran_ge for %VALUETYPE
+ Ran_ge
True
EDT_RANGE
0
diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk
index 4939cda63aba..eb27e52361cf 100644
--- a/comphelper/Library_comphelper.mk
+++ b/comphelper/Library_comphelper.mk
@@ -117,6 +117,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
comphelper/source/misc/hash \
comphelper/source/misc/instancelocker \
comphelper/source/misc/interaction \
+ comphelper/source/misc/invocationhelper \
comphelper/source/misc/logging \
comphelper/source/misc/lok \
comphelper/source/misc/mimeconfighelper \
diff --git a/comphelper/source/misc/invocationhelper.cxx b/comphelper/source/misc/invocationhelper.cxx
new file mode 100644
index 000000000000..90f532d891dd
--- /dev/null
+++ b/comphelper/source/misc/invocationhelper.cxx
@@ -0,0 +1,243 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace comphelper
+{
+constexpr sal_Int32 ALLOWED_METHODS
+ = css::beans::MethodConcept::ALL ^ css::beans::MethodConcept::DANGEROUS;
+constexpr sal_Int32 ALLOWED_PROPERTIES
+ = css::beans::PropertyConcept::ALL ^ css::beans::PropertyConcept::DANGEROUS;
+
+InvocationHelper::InvocationHelper(const css::uno::Reference& xContext)
+ : m_xContext(xContext)
+{
+}
+
+css::uno::Reference
+InvocationHelper::getIntrospection(css::script::XInvocation* pInvocation)
+{
+ ensureIntrospection(pInvocation);
+
+ return m_xIntrospectionAccess;
+}
+
+css::uno::Sequence InvocationHelper::prepareInvokeParams(
+ const css::uno::Sequence& aParams,
+ const css::uno::Sequence& aParamInfos)
+{
+ css::uno::Sequence aInvokeParams(aParamInfos.getLength());
+ css::uno::Any* pInvokeParams = aInvokeParams.getArray();
+
+ for (sal_Int32 nParam = 0, nParams = aParamInfos.getLength(); nParam < nParams; ++nParam)
+ {
+ const css::reflection::ParamInfo& rParam = aParamInfos[nParam];
+
+ if (rParam.aMode == css::reflection::ParamMode_OUT)
+ {
+ // Initialize default value if the parameter is OUT
+ rParam.aType->createObject(pInvokeParams[nParam]);
+ }
+ else
+ {
+ css::uno::Type aDestType(rParam.aType->getTypeClass(), rParam.aType->getName());
+
+ try
+ {
+ pInvokeParams[nParam] = m_xTypeConverter->convertTo(aParams[nParam], aDestType);
+ }
+ catch (css::script::CannotConvertException& e)
+ {
+ // Add optional parameter index
+ e.ArgumentIndex = nParam;
+ throw;
+ }
+ }
+ }
+
+ return aInvokeParams;
+}
+
+css::uno::Any InvocationHelper::invoke(css::script::XInvocation* pInvocation,
+ const OUString& aFunctionName,
+ const css::uno::Sequence& aParams,
+ css::uno::Sequence& aOutParamIndex,
+ css::uno::Sequence& aOutParam)
+{
+ // This implementation is heavily inspired by Invocation_Impl::invoke
+
+ ensureIntrospection(pInvocation);
+
+ css::uno::Reference xMethod;
+
+ try
+ {
+ xMethod = m_xIntrospectionAccess->getMethod(aFunctionName, ALLOWED_METHODS);
+ }
+ catch (css::lang::NoSuchMethodException&)
+ {
+ throw css::lang::IllegalArgumentException(u"no such method"_ustr, pInvocation, 0);
+ }
+
+ css::uno::Sequence aParamInfos = xMethod->getParameterInfos();
+
+ if (aParams.getLength() != aParamInfos.getLength())
+ {
+ throw css::lang::IllegalArgumentException(
+ "incorrect number of parameters passed invoking function " + aFunctionName
+ + ": expected " + OUString::number(aParamInfos.getLength()) + ", got "
+ + OUString::number(aParams.getLength()),
+ pInvocation, 1);
+ }
+
+ ensureTypeConverter();
+
+ css::uno::Sequence aInvokeParams = prepareInvokeParams(aParams, aParamInfos);
+
+ css::uno::Reference xInvocation(pInvocation);
+ css::uno::Any aRet = xMethod->invoke(css::uno::Any(xInvocation), aInvokeParams);
+
+ size_t nOutParams = std::count_if(
+ std::cbegin(aParamInfos), std::cend(aParamInfos),
+ [](const auto& rParamInfo) { return rParamInfo.aMode != css::reflection::ParamMode_IN; });
+ aOutParamIndex.realloc(nOutParams);
+ aOutParam.realloc(nOutParams);
+
+ sal_Int16* pOutParamIndex = aOutParamIndex.getArray();
+ css::uno::Any* pOutParam = aOutParam.getArray();
+
+ for (sal_Int32 nParam = 0, nOutParam = 0, nParams = aParamInfos.getLength(); nParam < nParams;
+ ++nParam)
+ {
+ if (aParamInfos[nParam].aMode == css::reflection::ParamMode_IN)
+ continue;
+
+ pOutParamIndex[nOutParam] = nParam;
+ pOutParam[nOutParam] = aInvokeParams[nParam];
+ nOutParam++;
+ }
+
+ return aRet;
+}
+
+void InvocationHelper::setValue(css::script::XInvocation* pInvocation,
+ const OUString& aPropertyName, const css::uno::Any& aValue)
+{
+ ensureIntrospection(pInvocation);
+
+ css::uno::Reference xPropertySet(m_xIntrospectionAccess,
+ css::uno::UNO_QUERY);
+
+ if (!xPropertySet.is())
+ throw css::beans::UnknownPropertyException(aPropertyName);
+
+ css::beans::Property aProp;
+
+ try
+ {
+ aProp = m_xIntrospectionAccess->getProperty(aPropertyName, ALLOWED_PROPERTIES);
+ }
+ catch (css::container::NoSuchElementException&)
+ {
+ throw css::beans::UnknownPropertyException(aPropertyName);
+ }
+
+ ensureTypeConverter();
+
+ css::uno::Any aConvertedValue = m_xTypeConverter->convertTo(aValue, aProp.Type);
+
+ try
+ {
+ return xPropertySet->setPropertyValue(aPropertyName, aConvertedValue);
+ }
+ catch (css::lang::WrappedTargetException& e)
+ {
+ throw css::reflection::InvocationTargetException(e.Message, pInvocation, e.TargetException);
+ }
+ catch (css::beans::PropertyVetoException& e)
+ {
+ throw css::reflection::InvocationTargetException(e.Message, pInvocation, css::uno::Any(e));
+ }
+}
+
+css::uno::Any InvocationHelper::getValue(css::script::XInvocation* pInvocation,
+ const OUString& aPropertyName)
+{
+ // Make sure the introspection access implements XPropertySet and that the property is one of
+ // the ones allowed by hasProperty.
+
+ if (!hasProperty(pInvocation, aPropertyName))
+ throw css::beans::UnknownPropertyException(aPropertyName);
+
+ css::uno::Reference xPropertySet(m_xIntrospectionAccess,
+ css::uno::UNO_QUERY_THROW);
+
+ try
+ {
+ return xPropertySet->getPropertyValue(aPropertyName);
+ }
+ catch (css::lang::WrappedTargetException& e)
+ {
+ throw css::reflection::InvocationTargetException(e.Message, pInvocation, e.TargetException);
+ }
+}
+
+sal_Bool InvocationHelper::hasMethod(css::script::XInvocation* pInvocation, const OUString& aName)
+{
+ ensureIntrospection(pInvocation);
+
+ return m_xIntrospectionAccess->hasMethod(aName, ALLOWED_METHODS);
+}
+
+sal_Bool InvocationHelper::hasProperty(css::script::XInvocation* pInvocation, const OUString& aName)
+{
+ ensureIntrospection(pInvocation);
+
+ css::uno::Reference xPropertySet(m_xIntrospectionAccess,
+ css::uno::UNO_QUERY);
+
+ return xPropertySet.is() && m_xIntrospectionAccess->hasProperty(aName, ALLOWED_PROPERTIES);
+}
+
+void InvocationHelper::ensureTypeConverter()
+{
+ if (m_xTypeConverter.is())
+ return;
+
+ m_xTypeConverter = css::script::Converter::create(m_xContext);
+}
+
+void InvocationHelper::ensureIntrospection(css::script::XInvocation* pInvocation)
+{
+ if (m_xIntrospectionAccess.is())
+ return;
+
+ css::uno::Reference xIntrospection
+ = css::beans::theIntrospection::get(m_xContext);
+
+ css::uno::Reference xInvocation(pInvocation);
+ m_xIntrospectionAccess = xIntrospection->inspect(css::uno::Any(xInvocation));
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/consttobool.cxx b/compilerplugins/clang/consttobool.cxx
index bb4fc31911b5..831ef6d300ac 100644
--- a/compilerplugins/clang/consttobool.cxx
+++ b/compilerplugins/clang/consttobool.cxx
@@ -115,6 +115,26 @@ public:
return ret;
}
+ bool TraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr* expr)
+ {
+ // The C++ definition of assert in glibc 2.44 checks that its argument is a single
+ // expression with `1 ? 1 : bool (__VA_ARGS__)`, which re-evaluates the whole argument in a
+ // branch that is never taken; do not descend into that dead branch to avoid duplicate
+ // warnings:
+ if (expr->getType()->isBooleanType())
+ {
+ auto const loc = expr->getBeginLoc();
+ if (compiler.getSourceManager().isMacroBodyExpansion(loc)
+ && Lexer::getImmediateMacroName(loc, compiler.getSourceManager(),
+ compiler.getLangOpts())
+ == "assert")
+ {
+ return true;
+ }
+ }
+ return FilteringPlugin::TraverseCXXFunctionalCastExpr(expr);
+ }
+
bool VisitImplicitCastExpr(ImplicitCastExpr const* expr)
{
if (ignoreLocation(expr))
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
index a73d3694334b..67c037bf89cb 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -241,15 +241,7 @@ public:
FilteringPlugin(data) {}
virtual void run() override
- {
- std::string fn(handler.getMainFileName());
- loplugin::normalizeDotDotInFilePath(fn);
- if (loplugin::hasPathnamePrefix(fn, SRCDIR "/soltools/cpp")
- || loplugin::hasPathnamePrefix(fn, SRCDIR "/soltools/mkdepend"))
- return;
-
- TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
- }
+ { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
bool TraverseCallExpr(CallExpr * expr);
@@ -488,6 +480,18 @@ bool ImplicitBoolConversion::TraverseCXXStaticCastExpr(CXXStaticCastExpr * expr)
bool ImplicitBoolConversion::TraverseCXXFunctionalCastExpr(
CXXFunctionalCastExpr * expr)
{
+ // The C++ definition of assert in glibc 2.44 checks that its argument is a single expression
+ // with `1 ? 1 : bool (__VA_ARGS__)`, which re-evaluates the whole argument in a branch that is
+ // never taken; do not descend into that dead branch to avoid duplicate warnings:
+ if (expr->getType()->isBooleanType()) {
+ auto const loc = expr->getBeginLoc();
+ if (compiler.getSourceManager().isMacroBodyExpansion(loc)
+ && Lexer::getImmediateMacroName(
+ loc, compiler.getSourceManager(), compiler.getLangOpts()) == "assert")
+ {
+ return true;
+ }
+ }
nested.push(std::vector());
bool bRet = RecursiveASTVisitor::TraverseCXXFunctionalCastExpr(expr);
assert(!nested.empty());
@@ -721,6 +725,15 @@ bool ImplicitBoolConversion::VisitImplicitCastExpr(
}
}
}
+ // Ignore the conversion from bool to int in the `1 ? 1 : bool (__VA_ARGS__)` argument check
+ // of the C++ definition of assert in glibc 2.44:
+ auto const loc = expr->getBeginLoc();
+ if (compiler.getSourceManager().isMacroBodyExpansion(loc)
+ && Lexer::getImmediateMacroName(
+ loc, compiler.getSourceManager(), compiler.getLangOpts()) == "assert")
+ {
+ return true;
+ }
if (nested.empty()) {
reportWarning(expr);
} else {
@@ -757,6 +770,13 @@ bool ImplicitBoolConversion::VisitImplicitCastExpr(
&& !calls.empty())
{
CallExpr const * call = calls.top();
+ // Ignore the conversion from pointer in the `extern _Bool __assert_single_arg (_Bool)`
+ // check in the C definition of assert in glibc 2.44:
+ if (auto const fd = call->getDirectCallee()) {
+ if (fd->getIdentifier() && fd->getName() == "__assert_single_arg") {
+ return true;
+ }
+ }
if (std::any_of(
call->arg_begin(), call->arg_end(),
[expr](Expr const * e) { return expr == e->IgnoreParens(); }))
diff --git a/compilerplugins/clang/pointerbool.cxx b/compilerplugins/clang/pointerbool.cxx
index f5c2dfd4951b..ccd482f04584 100644
--- a/compilerplugins/clang/pointerbool.cxx
+++ b/compilerplugins/clang/pointerbool.cxx
@@ -45,6 +45,9 @@ public:
bool PreTraverseFunctionDecl(FunctionDecl* decl);
bool PostTraverseFunctionDecl(FunctionDecl* decl, bool);
bool TraverseFunctionDecl(FunctionDecl* decl);
+ bool PreTraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr* expr);
+ bool PostTraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr* expr, bool);
+ bool TraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr* expr);
bool VisitCallExpr(CallExpr const*);
private:
@@ -76,14 +79,36 @@ bool PointerBool::TraverseFunctionDecl(FunctionDecl* decl)
return ret;
}
+bool PointerBool::PreTraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr* expr)
+{
+ // The C++ definition of assert in glibc 2.44 checks that its argument is a single expression
+ // with `1 ? 1 : bool (__VA_ARGS__)`, which re-evaluates the whole argument in a branch that is
+ // never taken; do not descend into that dead branch to avoid duplicate warnings:
+ if (!expr->getType()->isBooleanType())
+ {
+ return true;
+ }
+ auto const loc = expr->getBeginLoc();
+ return !compiler.getSourceManager().isMacroBodyExpansion(loc)
+ || Lexer::getImmediateMacroName(loc, compiler.getSourceManager(), compiler.getLangOpts())
+ != "assert";
+}
+
+bool PointerBool::PostTraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr*, bool) { return true; }
+
+bool PointerBool::TraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr* expr)
+{
+ bool ret = true;
+ if (PreTraverseCXXFunctionalCastExpr(expr))
+ {
+ ret = FilteringPlugin::TraverseCXXFunctionalCastExpr(expr);
+ PostTraverseCXXFunctionalCastExpr(expr, ret);
+ }
+ return ret;
+}
+
bool PointerBool::VisitCallExpr(CallExpr const* callExpr)
{
- std::string fn(handler.getMainFileName());
- loplugin::normalizeDotDotInFilePath(fn);
- if (loplugin::hasPathnamePrefix(fn, SRCDIR "/soltools/cpp")
- || loplugin::hasPathnamePrefix(fn, SRCDIR "/soltools/mkdepend"))
- return true;
-
if (ignoreLocation(callExpr))
return true;
// TODO this doesn't currently work, the args and the params don't seem to line up
@@ -100,6 +125,11 @@ bool PointerBool::VisitCallExpr(CallExpr const* callExpr)
}
if (!functionDecl)
return true;
+ // glibc 2.44 checks that the argument to assert is a single expression by passing it to
+ // "extern _Bool __assert_single_arg (_Bool)" inside a sizeof. A pointer argument to that
+ // internal check is not a mistake in the calling code:
+ if (functionDecl->getIdentifier() && functionDecl->getName() == "__assert_single_arg")
+ return true;
unsigned len = std::min(callExpr->getNumArgs(), functionDecl->getNumParams());
for (unsigned i = 0; i < len; ++i)
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index 78b1e70e14f2..557e80a6b4ab 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -132,6 +132,23 @@ public:
return ret;
}
+ bool TraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr * expr) {
+ // The C++ definition of assert in glibc 2.44 checks that its argument is a single
+ // expression with `1 ? 1 : bool (__VA_ARGS__)`, which re-evaluates the whole argument in a
+ // branch that is never taken; do not descend into that dead branch to avoid duplicate
+ // warnings:
+ if (expr->getType()->isBooleanType()) {
+ auto const loc = expr->getBeginLoc();
+ if (compiler.getSourceManager().isMacroBodyExpansion(loc)
+ && Lexer::getImmediateMacroName(
+ loc, compiler.getSourceManager(), compiler.getLangOpts()) == "assert")
+ {
+ return true;
+ }
+ }
+ return FilteringRewritePlugin::TraverseCXXFunctionalCastExpr(expr);
+ }
+
bool VisitImplicitCastExpr(ImplicitCastExpr const * expr);
bool VisitCXXStaticCastExpr(CXXStaticCastExpr const * expr);
diff --git a/compilerplugins/clang/test/consttobool.cxx b/compilerplugins/clang/test/consttobool.cxx
index 4fe41a8140f2..aa0a824e5a66 100644
--- a/compilerplugins/clang/test/consttobool.cxx
+++ b/compilerplugins/clang/test/consttobool.cxx
@@ -64,6 +64,8 @@ int main()
}
// expected-error@+1 {{implicit conversion of constant &"msg"[0] of type 'const char *' to 'bool'; use 'true' instead [loplugin:consttobool]}}
assert("msg");
+ // expected-error@+1 {{implicit conversion of constant 2 of type 'int' to 'bool'; use 'true' instead [loplugin:consttobool]}}
+ assert(2);
#endif
}
diff --git a/compilerplugins/clang/test/implicitboolconversion.cxx b/compilerplugins/clang/test/implicitboolconversion.cxx
index 122ee363ae68..2bb00ba6c5c4 100644
--- a/compilerplugins/clang/test/implicitboolconversion.cxx
+++ b/compilerplugins/clang/test/implicitboolconversion.cxx
@@ -11,6 +11,7 @@
#include
#include
+#include
#include
#include
@@ -80,4 +81,13 @@ void f()
s8[0] = false;
}
+void testAssert([[maybe_unused]] bool b, [[maybe_unused]] int n)
+{
+ assert(b);
+#if !defined NDEBUG
+ // expected-error@+1 {{implicit conversion (IntegralCast) from 'bool' to 'int' [loplugin:implicitboolconversion]}}
+ assert(n = b);
+#endif
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/pointerbool.cxx b/compilerplugins/clang/test/pointerbool.cxx
index fcb4a9a31b57..8e32cc0250d9 100644
--- a/compilerplugins/clang/test/pointerbool.cxx
+++ b/compilerplugins/clang/test/pointerbool.cxx
@@ -7,6 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include
+
+#include
+
#include
#include
@@ -43,4 +47,16 @@ void test2(int p1)
func_bool_via_forward_template(p1);
}
+// expected-note@+1 {{method here [loplugin:pointerbool]}}
+bool func_boolA(bool);
+
+void testAssert([[maybe_unused]] int* p)
+{
+ assert(p);
+#if !defined NDEBUG
+ // expected-error@+1 {{possibly unwanted implicit conversion when calling bool param [loplugin:pointerbool]}}
+ assert(func_boolA(p));
+#endif
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/redundantcast.cxx b/compilerplugins/clang/test/redundantcast.cxx
index 47a155c64b37..55a000bf4bd7 100644
--- a/compilerplugins/clang/test/redundantcast.cxx
+++ b/compilerplugins/clang/test/redundantcast.cxx
@@ -9,6 +9,7 @@
#include
+#include
#include
#include
@@ -485,6 +486,14 @@ void testFunctionalCast2() {
S1 aTest2(S1_COL);
}
+void testAssert([[maybe_unused]] int n) {
+ assert(n > 0);
+#if !defined NDEBUG
+ // expected-error@+1 {{redundant functional cast from 'bool' to 'bool' [loplugin:redundantcast]}}
+ assert(bool(n > 0));
+#endif
+}
+
int main() {
testConstCast();
testStaticCast();
diff --git a/config_host/config_locales.h.in b/config_host/config_locales.h.in
index b9b6988cc891..18d3f041dbc5 100644
--- a/config_host/config_locales.h.in
+++ b/config_host/config_locales.h.in
@@ -38,8 +38,8 @@
#define WITH_LOCALE_hu 0
#define WITH_LOCALE_is 0
#define WITH_LOCALE_ja 0
+#define WITH_LOCALE_kmr_Latn 0
#define WITH_LOCALE_ko 0
-#define WITH_LOCALE_ku 0
#define WITH_LOCALE_ln 0
#define WITH_LOCALE_my 0
#define WITH_LOCALE_ne 0
diff --git a/configure.ac b/configure.ac
index 166e261ec39c..2b9a769034cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1108,8 +1108,6 @@ cygwin*|wsl*)
DLLPOST=".dll"
LINKFLAGSNOUNDEFS=
- # bypass check for ninja, it is not in default path, but it can be used nevertheless by default
- NINJA="assumed to be available from Visual Studio"
if test "$host_cpu" = "aarch64"; then
build_skia=yes
@@ -1498,6 +1496,7 @@ if test "$_os" != "WINNT"; then
# Clang 12.0.1 occasionally SEGVs on some of the test invocations during AC_PROG_CC with -O2):
save_CFLAGS=$CFLAGS
CFLAGS=-g
+ ac_cv_prog_cc_c23=no
AC_PROG_CC
CFLAGS=$save_CFLAGS
if test -z "$CC_BASE"; then
@@ -4758,6 +4757,10 @@ if test "$_os" = "WINNT"; then
PathFormat "$VC_PRODUCT_DIR/../Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe"
CMAKE="$formatted_path"
+ # Find the ninja that ships with Visual Studio, beside that cmake.
+ PathFormat "$VC_PRODUCT_DIR/../Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe"
+ NINJA="$formatted_path"
+
# Find the version of devenv.exe
PathFormat "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
DEVENV="$formatted_path"
@@ -10641,9 +10644,9 @@ else
fi
if test "$COM" = "MSC"; then
if test "$MSVC_USE_DEBUG_RUNTIME" = TRUE; then
- LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/Debug/libxml2d.lib"
+ LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/libxml2d.lib"
else
- LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/Release/libxml2.lib"
+ LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/libxml2.lib"
fi
else
LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
@@ -15020,7 +15023,7 @@ if test "$need_meson" = "yes"; then
fi
fi
-if test -z "$NINJA" || test "$NINJA" = 'assumed to be available from Visual Studio'; then
+if test -z "$NINJA"; then
x_NINJA=[\#]
else
x_NINJA=
diff --git a/connectivity/qa/connectivity/commontools/DBTypeConversion_test.cxx b/connectivity/qa/connectivity/commontools/DBTypeConversion_test.cxx
index a79369149a23..9fb608a228fc 100644
--- a/connectivity/qa/connectivity/commontools/DBTypeConversion_test.cxx
+++ b/connectivity/qa/connectivity/commontools/DBTypeConversion_test.cxx
@@ -52,6 +52,19 @@ public:
void test_toDateTime_date_only();
void test_toDateTime_with_nanoseconds();
+ // toTimeString / toDateTimeString tests
+ void test_toTimeString_no_fraction_when_zero_nanoseconds();
+ void test_toTimeString_keeps_full_precision();
+ void test_toDateTimeString_no_fraction_when_zero_nanoseconds();
+
+ // fractional-seconds rounding for SQL literal generation
+ void test_roundTimeFraction_rounds_to_4_digits();
+ void test_roundTimeFraction_carries_into_seconds();
+ void test_roundTimeFraction_wraps_at_midnight();
+ void test_roundDateTimeFraction_carries_into_next_day();
+ void test_roundDateTimeFraction_rolls_over_month_end();
+ void test_roundTimeFraction_noop_when_no_cap_requested();
+
CPPUNIT_TEST_SUITE(DBTypeConversionTest);
CPPUNIT_TEST(test_toDate_basic);
@@ -66,6 +79,17 @@ public:
CPPUNIT_TEST(test_toDateTime_date_only);
CPPUNIT_TEST(test_toDateTime_with_nanoseconds);
+ CPPUNIT_TEST(test_toTimeString_no_fraction_when_zero_nanoseconds);
+ CPPUNIT_TEST(test_toTimeString_keeps_full_precision);
+ CPPUNIT_TEST(test_toDateTimeString_no_fraction_when_zero_nanoseconds);
+
+ CPPUNIT_TEST(test_roundTimeFraction_rounds_to_4_digits);
+ CPPUNIT_TEST(test_roundTimeFraction_carries_into_seconds);
+ CPPUNIT_TEST(test_roundTimeFraction_wraps_at_midnight);
+ CPPUNIT_TEST(test_roundDateTimeFraction_carries_into_next_day);
+ CPPUNIT_TEST(test_roundDateTimeFraction_rolls_over_month_end);
+ CPPUNIT_TEST(test_roundTimeFraction_noop_when_no_cap_requested);
+
CPPUNIT_TEST_SUITE_END();
};
@@ -166,6 +190,118 @@ void DBTypeConversionTest::test_toDateTime_with_nanoseconds()
CPPUNIT_ASSERT_EQUAL_MESSAGE("NanoSeconds", sal_uInt32(500000000), aDT.NanoSeconds);
}
+// ----- toTimeString / toDateTimeString ---------------------------------------
+
+void DBTypeConversionTest::test_toTimeString_no_fraction_when_zero_nanoseconds()
+{
+ // tdf#153057 (reopened): TIME values must not get trailing ".000000000"
+ css::util::Time aTime;
+ aTime.Hours = 0;
+ aTime.Minutes = 3;
+ aTime.Seconds = 0;
+ aTime.NanoSeconds = 0;
+ CPPUNIT_ASSERT_EQUAL(u"00:03:00"_ustr, DBTypeConversion::toTimeString(aTime));
+}
+
+void DBTypeConversionTest::test_toTimeString_keeps_full_precision()
+{
+ css::util::Time aTime;
+ aTime.Hours = 0;
+ aTime.Minutes = 3;
+ aTime.Seconds = 0;
+ aTime.NanoSeconds = 123456789;
+ CPPUNIT_ASSERT_EQUAL(u"00:03:00.123456789"_ustr, DBTypeConversion::toTimeString(aTime));
+}
+
+void DBTypeConversionTest::test_roundTimeFraction_rounds_to_4_digits()
+{
+ // this is the rounding the Firebird is using
+ css::util::Time aTime;
+ aTime.Hours = 0;
+ aTime.Minutes = 3;
+ aTime.Seconds = 0;
+ aTime.NanoSeconds = 123456789;
+ CPPUNIT_ASSERT(!DBTypeConversion::roundTimeFraction(aTime, 4));
+ // 123456789ns rounds to the nearest 1/10000s (123500000ns = .1235).
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(123500000), aTime.NanoSeconds);
+ // toTimeString() trims trailing zeros
+ CPPUNIT_ASSERT_EQUAL(u"00:03:00.1235"_ustr, DBTypeConversion::toTimeString(aTime));
+}
+
+void DBTypeConversionTest::test_roundTimeFraction_carries_into_seconds()
+{
+ css::util::Time aTime;
+ aTime.Hours = 0;
+ aTime.Minutes = 3;
+ aTime.Seconds = 59;
+ aTime.NanoSeconds = 999960000; // rounds up to a full extra second
+ CPPUNIT_ASSERT(!DBTypeConversion::roundTimeFraction(aTime, 4));
+ CPPUNIT_ASSERT_EQUAL(u"00:04:00"_ustr, DBTypeConversion::toTimeString(aTime));
+}
+
+void DBTypeConversionTest::test_roundTimeFraction_wraps_at_midnight()
+{
+ css::util::Time aTime;
+ aTime.Hours = 23;
+ aTime.Minutes = 59;
+ aTime.Seconds = 59;
+ aTime.NanoSeconds = 999950000;
+ CPPUNIT_ASSERT(DBTypeConversion::roundTimeFraction(aTime, 4));
+ CPPUNIT_ASSERT_EQUAL(u"00:00:00"_ustr, DBTypeConversion::toTimeString(aTime));
+}
+
+void DBTypeConversionTest::test_roundDateTimeFraction_carries_into_next_day()
+{
+ css::util::DateTime aDT;
+ aDT.Year = 2024;
+ aDT.Month = 7;
+ aDT.Day = 15;
+ aDT.Hours = 23;
+ aDT.Minutes = 59;
+ aDT.Seconds = 59;
+ aDT.NanoSeconds = 999950000;
+ DBTypeConversion::roundDateTimeFraction(aDT, 4);
+ CPPUNIT_ASSERT_EQUAL(u"2024-07-16 00:00:00"_ustr, DBTypeConversion::toDateTimeString(aDT));
+}
+
+void DBTypeConversionTest::test_roundDateTimeFraction_rolls_over_month_end()
+{
+ css::util::DateTime aDT;
+ aDT.Year = 2024;
+ aDT.Month = 12;
+ aDT.Day = 31;
+ aDT.Hours = 23;
+ aDT.Minutes = 59;
+ aDT.Seconds = 59;
+ aDT.NanoSeconds = 999950000;
+ DBTypeConversion::roundDateTimeFraction(aDT, 4);
+ CPPUNIT_ASSERT_EQUAL(u"2025-01-01 00:00:00"_ustr, DBTypeConversion::toDateTimeString(aDT));
+}
+
+void DBTypeConversionTest::test_roundTimeFraction_noop_when_no_cap_requested()
+{
+ css::util::Time aTime;
+ aTime.Hours = 0;
+ aTime.Minutes = 3;
+ aTime.Seconds = 0;
+ aTime.NanoSeconds = 123456789;
+ CPPUNIT_ASSERT(!DBTypeConversion::roundTimeFraction(aTime, 9));
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(123456789), aTime.NanoSeconds);
+}
+
+void DBTypeConversionTest::test_toDateTimeString_no_fraction_when_zero_nanoseconds()
+{
+ css::util::DateTime aDT;
+ aDT.Year = 2024;
+ aDT.Month = 7;
+ aDT.Day = 15;
+ aDT.Hours = 14;
+ aDT.Minutes = 30;
+ aDT.Seconds = 0;
+ aDT.NanoSeconds = 0;
+ CPPUNIT_ASSERT_EQUAL(u"2024-07-15 14:30:00"_ustr, DBTypeConversion::toDateTimeString(aDT));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(DBTypeConversionTest);
} // namespace connectivity::commontools
diff --git a/connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu
index 11b214855bc6..889d8d01cfc3 100644
--- a/connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu
+++ b/connectivity/registry/firebird/org/openoffice/Office/DataAccess/Drivers.xcu
@@ -75,6 +75,13 @@
+
+
+
+ 4
+
+
@@ -129,6 +136,13 @@
UserPassword
+
+
+
+ 4
+
+
diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx
index 30e9a323dc12..98c99b7a52cc 100644
--- a/connectivity/source/commontools/DateConversion.cxx
+++ b/connectivity/source/commontools/DateConversion.cxx
@@ -18,6 +18,7 @@
*/
#include
+#include
#include
#include
#include
@@ -32,6 +33,7 @@
#include
#include
#include
+#include
#include
#include
@@ -48,7 +50,8 @@ using namespace ::com::sun::star::util;
using namespace ::com::sun::star::uno;
OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal,
- const Reference< XTypeConverter >& _rxTypeConverter)
+ const Reference< XTypeConverter >& _rxTypeConverter,
+ const Reference< XConnection >& _rxConnection)
{
OUStringBuffer aRet;
if (_rVal.hasValue())
@@ -125,6 +128,10 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal,
// check if this is really a timestamp or only a date
if ( bOk )
{
+ // This is a SQL literal, so cap the fraction to what
+ // _rxConnection's backend can parse (tdf#153057).
+ DBTypeConversion::roundDateTimeFraction(aDateTime,
+ ::dbtools::DatabaseMetaData(_rxConnection).getMaxDateTimeLiteralFractionDigits());
aRet.append("{ts '"
+ DBTypeConversion::toDateTimeString(aDateTime)
+ "'}");
@@ -178,6 +185,10 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal,
else
bOk = _rVal >>= aTime;
OSL_ENSURE( bOk,"DBTypeConversion::toSQLString: _rVal is not time!");
+ // See the TIMESTAMP case above.
+ // Discarding the day-carry return: this is just a Time.
+ std::ignore = DBTypeConversion::roundTimeFraction(aTime,
+ ::dbtools::DatabaseMetaData(_rxConnection).getMaxDateTimeLiteralFractionDigits());
aRet.append("{t '"
+ DBTypeConversion::toTimeString(aTime)
+ "'}");
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index 304bca1c757e..37c97a998bd9 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -26,6 +26,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -100,8 +101,18 @@ namespace dbtools
ostr.fill('0');
ostr << setw(2) << rTime.Hours << ":"
<< setw(2) << rTime.Minutes << ":"
- << setw(2) << rTime.Seconds << "."
- << setw(9) << rTime.NanoSeconds;
+ << setw(2) << rTime.Seconds;
+ if (rTime.NanoSeconds)
+ {
+ std::ostringstream ostrFraction;
+ ostrFraction.fill('0');
+ ostrFraction << setw(9) << rTime.NanoSeconds;
+ // Trim trailing zeros if exist, since some backends (e.g. Firebird)
+ // reject a literal with more fractional digits than they support.
+ std::string sFraction = ostrFraction.str();
+ sFraction.erase(sFraction.find_last_not_of('0') + 1);
+ ostr << "." << sFraction;
+ }
return OUString::createFromAscii(ostr.str());
}
@@ -113,6 +124,43 @@ namespace dbtools
return toDateString(aDate) + " " + toTimeString(aTime);
}
+ bool DBTypeConversion::roundTimeFraction(css::util::Time& rTime, sal_Int32 nMaxFractionDigits)
+ {
+ // Round the fraction to at most nMaxFractionDigits digits,
+ // carrying into seconds/minutes/hours as needed.
+ if (nMaxFractionDigits >= 9 || nMaxFractionDigits < 0)
+ return false;
+
+ sal_uInt32 nRoundingUnit = 1;
+ for (sal_Int32 i = 0; i < 9 - nMaxFractionDigits; ++i)
+ nRoundingUnit *= 10;
+
+ sal_uInt32 nNanoSeconds
+ = ((rTime.NanoSeconds + nRoundingUnit / 2) / nRoundingUnit) * nRoundingUnit;
+ bool bCarriedPastMidnight = false;
+ if (nNanoSeconds >= o3tl::make_unsigned(nanoSecInSec))
+ {
+ nNanoSeconds -= static_cast(nanoSecInSec);
+ if (++rTime.Seconds >= secInMin)
+ {
+ rTime.Seconds -= secInMin;
+ if (++rTime.Minutes >= minInHour)
+ {
+ rTime.Minutes -= minInHour;
+ // Time has no day of its own to carry into so wrap
+ // at 24h and report it to the caller.
+ if (++rTime.Hours >= 24)
+ {
+ rTime.Hours -= 24;
+ bCarriedPastMidnight = true;
+ }
+ }
+ }
+ }
+ rTime.NanoSeconds = nNanoSeconds;
+ return bCarriedPastMidnight;
+ }
+
css::util::Date DBTypeConversion::toDate(const sal_Int32 _nVal)
{
css::util::Date aReturn;
@@ -221,6 +269,27 @@ namespace dbtools
comphelper::date::convertDaysToDate( nTempDays, _rDate.Day, _rDate.Month, _rDate.Year );
}
+ void DBTypeConversion::roundDateTimeFraction(css::util::DateTime& rDateTime, sal_Int32 nMaxFractionDigits)
+ {
+ css::util::Time aTime(rDateTime.NanoSeconds, rDateTime.Seconds, rDateTime.Minutes,
+ rDateTime.Hours, rDateTime.IsUTC);
+ if (roundTimeFraction(aTime, nMaxFractionDigits))
+ {
+ // Unlike a bare Time, a DateTime does have a date to carry into,
+ // so 23:59:59.99995 becomes the next day at 00:00:00 rather than
+ // an out-of-range 24:00:00 on the original date.
+ css::util::Date aDate(rDateTime.Day, rDateTime.Month, rDateTime.Year);
+ addDays(1, aDate);
+ rDateTime.Day = aDate.Day;
+ rDateTime.Month = aDate.Month;
+ rDateTime.Year = aDate.Year;
+ }
+ rDateTime.Hours = aTime.Hours;
+ rDateTime.Minutes = aTime.Minutes;
+ rDateTime.Seconds = aTime.Seconds;
+ rDateTime.NanoSeconds = aTime.NanoSeconds;
+ }
+
static void subDays(const sal_Int32 nDays, css::util::Date& _rDate )
{
sal_Int64 nTempDays = implRelativeToAbsoluteNull(_rDate);
diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx
index 271c120c383b..e50c813ff15d 100644
--- a/connectivity/source/commontools/dbmetadata.cxx
+++ b/connectivity/source/commontools/dbmetadata.cxx
@@ -300,6 +300,24 @@ namespace dbtools
return doGenerate;
}
+ sal_Int32 DatabaseMetaData::getMaxDateTimeLiteralFractionDigits() const
+ {
+ if ( !isConnected() )
+ return 4; // fallback for a caller with no connection info
+
+ sal_Int32 nDigits( 9 );
+ Any setting;
+ if ( lcl_getDriverSetting( u"MaxDateTimeLiteralFractionDigits"_ustr, *m_pImpl, setting ) )
+ {
+ if( ! (setting >>= nDigits) )
+ {
+ SAL_WARN("connectivity.commontools", "getMaxDateTimeLiteralFractionDigits: unable to assign MaxDateTimeLiteralFractionDigits");
+ nDigits = 4;
+ }
+ }
+ return nDigits;
+ }
+
bool DatabaseMetaData::shouldSubstituteParameterNames() const
{
bool doSubstitute( true );
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx
index b03bda56184a..574521506a1d 100644
--- a/connectivity/source/commontools/predicateinput.cxx
+++ b/connectivity/source/commontools/predicateinput.cxx
@@ -128,7 +128,7 @@ namespace dbtools
std::unique_ptr OPredicateInputController::implPredicateTree(OUString& _rErrorMessage, const OUString& _rStatement, const Reference< XPropertySet > & _rxField) const
{
- std::unique_ptr pReturn = const_cast< OSQLParser& >( m_aParser ).predicateTree( _rErrorMessage, _rStatement, m_xFormatter, _rxField );
+ std::unique_ptr pReturn = const_cast< OSQLParser& >( m_aParser ).predicateTree( _rErrorMessage, _rStatement, m_xFormatter, _rxField, /*bUseRealName*/true, m_xConnection );
if ( !pReturn )
{ // is it a text field ?
sal_Int32 nType = DataType::OTHER;
@@ -149,7 +149,7 @@ namespace dbtools
{
sQuoted = u"'" + sQuoted.replaceAll(u"'", u"''") + u"'";
}
- pReturn = const_cast< OSQLParser& >( m_aParser ).predicateTree( _rErrorMessage, sQuoted, m_xFormatter, _rxField );
+ pReturn = const_cast< OSQLParser& >( m_aParser ).predicateTree( _rErrorMessage, sQuoted, m_xFormatter, _rxField, /*bUseRealName*/true, m_xConnection );
}
// one more fallback: for numeric fields, and value strings containing a decimal/thousands separator
@@ -215,7 +215,7 @@ namespace dbtools
sTranslated = sTranslated.replace( nCtxThdSep, nFmtThdSep );
sTranslated = sTranslated.replace( nIntermediate, nFmtDecSep );
- pReturn = const_cast< OSQLParser& >( m_aParser ).predicateTree( _rErrorMessage, sTranslated, m_xFormatter, _rxField );
+ pReturn = const_cast< OSQLParser& >( m_aParser ).predicateTree( _rErrorMessage, sTranslated, m_xFormatter, _rxField, /*bUseRealName*/true, m_xConnection );
}
}
}
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 44897cc330cd..c4ab0c0b0760 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -966,9 +966,9 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 nParameterIndex,
setParameterNull(nParameterIndex, false);
const sal_Int32 nMaxSize = 0xFFFF;
const sal_uInt16 nSize = std::min(xBytes.getLength(), nMaxSize);
- // 8000 corresponds to value from lcl_addDefaultParameters
- // in dbaccess/source/filter/hsqldb/createparser.cxx
- if (nSize > 8000)
+ // sqldata was allocated from sqllen in mallocSQLVAR, so grow it whenever the value is
+ // longer than the column it is bound to.
+ if (nSize > pVar->sqllen)
{
free(pVar->sqldata);
pVar->sqldata = static_cast(malloc(sizeof(char) * nSize + 2));
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 7575010cecf1..51a4a31103b0 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -57,6 +57,7 @@
#include
#include
#include
+#include
#include
#include
@@ -214,6 +215,14 @@ OUString OSQLParseNode::convertDateString(const SQLParseNodeParameter& rParam, s
OUString OSQLParseNode::convertDateTimeString(const SQLParseNodeParameter& rParam, const OUString& rString)
{
DateTime aDate = DBTypeConversion::toDateTime(rString);
+
+ // round here in case of re-normalization on a rounded value
+ if (aDate.NanoSeconds)
+ {
+ DBTypeConversion::roundDateTimeFraction(aDate, rParam.aMetaData.getMaxDateTimeLiteralFractionDigits());
+ return DBTypeConversion::toDateTimeString(aDate);
+ }
+
Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier());
Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY);
@@ -226,6 +235,15 @@ OUString OSQLParseNode::convertDateTimeString(const SQLParseNodeParameter& rPara
OUString OSQLParseNode::convertTimeString(const SQLParseNodeParameter& rParam, std::u16string_view rString)
{
css::util::Time aTime = DBTypeConversion::toTime(rString);
+
+ // Same fallback as convertDateTimeString() above
+ if (aTime.NanoSeconds)
+ {
+ // Discarding the day-carry return: only time is relevant here
+ std::ignore = DBTypeConversion::roundTimeFraction(aTime, rParam.aMetaData.getMaxDateTimeLiteralFractionDigits());
+ return DBTypeConversion::toTimeString(aTime);
+ }
+
Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier());
Reference< XNumberFormatTypes > xTypes(xSupplier->getNumberFormats(), UNO_QUERY);
@@ -1081,6 +1099,7 @@ OSQLParseNode* OSQLParser::buildNode_Date(const double& fValue, sal_Int32 nType)
case DataType::TIME:
{
css::util::Time aTime = DBTypeConversion::toTime(fValue);
+ std::ignore = DBTypeConversion::roundTimeFraction(aTime, m_aMetaData.getMaxDateTimeLiteralFractionDigits());
OUString aString = DBTypeConversion::toTimeString(aTime);
pDateNode->append(new OSQLInternalNode("", SQLNodeType::Keyword, SQL_TOKEN_T));
pDateNode->append(new OSQLInternalNode(aString, SQLNodeType::String));
@@ -1089,6 +1108,7 @@ OSQLParseNode* OSQLParser::buildNode_Date(const double& fValue, sal_Int32 nType)
case DataType::TIMESTAMP:
{
DateTime aDateTime = DBTypeConversion::toDateTime(fValue,DBTypeConversion::getNULLDate(m_xFormatter->getNumberFormatsSupplier()));
+ DBTypeConversion::roundDateTimeFraction(aDateTime, m_aMetaData.getMaxDateTimeLiteralFractionDigits());
if (aDateTime.Seconds || aDateTime.Minutes || aDateTime.Hours)
{
OUString aString = DBTypeConversion::toDateTimeString(aDateTime);
@@ -1176,7 +1196,8 @@ std::mutex& OSQLParser::getMutex()
std::unique_ptr OSQLParser::predicateTree(OUString& rErrorMessage, const OUString& rStatement,
const Reference< css::util::XNumberFormatter > & xFormatter,
const Reference< XPropertySet > & xField,
- bool bUseRealName)
+ bool bUseRealName,
+ const Reference< css::sdbc::XConnection >& xConnection)
{
// Guard the parsing
std::unique_lock aGuard(getMutex());
@@ -1187,6 +1208,7 @@ std::unique_ptr OSQLParser::predicateTree(OUString& rErrorMessage
// reset the parser
m_xField = xField;
m_xFormatter = xFormatter;
+ m_aMetaData = ::dbtools::DatabaseMetaData(xConnection);
if (m_xField.is())
{
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 8c974f98cef2..20cb242cc2d1 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -728,8 +728,8 @@ private:
DECL_LINK(OnMoreColorsClick, weld::Button&, void);
DECL_LINK(SelectPaletteLBHdl, weld::ComboBox&, void);
- DECL_LINK(ActivatePaletteColorHdl, const Color&, void);
- DECL_LINK(ActivateRecentColorHdl, const Color&, void);
+ DECL_LINK(ActivatePaletteColorHdl, int, void);
+ DECL_LINK(ActivateRecentColorHdl, int, void);
DECL_LINK( SelectColorModeHdl_Impl, weld::Toggleable&, void );
void UpdateToSelectedColor(const NamedColor& rNamedColor);
void ChangeColor(const NamedColor &rNewColor, bool bUpdatePreset = true);
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 65fc9364d9f1..a2af733f6d23 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -210,23 +210,23 @@ class SvxNumOptionsTabPage : public SfxTabPage
OUString m_sNumCharFmtName;
OUString m_sBulletCharFormatName;
- Timer aInvalidateTimer;
+ Timer m_aInvalidateTimer;
- std::unique_ptr pActNum;
- std::unique_ptr pSaveNum;
+ std::unique_ptr m_pActNum;
+ std::unique_ptr m_pSaveNum;
- Size aInitSize[SVX_MAX_NUM];
+ Size m_aInitSize[SVX_MAX_NUM];
ImplSVEvent* m_pLevelHdlEvent;
- bool bLastWidthModified : 1;
- bool bModified : 1;
- bool bPreset : 1;
- bool bAutomaticCharStyles: 1;
- bool bHTMLMode : 1;
+ bool m_bLastWidthModified : 1;
+ bool m_bModified : 1;
+ bool m_bPreset : 1;
+ bool m_bAutomaticCharStyles : 1;
+ bool m_bHTMLMode : 1;
- std::vector aGrfNames;
- vcl::Font aActBulletFont;
+ std::vector m_aGrfNames;
+ vcl::Font m_aActBulletFont;
enum class NumberType {
SHOW_NUMBERING = 0,
@@ -234,11 +234,11 @@ class SvxNumOptionsTabPage : public SfxTabPage
SHOW_BITMAP = 2,
NONE = 0xff
};
- NumberType nBullet;
+ NumberType m_nBullet;
- sal_uInt16 nActNumLvl;
- TypedWhichId nNumItemId;
- MapUnit eCoreUnit;
+ sal_uInt16 m_nActNumLvl;
+ TypedWhichId m_nNumItemId;
+ MapUnit m_eCoreUnit;
SvxRatioConnector m_aRatioTop;
SvxRatioConnector m_aRatioBottom;
@@ -289,7 +289,6 @@ class SvxNumOptionsTabPage : public SfxTabPage
DECL_LINK(NumberTypeSelectHdl_Impl, weld::ComboBox&, void);
DECL_LINK(LevelHdl_Impl, weld::ItemView&, void);
DECL_LINK(LevelHdl, void *, void);
- DECL_LINK(PopupActivateHdl_Impl, weld::Toggleable&, void);
DECL_LINK(GraphicHdl_Impl, const OUString&, void);
DECL_LINK(BulletHdl_Impl, weld::Button&, void);
DECL_LINK(SizeHdl_Impl, weld::MetricSpinButton&, void);
@@ -306,6 +305,8 @@ class SvxNumOptionsTabPage : public SfxTabPage
DECL_LINK(PreviewInvalidateHdl_Impl, Timer*, void);
void EditModifyHdl_Impl(const weld::TextWidget*);
+ void CreateGalleryMenu();
+
public:
SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
virtual ~SvxNumOptionsTabPage() override;
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index af1369fd56dd..222c11e41a51 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -177,6 +177,9 @@ class SvxParaAlignTabPage : public SfxTabPage
std::unique_ptr m_xLetterSpacingMinimum;
std::unique_ptr m_xLetterSpacingMaximum;
+ /// compound-based hyphenation
+ std::unique_ptr m_xCompoundBased;
+
/// glyph scaling
std::unique_ptr m_xLabelGlyphScaling;
std::unique_ptr m_xGlyphScalingMinimum;
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index d2065f94efc0..a85e6d2e7f2a 100644
--- a/cui/source/options/optchart.cxx
+++ b/cui/source/options/optchart.cxx
@@ -344,12 +344,13 @@ IMPL_LINK_NOARG( SvxDefaultColorOptPage, SelectPaletteLbHdl, weld::ComboBox&, vo
aPaletteManager.ReloadColorSet(m_aColorIconView);
}
-IMPL_LINK(SvxDefaultColorOptPage, ColorActivatedHdl, const Color&, rColor, void)
+IMPL_LINK(SvxDefaultColorOptPage, ColorActivatedHdl, int, nIndex, void)
{
sal_Int32 nIdx = m_xLbChartColors->get_selected_index();
if (nIdx != -1)
{
- const XColorEntry aEntry(rColor, m_xLbChartColors->get_selected_text());
+ const XColorEntry aEntry(m_aColorIconView.getColor(nIndex),
+ m_xLbChartColors->get_selected_text());
ModifyColorEntry(aEntry, nIdx);
m_SvxChartColorTableUniquePtr->replace(nIdx, aEntry);
diff --git a/cui/source/options/optchart.hxx b/cui/source/options/optchart.hxx
index d38ea4c161fb..3bb345e05483 100644
--- a/cui/source/options/optchart.hxx
+++ b/cui/source/options/optchart.hxx
@@ -53,7 +53,7 @@ private:
DECL_LINK(ResetToDefaults, weld::Button&, void);
DECL_LINK(AddChartColor, weld::Button&, void);
DECL_LINK(RemoveChartColor, weld::Button&, void);
- DECL_LINK(ColorActivatedHdl, const Color&, void);
+ DECL_LINK(ColorActivatedHdl, int, void);
DECL_LINK(SelectPaletteLbHdl, weld::ComboBox&, void);
DECL_LINK(LbChartColorsSelectionChangedHdl, weld::ItemView&, void);
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 7ddd3158be15..99e2fc54110a 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1126,16 +1126,16 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, voi
SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, u"cui/ui/numberingoptionspage.ui"_ustr, u"NumberingOptionsPage"_ustr, &rSet)
- , aInvalidateTimer("cui SvxNumOptionsTabPage aInvalidateTimer")
+ , m_aInvalidateTimer("cui SvxNumOptionsTabPage aInvalidateTimer")
, m_pLevelHdlEvent(nullptr)
- , bLastWidthModified(false)
- , bModified(false)
- , bPreset(false)
- , bAutomaticCharStyles(true)
- , bHTMLMode(false)
- , nBullet(NumberType::NONE)
- , nActNumLvl(1)
- , nNumItemId(SID_ATTR_NUMBERING_RULE)
+ , m_bLastWidthModified(false)
+ , m_bModified(false)
+ , m_bPreset(false)
+ , m_bAutomaticCharStyles(true)
+ , m_bHTMLMode(false)
+ , m_nBullet(NumberType::NONE)
+ , m_nActNumLvl(1)
+ , m_nNumItemId(SID_ATTR_NUMBERING_RULE)
, m_aRatioTop(ConnectorType::Top)
, m_aRatioBottom(ConnectorType::Bottom)
, m_xGrid(m_xBuilder->weld_widget(u"grid2"_ustr))
@@ -1180,7 +1180,7 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
m_xBulRelSizeMF->set_min(SVX_NUM_REL_SIZE_MIN, FieldUnit::PERCENT);
m_xBulRelSizeMF->set_increments(5, 50, FieldUnit::PERCENT);
SetExchangeSupport();
- aActBulletFont = lcl_GetDefaultBulletFont();
+ m_aActBulletFont = lcl_GetDefaultBulletFont();
// vertical alignment = fill makes the drawingarea expand the associated spinedits so we have to size it here
const sal_Int16 aHeight
= static_cast(std::max(int(m_xRatioCB->get_preferred_size().getHeight() / 2
@@ -1197,7 +1197,6 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
m_xBulletPB->connect_clicked(LINK(this, SvxNumOptionsTabPage, BulletHdl_Impl));
m_xFmtLB->connect_changed(LINK(this, SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl));
m_xBitmapMB->connect_selected(LINK(this, SvxNumOptionsTabPage, GraphicHdl_Impl));
- m_xBitmapMB->connect_toggled(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl));
m_xLevelLB->set_selection_mode(SelectionMode::Multiple);
m_xLevelLB->connect_selection_changed(LINK(this, SvxNumOptionsTabPage, LevelHdl_Impl));
m_xCharFmtLB->connect_changed(LINK(this, SvxNumOptionsTabPage, CharFmtHdl_Impl));
@@ -1213,10 +1212,12 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
m_xSameLevelCB->connect_toggled(LINK(this, SvxNumOptionsTabPage, SameLevelHdl_Impl));
m_xBulRelSizeMF->connect_value_changed(LINK(this,SvxNumOptionsTabPage, BulRelSizeHdl_Impl));
m_xBulColLB->SetSelectHdl(LINK(this, SvxNumOptionsTabPage, BulColorHdl_Impl));
- aInvalidateTimer.SetInvokeHandler(LINK(this, SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl));
- aInvalidateTimer.SetTimeout(50);
+ m_aInvalidateTimer.SetInvokeHandler(
+ LINK(this, SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl));
+ m_aInvalidateTimer.SetTimeout(50);
- eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE));
+ m_eCoreUnit
+ = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE));
// Fill ListBox with predefined / translated numbering types.
sal_uInt32 nCount = SvxNumberingTypeTable::Count();
@@ -1244,8 +1245,8 @@ SvxNumOptionsTabPage::~SvxNumOptionsTabPage()
{
m_xPreviewWIN.reset();
m_xBulColLB.reset();
- pActNum.reset();
- pSaveNum.reset();
+ m_pActNum.reset();
+ m_pSaveNum.reset();
if (m_pLevelHdlEvent)
{
Application::RemoveUserEvent(m_pLevelHdlEvent);
@@ -1277,34 +1278,34 @@ void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet)
if(pExampleSet)
{
if(const SfxBoolItem* pPresetItem = pExampleSet->GetItemIfSet(SID_PARAM_NUM_PRESET, false))
- bPreset = pPresetItem->GetValue();
+ m_bPreset = pPresetItem->GetValue();
if(const SfxUInt16Item* pLevelItem = pExampleSet->GetItemIfSet(SID_PARAM_CUR_NUM_LEVEL, false))
nTmpNumLvl = pLevelItem->GetValue();
}
- if(const SvxNumBulletItem* pBulletItem = rSet.GetItemIfSet(nNumItemId, false))
+ if (const SvxNumBulletItem* pBulletItem = rSet.GetItemIfSet(m_nNumItemId, false))
{
- pSaveNum.reset( new SvxNumRule(pBulletItem->GetNumRule()) );
+ m_pSaveNum.reset(new SvxNumRule(pBulletItem->GetNumRule()));
}
- bModified = (!pActNum->Get( 0 ) || bPreset);
- if(*pActNum == *pSaveNum && nActNumLvl == nTmpNumLvl)
+ m_bModified = (!m_pActNum->Get(0) || m_bPreset);
+ if (*m_pActNum == *m_pSaveNum && m_nActNumLvl == nTmpNumLvl)
return;
- nActNumLvl = nTmpNumLvl;
+ m_nActNumLvl = nTmpNumLvl;
sal_uInt16 nMask = 1;
m_xLevelLB->unselect_all();
- if (nActNumLvl == SAL_MAX_UINT16)
- m_xLevelLB->select(pActNum->GetLevelCount());
- if(nActNumLvl != SAL_MAX_UINT16)
+ if (m_nActNumLvl == SAL_MAX_UINT16)
+ m_xLevelLB->select(m_pActNum->GetLevelCount());
+ if (m_nActNumLvl != SAL_MAX_UINT16)
{
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
m_xLevelLB->select(i);
nMask <<= 1 ;
}
}
- *pActNum = *pSaveNum;
+ *m_pActNum = *m_pSaveNum;
InitControls();
}
@@ -1318,14 +1319,14 @@ DeactivateRC SvxNumOptionsTabPage::DeactivatePage(SfxItemSet * _pSet)
bool SvxNumOptionsTabPage::FillItemSet( SfxItemSet* rSet )
{
- rSet->Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
- if(bModified && pActNum)
+ rSet->Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, m_nActNumLvl));
+ if (m_bModified && m_pActNum)
{
- *pSaveNum = *pActNum;
- rSet->Put(SvxNumBulletItem( *pSaveNum, nNumItemId ));
+ *m_pSaveNum = *m_pActNum;
+ rSet->Put(SvxNumBulletItem(*m_pSaveNum, m_nNumItemId));
rSet->Put(SfxBoolItem(SID_PARAM_NUM_PRESET, false));
}
- return bModified;
+ return m_bModified;
};
void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
@@ -1335,25 +1336,25 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
rSet->GetItemIfSet(SID_ATTR_NUMBERING_RULE, false);
if(!pBulletItem)
{
- nNumItemId = rSet->GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE);
- pBulletItem = rSet->GetItemIfSet(nNumItemId, false);
+ m_nNumItemId = rSet->GetPool()->GetWhichIDFromSlotID(SID_ATTR_NUMBERING_RULE);
+ pBulletItem = rSet->GetItemIfSet(m_nNumItemId, false);
if( !pBulletItem )
{
- pBulletItem = & rSet->Get( nNumItemId );
+ pBulletItem = &rSet->Get(m_nNumItemId);
}
}
DBG_ASSERT(pBulletItem, "no item found!");
- pSaveNum.reset( new SvxNumRule(pBulletItem->GetNumRule()) );
+ m_pSaveNum.reset(new SvxNumRule(pBulletItem->GetNumRule()));
// insert levels
if (!m_xLevelLB->n_children())
{
- for(sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 1; i <= m_pSaveNum->GetLevelCount(); i++)
m_xLevelLB->append_text(OUString::number(i));
- if(pSaveNum->GetLevelCount() > 1)
+ if (m_pSaveNum->GetLevelCount() > 1)
{
- OUString sEntry = "1 - " + OUString::number( pSaveNum->GetLevelCount() );
+ OUString sEntry = "1 - " + OUString::number(m_pSaveNum->GetLevelCount());
m_xLevelLB->append_text(sEntry);
m_xLevelLB->select_text(sEntry);
}
@@ -1365,26 +1366,26 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
sal_uInt16 nMask = 1;
m_xLevelLB->unselect_all();
- if (nActNumLvl == SAL_MAX_UINT16)
+ if (m_nActNumLvl == SAL_MAX_UINT16)
{
- m_xLevelLB->select( pSaveNum->GetLevelCount() );
+ m_xLevelLB->select(m_pSaveNum->GetLevelCount());
}
else
{
- for(sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pSaveNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
m_xLevelLB->select( i );
nMask <<= 1 ;
}
}
- if(!pActNum)
- pActNum.reset( new SvxNumRule(*pSaveNum) );
- else if(*pSaveNum != *pActNum)
- *pActNum = *pSaveNum;
- m_aPreviewWIN.SetNumRule(pActNum.get());
- m_xSameLevelCB->set_active(pActNum->IsContinuousNumbering());
+ if (!m_pActNum)
+ m_pActNum.reset(new SvxNumRule(*m_pSaveNum));
+ else if (*m_pSaveNum != *m_pActNum)
+ *m_pActNum = *m_pSaveNum;
+ m_aPreviewWIN.SetNumRule(m_pActNum.get());
+ m_xSameLevelCB->set_active(m_pActNum->IsContinuousNumbering());
const SfxUInt16Item* pHtmlModeItem =
rSet->GetItemIfSet( SID_HTML_MODE, false );
@@ -1396,16 +1397,16 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
if ( pHtmlModeItem )
{
sal_uInt16 nHtmlMode = pHtmlModeItem->GetValue();
- bHTMLMode = 0 != (nHtmlMode&HTMLMODE_ON);
+ m_bHTMLMode = 0 != (nHtmlMode & HTMLMODE_ON);
}
- bool bCharFmt = pActNum->IsFeatureSupported(SvxNumRuleFlags::CHAR_STYLE);
+ bool bCharFmt = m_pActNum->IsFeatureSupported(SvxNumRuleFlags::CHAR_STYLE);
m_xCharFmtFT->set_visible(bCharFmt);
m_xCharFmtLB->set_visible(bCharFmt);
- bool bContinuous = pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS);
+ bool bContinuous = m_pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS);
- bool bAllLevel = bContinuous && !bHTMLMode;
+ bool bAllLevel = bContinuous && !m_bHTMLMode;
m_xAllLevelFT->set_visible(bAllLevel);
m_xAllLevelNF->set_visible(bAllLevel);
m_xIsLegalCB->set_visible(bAllLevel);
@@ -1427,13 +1428,13 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
}
}
//one must be enabled
- if(!pActNum->IsFeatureSupported(SvxNumRuleFlags::ENABLE_LINKED_BMP))
+ if (!m_pActNum->IsFeatureSupported(SvxNumRuleFlags::ENABLE_LINKED_BMP))
{
auto nPos = m_xFmtLB->find_id(OUString::number(SVX_NUM_BITMAP|LINK_TOKEN));
if (nPos != -1)
m_xFmtLB->remove(nPos);
}
- else if(!pActNum->IsFeatureSupported(SvxNumRuleFlags::ENABLE_EMBEDDED_BMP))
+ else if (!m_pActNum->IsFeatureSupported(SvxNumRuleFlags::ENABLE_EMBEDDED_BMP))
{
auto nPos = m_xFmtLB->find_id(OUString::number(SVX_NUM_BITMAP));
if (nPos != -1)
@@ -1442,7 +1443,7 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
// MegaHack: because of a not-fixable 'design mistake/error' in Impress
// delete all kinds of numeric enumerations
- if(pActNum->IsFeatureSupported(SvxNumRuleFlags::NO_NUMBERS))
+ if (m_pActNum->IsFeatureSupported(SvxNumRuleFlags::NO_NUMBERS))
{
sal_Int32 nFmtCount = m_xFmtLB->get_count();
for(sal_Int32 i = nFmtCount; i; i--)
@@ -1454,7 +1455,7 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
}
InitControls();
- bModified = false;
+ m_bModified = false;
const SvxLanguageItem* pLangItem = rSet->GetItemIfSet(SID_ATTR_CHAR_LANGUAGE, true);
if (!pLangItem)
pLangItem = rSet->GetItemIfSet(EE_CHAR_LANGUAGE, true);
@@ -1487,13 +1488,13 @@ void SvxNumOptionsTabPage::InitControls()
sal_uInt16 nLvl = SAL_MAX_UINT16;
sal_uInt16 nHighestLevel = 0;
- bool bBullColor = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_COLOR);
- bool bBullRelSize = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_REL_SIZE);
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ bool bBullColor = m_pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_COLOR);
+ bool bBullRelSize = m_pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_REL_SIZE);
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
- aNumFmtArr[i] = &pActNum->GetLevel(i);
+ aNumFmtArr[i] = &m_pActNum->GetLevel(i);
bShowBullet &= aNumFmtArr[i]->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
bShowBitmap &= (aNumFmtArr[i]->GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP;
if(SAL_MAX_UINT16 == nLvl)
@@ -1558,8 +1559,8 @@ void SvxNumOptionsTabPage::InitControls()
if(bSameSize)
{
- SetMetricValue(*m_xHeightMF, aFirstSize.Height(), eCoreUnit);
- SetMetricValue(*m_xWidthMF, aFirstSize.Width(), eCoreUnit);
+ SetMetricValue(*m_xHeightMF, aFirstSize.Height(), m_eCoreUnit);
+ SetMetricValue(*m_xWidthMF, aFirstSize.Width(), m_eCoreUnit);
}
else
{
@@ -1605,7 +1606,7 @@ void SvxNumOptionsTabPage::InitControls()
m_xBulColLB->SetNoSelection();
}
m_xStartED->set_value(1); // If this isn't set then changing the bullet type to a numbered type doesn't reset the start level
- switch(nBullet)
+ switch (m_nBullet)
{
case NumberType::SHOW_NUMBERING:
if(bSameStart)
@@ -1642,16 +1643,16 @@ void SvxNumOptionsTabPage::InitControls()
else
m_xCharFmtLB->set_active(-1);
- m_aPreviewWIN.SetLevel(nActNumLvl);
+ m_aPreviewWIN.SetLevel(m_nActNumLvl);
m_aPreviewWIN.Invalidate();
}
// 0 - Number; 1 - Bullet; 2 - Bitmap
void SvxNumOptionsTabPage::SwitchNumberType( NumberType nType )
{
- if(nBullet == nType)
+ if (m_nBullet == nType)
return;
- nBullet = nType;
+ m_nBullet = nType;
bool bBullet = (nType == NumberType::SHOW_BULLET);
bool bBitmap = (nType == NumberType::SHOW_BITMAP);
bool bEnableBitmap = (nType == NumberType::SHOW_BITMAP);
@@ -1662,14 +1663,14 @@ void SvxNumOptionsTabPage::SwitchNumberType( NumberType nType )
m_xSuffixFT->set_visible(bNumeric);
m_xSuffixED->set_visible(bNumeric);
- bool bCharFmt = pActNum->IsFeatureSupported(SvxNumRuleFlags::CHAR_STYLE);
+ bool bCharFmt = m_pActNum->IsFeatureSupported(SvxNumRuleFlags::CHAR_STYLE);
m_xCharFmtFT->set_visible(!bBitmap && bCharFmt);
m_xCharFmtLB->set_visible(!bBitmap && bCharFmt);
// this is rather misusage, as there is no own flag
// for complete numeration
- bool bAllLevelFeature = pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS);
- bool bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode;
+ bool bAllLevelFeature = m_pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS);
+ bool bAllLevel = bNumeric && bAllLevelFeature && !m_bHTMLMode;
m_xAllLevelFT->set_visible(bAllLevel);
m_xAllLevelNF->set_visible(bAllLevel);
m_xIsLegalCB->set_visible(bAllLevel);
@@ -1679,15 +1680,17 @@ void SvxNumOptionsTabPage::SwitchNumberType( NumberType nType )
m_xBulletFT->set_visible(bBullet);
m_xBulletPB->set_visible(bBullet);
- bool bBullColor = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_COLOR);
+ bool bBullColor = m_pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_COLOR);
m_xBulColorFT->set_visible(!bBitmap && bBullColor);
m_xBulColLB->set_visible(!bBitmap && bBullColor);
- bool bBullResSize = pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_REL_SIZE);
+ bool bBullResSize = m_pActNum->IsFeatureSupported(SvxNumRuleFlags::BULLET_REL_SIZE);
m_xBulRelSizeFT->set_visible(!bBitmap && bBullResSize);
m_xBulRelSizeMF->set_visible(!bBitmap && bBullResSize);
m_xBitmapFT->set_visible(bBitmap);
m_xBitmapMB->set_visible(bBitmap);
+ if (bBitmap)
+ CreateGalleryMenu();
m_xWidthFT->set_visible(bBitmap);
m_xWidthMF->set_visible(bBitmap);
@@ -1724,34 +1727,35 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, LevelHdl, void*, void)
{
m_pLevelHdlEvent = nullptr;
- sal_uInt16 nSaveNumLvl = nActNumLvl;
- nActNumLvl = 0;
+ sal_uInt16 nSaveNumLvl = m_nActNumLvl;
+ m_nActNumLvl = 0;
std::vector aSelectedRows = m_xLevelLB->get_selected_rows();
- if (std::find(aSelectedRows.begin(), aSelectedRows.end(), pActNum->GetLevelCount()) != aSelectedRows.end() &&
- (aSelectedRows.size() == 1 || nSaveNumLvl != 0xffff))
+ if (std::find(aSelectedRows.begin(), aSelectedRows.end(), m_pActNum->GetLevelCount())
+ != aSelectedRows.end()
+ && (aSelectedRows.size() == 1 || nSaveNumLvl != 0xffff))
{
- nActNumLvl = 0xFFFF;
- for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
- m_xLevelLB->unselect(i);
+ m_nActNumLvl = 0xFFFF;
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
+ m_xLevelLB->unselect(i);
}
else if (!aSelectedRows.empty())
{
sal_uInt16 nMask = 1;
- for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
if (std::find(aSelectedRows.begin(), aSelectedRows.end(), i) != aSelectedRows.end())
- nActNumLvl |= nMask;
+ m_nActNumLvl |= nMask;
nMask <<= 1;
}
- m_xLevelLB->unselect(pActNum->GetLevelCount());
+ m_xLevelLB->unselect(m_pActNum->GetLevelCount());
}
else
{
- nActNumLvl = nSaveNumLvl;
+ m_nActNumLvl = nSaveNumLvl;
sal_uInt16 nMask = 1;
- for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
m_xLevelLB->select(i);
break;
@@ -1770,15 +1774,15 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl, Timer *, void)
IMPL_LINK(SvxNumOptionsTabPage, AllLevelHdl_Impl, weld::SpinButton&, rBox, void)
{
sal_uInt16 nMask = 1;
- for(sal_uInt16 e = 0; e < pActNum->GetLevelCount(); e++)
+ for (sal_uInt16 e = 0; e < m_pActNum->GetLevelCount(); e++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(e));
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(e));
aNumFmt.SetIncludeUpperLevels(static_cast(std::min(rBox.get_value(), sal_Int64(e + 1))) );
// Set the same prefix/suffix to generate list format with changed IncludedUpperLevels
aNumFmt.SetListFormat(aNumFmt.GetPrefix(), aNumFmt.GetSuffix(), e);
- pActNum->SetLevel(e, aNumFmt);
+ m_pActNum->SetLevel(e, aNumFmt);
}
nMask <<= 1;
}
@@ -1788,13 +1792,13 @@ IMPL_LINK(SvxNumOptionsTabPage, AllLevelHdl_Impl, weld::SpinButton&, rBox, void)
IMPL_LINK(SvxNumOptionsTabPage, IsLegalHdl_Impl, weld::Toggleable&, rBox, void)
{
bool bSet = rBox.get_active();
- for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if (nActNumLvl & (sal_uInt16(1) << i))
+ if (m_nActNumLvl & (sal_uInt16(1) << i))
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(i));
aNumFmt.SetIsLegal(bSet);
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
}
}
SetModified();
@@ -1806,11 +1810,11 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox,
bool bShowOrient = false;
bool bBmp = false;
sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(i));
// PAGEDESC does not exist
SvxNumType nNumType = static_cast(rBox.get_active_id().toUInt32());
aNumFmt.SetNumberingType(nNumType);
@@ -1822,7 +1826,7 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox,
aNumFmt.SetListFormat(u""_ustr, u""_ustr, i);
if(!bBmp)
aNumFmt.SetGraphic(u""_ustr);
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
SwitchNumberType(NumberType::SHOW_BITMAP);
bShowOrient = true;
}
@@ -1831,13 +1835,13 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox,
aNumFmt.SetIncludeUpperLevels( 1 );
aNumFmt.SetListFormat(u""_ustr, u""_ustr, i);
if( !aNumFmt.GetBulletFont() )
- aNumFmt.SetBulletFont(&aActBulletFont);
+ aNumFmt.SetBulletFont(&m_aActBulletFont);
if( !aNumFmt.GetBulletChar() )
aNumFmt.SetBulletChar( SVX_DEF_BULLET );
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
SwitchNumberType(NumberType::SHOW_BULLET);
// allocation of the drawing pattern is automatic
- if(bAutomaticCharStyles)
+ if (m_bAutomaticCharStyles)
{
sSelectStyle = m_sBulletCharFormatName;
}
@@ -1847,11 +1851,11 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox,
aNumFmt.SetListFormat(m_xPrefixED->get_text(), m_xSuffixED->get_text(), i);
SwitchNumberType(NumberType::SHOW_NUMBERING);
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
CheckForStartValue_Impl(nNumberingType);
// allocation of the drawing pattern is automatic
- if(bAutomaticCharStyles)
+ if (m_bAutomaticCharStyles)
{
sSelectStyle = m_sNumCharFmtName;
}
@@ -1859,7 +1863,7 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox,
}
nMask <<= 1;
}
- bool bAllLevelFeature = pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS);
+ bool bAllLevelFeature = m_pActNum->IsFeatureSupported(SvxNumRuleFlags::CONTINUOUS);
if(bShowOrient && bAllLevelFeature)
{
m_xOrientFT->show();
@@ -1875,7 +1879,7 @@ IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, rBox,
{
m_xCharFmtLB->set_active_text(sSelectStyle);
CharFmtHdl_Impl(*m_xCharFmtLB);
- bAutomaticCharStyles = true;
+ m_bAutomaticCharStyles = true;
}
}
@@ -1896,18 +1900,18 @@ IMPL_LINK(SvxNumOptionsTabPage, OrientHdl_Impl, weld::ComboBox&, rBox, void)
nPos ++; // no VERT_NONE
sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(i));
if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
{
const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
const Size& rSize = aNumFmt.GetGraphicSize();
sal_Int16 eOrient = static_cast(nPos);
aNumFmt.SetGraphicBrush( pBrushItem, &rSize, &eOrient );
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
}
}
nMask <<= 1;
@@ -1918,11 +1922,11 @@ IMPL_LINK(SvxNumOptionsTabPage, OrientHdl_Impl, weld::ComboBox&, rBox, void)
IMPL_LINK(SvxNumOptionsTabPage, SameLevelHdl_Impl, weld::Toggleable&, rBox, void)
{
bool bSet = rBox.get_active();
- pActNum->SetContinuousNumbering(bSet);
+ m_pActNum->SetContinuousNumbering(bSet);
bool bRepaint = false;
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(i));
if(aNumFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE)
{
bRepaint = true;
@@ -1938,13 +1942,13 @@ IMPL_LINK(SvxNumOptionsTabPage, BulColorHdl_Impl, ColorListBox&, rColorBox, void
Color nSetColor = rColorBox.GetSelectEntryColor();
sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(i));
aNumFmt.SetBulletColor(nSetColor);
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
}
nMask <<= 1;
}
@@ -1956,13 +1960,13 @@ IMPL_LINK(SvxNumOptionsTabPage, BulRelSizeHdl_Impl, weld::MetricSpinButton&, rFi
sal_uInt16 nRelSize = o3tl::sanitizing_cast(rField.get_value(FieldUnit::PERCENT));
sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(i));
aNumFmt.SetBulletRelSize(nRelSize);
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
}
nMask <<= 1;
}
@@ -1980,9 +1984,9 @@ IMPL_LINK(SvxNumOptionsTabPage, GraphicHdl_Impl, const OUString&, rIdent, void)
if (rIdent.startsWith("gallery", &sNumber))
{
auto idx = o3tl::toUInt32(sNumber);
- if (idx < aGrfNames.size())
+ if (idx < m_aGrfNames.size())
{
- aGrfName = aGrfNames[idx];
+ aGrfName = m_aGrfNames[idx];
Graphic aGraphic;
if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, idx, &aGraphic))
{
@@ -2011,14 +2015,14 @@ IMPL_LINK(SvxNumOptionsTabPage, GraphicHdl_Impl, const OUString&, rIdent, void)
if(!bSucc)
return;
- aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(eCoreUnit));
+ aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(m_eCoreUnit));
sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(i));
aNumFmt.SetCharFormatName(m_sNumCharFmtName);
aNumFmt.SetGraphic(aGrfName);
@@ -2027,9 +2031,9 @@ IMPL_LINK(SvxNumOptionsTabPage, GraphicHdl_Impl, const OUString&, rIdent, void)
// initiate asynchronous loading
sal_Int16 eOrient = aNumFmt.GetVertOrient();
aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
- aInitSize[i] = aNumFmt.GetGraphicSize();
+ m_aInitSize[i] = aNumFmt.GetGraphicSize();
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
}
nMask <<= 1;
}
@@ -2038,16 +2042,16 @@ IMPL_LINK(SvxNumOptionsTabPage, GraphicHdl_Impl, const OUString&, rIdent, void)
m_xHeightFT->set_sensitive(true);
m_xWidthMF->set_sensitive(true);
m_xHeightMF->set_sensitive(true);
- SetMetricValue(*m_xWidthMF, aSize.Width(), eCoreUnit);
- SetMetricValue(*m_xHeightMF, aSize.Height(), eCoreUnit);
+ SetMetricValue(*m_xWidthMF, aSize.Width(), m_eCoreUnit);
+ SetMetricValue(*m_xHeightMF, aSize.Height(), m_eCoreUnit);
m_xOrientFT->set_sensitive(true);
m_xOrientLB->set_sensitive(true);
SetModified();
//needed due to asynchronous loading of graphics in the SvxBrushItem
- aInvalidateTimer.Start();
+ m_aInvalidateTimer.Start();
}
-IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, weld::Toggleable&, void)
+void SvxNumOptionsTabPage::CreateGalleryMenu()
{
if (m_xGalleryMenu)
return;
@@ -2055,7 +2059,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, weld::Toggleable&,
m_xGalleryMenu = m_xBuilder->weld_menu(u"gallerysubmenu"_ustr);
weld::WaitObject aWait(GetFrameWeld());
- if (!GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames))
+ if (!GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, m_aGrfNames))
return;
GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
@@ -2064,7 +2068,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, weld::Toggleable&,
OUString sGrfName;
ScopedVclPtrInstance< VirtualDevice > pVD;
size_t i = 0;
- for (const auto & grfName : aGrfNames)
+ for (const auto& grfName : m_aGrfNames)
{
sGrfName = grfName;
OUString sItemId = "gallery" + OUString::number(i);
@@ -2110,11 +2114,11 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, weld::Button&, void)
bool bSameBullet = true;
sal_UCS4 cBullet = 0;
bool bFirst = true;
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
- const SvxNumberFormat& rCurFmt = pActNum->GetLevel(i);
+ const SvxNumberFormat& rCurFmt = m_pActNum->GetLevel(i);
if(bFirst)
{
cBullet = rCurFmt.GetBulletChar();
@@ -2135,24 +2139,24 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, weld::Button&, void)
if (pFmtFont)
aMap.SetCharFont(*pFmtFont);
else
- aMap.SetCharFont(aActBulletFont);
+ aMap.SetCharFont(m_aActBulletFont);
if (bSameBullet)
aMap.SetChar(cBullet);
if (aMap.run() != RET_OK)
return;
// change Font Numrules
- aActBulletFont = aMap.GetCharFont();
+ m_aActBulletFont = aMap.GetCharFont();
sal_uInt16 _nMask = 1;
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & _nMask)
+ if (m_nActNumLvl & _nMask)
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
- aNumFmt.SetBulletFont(&aActBulletFont);
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(i));
+ aNumFmt.SetBulletFont(&m_aActBulletFont);
aNumFmt.SetBulletChar(aMap.GetChar());
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
}
_nMask <<= 1;
}
@@ -2163,55 +2167,59 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, weld::Button&, void)
IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField, void)
{
bool bWidth = &rField == m_xWidthMF.get();
- bLastWidthModified = bWidth;
+ m_bLastWidthModified = bWidth;
bool bRatio = m_xRatioCB->get_active();
tools::Long nWidthVal = static_cast(m_xWidthMF->denormalize(m_xWidthMF->get_value(FieldUnit::MM_100TH)));
tools::Long nHeightVal = static_cast(m_xHeightMF->denormalize(m_xHeightMF->get_value(FieldUnit::MM_100TH)));
- nWidthVal = OutputDevice::LogicToLogic( nWidthVal ,
- MapUnit::Map100thMM, eCoreUnit );
- nHeightVal = OutputDevice::LogicToLogic( nHeightVal,
- MapUnit::Map100thMM, eCoreUnit);
+ nWidthVal = OutputDevice::LogicToLogic(nWidthVal, MapUnit::Map100thMM, m_eCoreUnit);
+ nHeightVal = OutputDevice::LogicToLogic(nHeightVal, MapUnit::Map100thMM, m_eCoreUnit);
double fSizeRatio;
bool bRepaint = false;
sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(i));
if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
{
Size aSize(aNumFmt.GetGraphicSize() );
Size aSaveSize(aSize);
- if (aInitSize[i].Height())
- fSizeRatio = static_cast(aInitSize[i].Width()) / static_cast(aInitSize[i].Height());
+ if (m_aInitSize[i].Height())
+ fSizeRatio = static_cast(m_aInitSize[i].Width())
+ / static_cast(m_aInitSize[i].Height());
else
fSizeRatio = double(1);
if(bWidth)
{
- tools::Long nDelta = nWidthVal - aInitSize[i].Width();
+ tools::Long nDelta = nWidthVal - m_aInitSize[i].Width();
aSize.setWidth( nWidthVal );
if (bRatio)
{
- aSize.setHeight( aInitSize[i].Height() + static_cast(static_cast(nDelta) / fSizeRatio) );
- m_xHeightMF->set_value(m_xHeightMF->normalize(
- OutputDevice::LogicToLogic( aSize.Height(), eCoreUnit, MapUnit::Map100thMM )),
- FieldUnit::MM_100TH);
+ aSize.setHeight(
+ m_aInitSize[i].Height()
+ + static_cast(static_cast(nDelta) / fSizeRatio));
+ m_xHeightMF->set_value(
+ m_xHeightMF->normalize(OutputDevice::LogicToLogic(
+ aSize.Height(), m_eCoreUnit, MapUnit::Map100thMM)),
+ FieldUnit::MM_100TH);
}
}
else
{
- tools::Long nDelta = nHeightVal - aInitSize[i].Height();
+ tools::Long nDelta = nHeightVal - m_aInitSize[i].Height();
aSize.setHeight( nHeightVal );
if (bRatio)
{
- aSize.setWidth( aInitSize[i].Width() + static_cast(static_cast(nDelta) * fSizeRatio) );
- m_xWidthMF->set_value(m_xWidthMF->normalize(
- OutputDevice::LogicToLogic( aSize.Width(), eCoreUnit, MapUnit::Map100thMM )),
- FieldUnit::MM_100TH);
+ aSize.setWidth(
+ m_aInitSize[i].Width()
+ + static_cast(static_cast(nDelta) * fSizeRatio));
+ m_xWidthMF->set_value(m_xWidthMF->normalize(OutputDevice::LogicToLogic(
+ aSize.Width(), m_eCoreUnit, MapUnit::Map100thMM)),
+ FieldUnit::MM_100TH);
}
}
const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
@@ -2219,7 +2227,7 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField,
if(aSize != aSaveSize)
bRepaint = true;
aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
}
}
nMask <<= 1;
@@ -2232,7 +2240,7 @@ IMPL_LINK(SvxNumOptionsTabPage, RatioHdl_Impl, weld::Toggleable&, rBox, void)
m_xCbxScaleImg->set_from_icon_name(m_xRatioCB->get_active() ? RID_SVXBMP_LOCKED : RID_SVXBMP_UNLOCKED);
if (rBox.get_active())
{
- if (bLastWidthModified)
+ if (m_bLastWidthModified)
SizeHdl_Impl(*m_xWidthMF);
else
SizeHdl_Impl(*m_xHeightMF);
@@ -2241,15 +2249,15 @@ IMPL_LINK(SvxNumOptionsTabPage, RatioHdl_Impl, weld::Toggleable&, rBox, void)
IMPL_LINK_NOARG(SvxNumOptionsTabPage, CharFmtHdl_Impl, weld::ComboBox&, void)
{
- bAutomaticCharStyles = false;
+ m_bAutomaticCharStyles = false;
sal_Int32 nEntryPos = m_xCharFmtLB->get_active();
OUString sEntry = m_xCharFmtLB->get_active_text();
sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(i));
if( 0 == nEntryPos )
aNumFmt.SetCharFormatName(u""_ustr);
else
@@ -2257,7 +2265,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, CharFmtHdl_Impl, weld::ComboBox&, void)
if(SVX_NUM_BITMAP != (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
aNumFmt.SetCharFormatName(sEntry);
}
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
}
nMask <<= 1;
}
@@ -2279,16 +2287,16 @@ void SvxNumOptionsTabPage::EditModifyHdl_Impl(const weld::TextWidget* pEdit)
bool bPrefixSuffix = (pEdit == m_xPrefixED.get())|| (pEdit == m_xSuffixED.get());
bool bStart = pEdit == m_xStartED.get();
sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+ for (sal_uInt16 i = 0; i < m_pActNum->GetLevelCount(); i++)
{
- if(nActNumLvl & nMask)
+ if (m_nActNumLvl & nMask)
{
- SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+ SvxNumberFormat aNumFmt(m_pActNum->GetLevel(i));
if (bPrefixSuffix)
aNumFmt.SetListFormat(m_xPrefixED->get_text(), m_xSuffixED->get_text(), i);
else if(bStart)
aNumFmt.SetStart(m_xStartED->get_value());
- pActNum->SetLevel(i, aNumFmt);
+ m_pActNum->SetLevel(i, aNumFmt);
}
nMask <<= 1;
}
@@ -3150,10 +3158,10 @@ void SvxNumPositionTabPage::SetModified()
void SvxNumOptionsTabPage::SetModified(bool bRepaint)
{
- bModified = true;
+ m_bModified = true;
if (bRepaint)
{
- m_aPreviewWIN.SetLevel(nActNumLvl);
+ m_aPreviewWIN.SetLevel(m_nActNumLvl);
m_aPreviewWIN.Invalidate();
}
}
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 8c4917c1a9c6..a9e246b4efce 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -1299,6 +1299,7 @@ SvxParaAlignTabPage::SvxParaAlignTabPage(weld::Container* pPage, weld::DialogCon
, m_xLabelLetterSpacing(m_xBuilder->weld_label(u"labelLetterSpacing"_ustr))
, m_xLetterSpacingMinimum(m_xBuilder->weld_metric_spin_button(u"spin_LETTER_SPACING_MIN"_ustr, FieldUnit::PERCENT))
, m_xLetterSpacingMaximum(m_xBuilder->weld_metric_spin_button(u"spin_LETTER_SPACING_MAX"_ustr, FieldUnit::PERCENT))
+ , m_xCompoundBased(m_xBuilder->weld_check_button(u"checkCompoundBased"_ustr))
, m_xLabelGlyphScaling(m_xBuilder->weld_label(u"labelGlyphScaling"_ustr))
, m_xGlyphScalingMinimum(m_xBuilder->weld_metric_spin_button(u"spin_GLYPH_SCALING_MIN"_ustr, FieldUnit::PERCENT))
, m_xGlyphScalingMaximum(m_xBuilder->weld_metric_spin_button(u"spin_GLYPH_SCALING_MAX"_ustr, FieldUnit::PERCENT))
@@ -1409,6 +1410,7 @@ bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet )
m_xParagraphComposer->get_state_changed_from_saved() ||
m_xLetterSpacingMinimum->get_value_changed_from_saved() ||
m_xLetterSpacingMaximum->get_value_changed_from_saved() ||
+ m_xCompoundBased->get_state_changed_from_saved() ||
m_xGlyphScalingMinimum->get_value_changed_from_saved() ||
m_xGlyphScalingMaximum->get_value_changed_from_saved();
}
@@ -1436,6 +1438,7 @@ bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet )
aAdj.SetParagraphComposer( m_xParagraphComposer->get_active() );
aAdj.SetPropLetterSpacingMinimum( m_xLetterSpacingMinimum->get_value(FieldUnit::PERCENT) );
aAdj.SetPropLetterSpacingMaximum( m_xLetterSpacingMaximum->get_value(FieldUnit::PERCENT) );
+ aAdj.SetCompoundBased( m_xCompoundBased->get_active() );
aAdj.SetPropScaleWidthMinimum( m_xGlyphScalingMinimum->get_value(FieldUnit::PERCENT) );
aAdj.SetPropScaleWidthMaximum( m_xGlyphScalingMaximum->get_value(FieldUnit::PERCENT) );
rOutSet->Put( aAdj );
@@ -1543,6 +1546,8 @@ void SvxParaAlignTabPage::Reset( const SfxItemSet* rSet )
m_xLetterSpacingMinimum->set_sensitive(true);
m_xLetterSpacingMinimum->set_value(rAdj.GetPropLetterSpacingMinimum(), FieldUnit::PERCENT);
m_xLetterSpacingMaximum->set_value(rAdj.GetPropLetterSpacingMaximum(), FieldUnit::PERCENT);
+ m_xCompoundBased->set_sensitive(true);
+ m_xCompoundBased->set_active(rAdj.GetCompoundBased());
// TODO add GlyphScaling (CharScaleWidth)
m_xGlyphScalingMaximum->set_sensitive(true);
m_xGlyphScalingMinimum->set_sensitive(true);
@@ -1559,10 +1564,10 @@ void SvxParaAlignTabPage::Reset( const SfxItemSet* rSet )
m_xWordSpacingMinimum->set_sensitive(false);
m_xWordSpacingMaximum->set_sensitive(false);
m_xParagraphComposer->set_sensitive(false);
- m_xParagraphComposer->set_sensitive(false);
m_xLabelLetterSpacing->set_sensitive(false);
m_xLetterSpacingMinimum->set_sensitive(false);
m_xLetterSpacingMaximum->set_sensitive(false);
+ m_xCompoundBased->set_sensitive(false);
m_xLabelGlyphScaling->set_sensitive(false);
m_xGlyphScalingMinimum->set_sensitive(false);
m_xGlyphScalingMaximum->set_sensitive(false);
@@ -1664,6 +1669,7 @@ void SvxParaAlignTabPage::Reset( const SfxItemSet* rSet )
m_xParagraphComposer->save_state();
m_xLetterSpacingMinimum->save_value();
m_xLetterSpacingMaximum->save_value();
+ m_xCompoundBased->save_state();
m_xGlyphScalingMinimum->save_value();
m_xGlyphScalingMaximum->save_value();
@@ -1690,6 +1696,7 @@ void SvxParaAlignTabPage::ChangesApplied()
m_xParagraphComposer->save_state();
m_xLetterSpacingMinimum->save_value();
m_xLetterSpacingMaximum->save_value();
+ m_xCompoundBased->save_state();
m_xGlyphScalingMinimum->save_value();
m_xGlyphScalingMaximum->save_value();
}
@@ -1711,6 +1718,7 @@ IMPL_LINK_NOARG(SvxParaAlignTabPage, AlignHdl_Impl, weld::Toggleable&, void)
// TODO visualize CharKerning with percentage
m_xLetterSpacingMinimum->set_sensitive(bJustify);
m_xLetterSpacingMaximum->set_sensitive(bJustify);
+ m_xCompoundBased->set_sensitive(bJustify);
m_xLabelGlyphScaling->set_sensitive(bJustify);
// TODO visualize CharScaleWidth with percentage
m_xGlyphScalingMinimum->set_sensitive(bJustify);
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index bfe1892354d1..4d35e7c4a86e 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -185,7 +185,7 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& )
if (nSelectedIndex < 0)
return;
- ActivatePaletteColorHdl(m_aColorIconView.getColor(nSelectedIndex));
+ ActivatePaletteColorHdl(nSelectedIndex);
}
DeactivateRC SvxColorTabPage::DeactivatePage( SfxItemSet* _pSet )
@@ -388,7 +388,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickDeleteHdl_Impl, weld::Button&, void)
if (m_aColorIconView.getItemCount() > 0)
{
m_aColorIconView.select(0);
- ActivatePaletteColorHdl(m_aColorIconView.getColor(0));
+ ActivatePaletteColorHdl(0);
}
else
{
@@ -481,20 +481,16 @@ void SvxColorTabPage::UpdateToSelectedColor(const NamedColor& rNamedColor)
ChangeColor(rNamedColor, false);
}
-IMPL_LINK(SvxColorTabPage, ActivatePaletteColorHdl, const Color&, rColor, void)
+IMPL_LINK(SvxColorTabPage, ActivatePaletteColorHdl, int, nIndex, void)
{
- const int nPos = m_aColorIconView.get_selected_index();
- if (nPos < 0 || m_aColorIconView.getColor(nPos) != rColor)
- return;
-
NamedColor aNamedColor;
- aNamedColor.m_aColor = rColor;
+ aNamedColor.m_aColor = m_aColorIconView.getColor(nIndex);
if (maPaletteManager.IsThemePaletteSelected())
{
sal_uInt16 nThemeIndex;
sal_uInt16 nEffectIndex;
- if (PaletteManager::GetThemeAndEffectIndex(nPos, nThemeIndex, nEffectIndex))
+ if (PaletteManager::GetThemeAndEffectIndex(nIndex, nThemeIndex, nEffectIndex))
{
aNamedColor.m_nThemeIndex = nThemeIndex;
maPaletteManager.GetLumModOff(nThemeIndex, nEffectIndex, aNamedColor.m_nLumMod, aNamedColor.m_nLumOff);
@@ -516,10 +512,10 @@ IMPL_LINK(SvxColorTabPage, ActivatePaletteColorHdl, const Color&, rColor, void)
}
}
-IMPL_LINK(SvxColorTabPage, ActivateRecentColorHdl, const Color&, rColor, void)
+IMPL_LINK(SvxColorTabPage, ActivateRecentColorHdl, int, nIndex, void)
{
NamedColor aNamedColor;
- aNamedColor.m_aColor = rColor;
+ aNamedColor.m_aColor = m_aRecentIconView.getColor(nIndex);
UpdateToSelectedColor(aNamedColor);
diff --git a/cui/uiconfig/ui/colorpage.ui b/cui/uiconfig/ui/colorpage.ui
index bd350cca6700..ab198cfe06f8 100644
--- a/cui/uiconfig/ui/colorpage.ui
+++ b/cui/uiconfig/ui/colorpage.ui
@@ -167,7 +167,10 @@
coloriconviewmodel
12
0
+ 0
+ 0
2
+ 2
True
@@ -214,7 +217,10 @@
recentcoloriconviewmodel
12
0
+ 0
+ 0
2
+ 2
True
diff --git a/cui/uiconfig/ui/numberingoptionspage.ui b/cui/uiconfig/ui/numberingoptionspage.ui
index bbd57556425d..b2e4ac9a1ea0 100644
--- a/cui/uiconfig/ui/numberingoptionspage.ui
+++ b/cui/uiconfig/ui/numberingoptionspage.ui
@@ -164,7 +164,7 @@
True
False
True
- Number:
+ Type:
True
numfmtlb
0
@@ -180,7 +180,7 @@
False
-
-
- False
- True
- 3
-
-
+
+
+
+ False
+ True
+
+