[Libreoffice-commits] core.git: include/editeng include/oox include/svx oox/inc oox/qa oox/source sd/source svx/source

2023-01-13 Thread Tomaž Vajngerl (via logerrit)
 include/editeng/unoprnms.hxx   |1 
 include/oox/export/drawingml.hxx   |2 
 include/svx/unoshprp.hxx   |1 
 oox/inc/drawingml/lineproperties.hxx   |3 -
 oox/qa/unit/data/ThemeShapesReference.pptx |binary
 oox/qa/unit/drawingml.cxx  |   71 -
 oox/source/drawingml/lineproperties.cxx|   34 -
 oox/source/drawingml/shape.cxx |4 +
 oox/source/export/drawingml.cxx|   64 +-
 oox/source/token/properties.txt|1 
 sd/source/core/stlsheet.cxx|   10 
 svx/source/table/cell.cxx  |   12 
 svx/source/unodraw/unoshape.cxx|   10 
 svx/source/xoutdev/xattr.cxx   |   44 +++--
 14 files changed, 192 insertions(+), 65 deletions(-)

New commits:
commit af8fdba1194e657237f9abc460381a1c4bc49982
Author: Tomaž Vajngerl 
AuthorDate: Thu Jan 5 13:12:34 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Jan 13 23:07:22 2023 +

support theme color for lines + oox support + tests

Extended XLineColor to handle model::ThemeColor which then maps
to the newly added LineColorThemeData property.

Extended oox import and export to map the scheme color elements
to and from ThemeColor. Added a new test to check the theme line
color in impress shapes.

Change-Id: I23ecc18c88b5b47608c9110f5681f189d02e2f36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145071
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index 7f82cd0b1fea..300a0a2b7765 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -77,6 +77,7 @@ inline constexpr OUStringLiteral UNO_NAME_LINESTYLE = 
u"LineStyle";
 inline constexpr OUStringLiteral UNO_NAME_LINEDASH = u"LineDash";
 inline constexpr OUStringLiteral UNO_NAME_LINEWIDTH = u"LineWidth";
 inline constexpr OUStringLiteral UNO_NAME_LINECOLOR = u"LineColor";
+inline constexpr OUStringLiteral UNO_NAME_LINECOLOR_THEME_REFERENCE = 
u"LineColorThemeReference";
 inline constexpr OUStringLiteral UNO_NAME_LINEJOINT = u"LineJoint";
 inline constexpr OUStringLiteral UNO_NAME_LINESTART = u"LineStart";
 inline constexpr OUStringLiteral UNO_NAME_LINEEND = u"LineEnd";
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index eb0fea23b95c..c131632aea8d 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -235,7 +235,7 @@ public:
 void WriteConnectorConnections( sal_Int32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID );
 
 bool WriteCharColor(const css::uno::Reference& 
xPropertySet);
-bool WriteFillColor(const css::uno::Reference& 
xPropertySet);
+bool WriteSchemeColor(OUString const& rPropertyName, const 
css::uno::Reference& xPropertySet);
 
 void WriteSolidFill( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteSolidFill( const OUString& sSchemeName, const 
css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 
nAlpha = MAX_PERCENT );
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index 8af8142c1d43..70be33007013 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -236,6 +236,7 @@
 #define LINE_PROPERTIES_DEFAULTS\
 { UNO_NAME_LINECAP,   XATTR_LINECAP,  
::cppu::UnoType::get(), 0, 0}, \
 { UNO_NAME_LINECOLOR, XATTR_LINECOLOR,
::cppu::UnoType::get() ,   0, 0}, \
+{ UNO_NAME_LINECOLOR_THEME_REFERENCE, XATTR_LINECOLOR, 
::cppu::UnoType::get() ,   0, 
MID_COLOR_THEME_REFERENCE}, \
 { UNO_NAME_LINEENDCENTER, XATTR_LINEENDCENTER,
cppu::UnoType::get() ,   0, 0}, \
 { UNO_NAME_LINEENDWIDTH,  XATTR_LINEENDWIDTH, 
::cppu::UnoType::get() ,   0, 0, 
PropertyMoreFlags::METRIC_ITEM}, \
 { UNO_NAME_LINEJOINT, XATTR_LINEJOINT,
::cppu::UnoType::get(), 0, 0}, \
diff --git a/oox/inc/drawingml/lineproperties.hxx 
b/oox/inc/drawingml/lineproperties.hxx
index f2d37a7f8a9f..52c27825bdaf 100644
--- a/oox/inc/drawingml/lineproperties.hxx
+++ b/oox/inc/drawingml/lineproperties.hxx
@@ -69,7 +69,8 @@ struct LineProperties
 voidpushToPropMap(
 ShapePropertyMap& rPropMap,
 const GraphicHelper& rGraphicHelper,
-::Color nPhClr = API_RGB_TRANSPARENT ) const;
+::Color nPhClr = API_RGB_TRANSPARENT,
+sal_Int16 nPhClrTheme = -1) const;
 
 /** Calculates the line style attribute from the internal state of the 
object */
 css::drawing::LineStyle  getLineStyle() const;
diff --git a/oox/qa/unit/data/ThemeShapesReference.pptx 

[Libreoffice-commits] core.git: oox/qa oox/source

2023-01-13 Thread Tomaž Vajngerl (via logerrit)
 oox/qa/unit/drawingml.cxx   |   21 -
 oox/source/drawingml/fillproperties.cxx |2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit 79ad3e73907d15c4e234e2a32de8173273f5ac16
Author: Tomaž Vajngerl 
AuthorDate: Fri Jan 6 00:08:17 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Jan 13 14:37:44 2023 +

oox: also allow tint and shade for fill color

This was an obsolete limitation that is not needed anymore.

Change-Id: Ie9610516996fc16197f8611843ff621b8a83ebdc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145084
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index 2faf2b28e909..f47853e3b5f7 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -444,8 +444,6 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint)
 // Given a document with a table style, using theme color with tinting in 
the A2 cell:
 loadFromURL(u"theme-tint.pptx");
 
-// Then make sure that we only import theming info to the doc model if the 
effects are limited
-// to lum mod / off that we can handle (i.e. no tint/shade):
 uno::Reference 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
 uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
  uno::UNO_QUERY);
@@ -453,6 +451,7 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint)
 uno::Reference xTable;
 CPPUNIT_ASSERT(xShape->getPropertyValue("Model") >>= xTable);
 uno::Reference xA1(xTable->getCellByPosition(0, 0), 
uno::UNO_QUERY);
+
 // check theme color
 {
 uno::Reference xThemeColor;
@@ -460,8 +459,11 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint)
 CPPUNIT_ASSERT(xThemeColor.is());
 model::ThemeColor aThemeColor;
 model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
-// This is OK, no problematic effects:
 CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aThemeColor.getType());
+{
+auto const& rTrans = aThemeColor.getTransformations();
+CPPUNIT_ASSERT_EQUAL(size_t(0), rTrans.size());
+}
 }
 
 {
@@ -471,12 +473,13 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint)
 CPPUNIT_ASSERT(xThemeColor.is());
 model::ThemeColor aThemeColor;
 model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
-// Without the accompanying fix in place, this test would have failed 
with:
-// - Expected: -1
-// - Actual  : 4
-// i.e. we remembered the theme index, without being able to remember 
the tint effect, leading
-// to a bad background color.
-CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Unknown, 
aThemeColor.getType());
+CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aThemeColor.getType());
+{
+auto const& rTrans = aThemeColor.getTransformations();
+CPPUNIT_ASSERT_EQUAL(size_t(1), rTrans.size());
+CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, 
rTrans[0].meType);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTrans[0].mnValue);
+}
 }
 }
 
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 99fbfa41e990..d193653d7189 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -455,7 +455,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 
aThemeColor.setType(model::convertToThemeColorType(nPhClrTheme));
 rPropMap.setProperty(PROP_FillColorThemeReference, 
model::theme::createXThemeColor(aThemeColor));
 }
-else if (maFillColor.getTintOrShade() == 0)
+else
 {
 
aThemeColor.setType(model::convertToThemeColorType(maFillColor.getSchemeColorIndex()));
 if (maFillColor.getLumMod() != 1)


[Libreoffice-commits] core.git: writerfilter/source

2023-01-13 Thread Tomaž Vajngerl (via logerrit)
 writerfilter/source/dmapper/TDefTableHandler.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 1a79594a27f41ad369e7c387c51e00afb1352872
Author: Tomaž Vajngerl 
AuthorDate: Thu Jan 5 12:32:02 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Jan 13 13:44:20 2023 +

ooxml: fix theme color type mapping: bg -> light, text -> dark

Change-Id: I19ad3ef7c911943075d7ddc01626047cdf11d5db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145070
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx 
b/writerfilter/source/dmapper/TDefTableHandler.cxx
index 4d279ac4bc12..b8e0582de033 100644
--- a/writerfilter/source/dmapper/TDefTableHandler.cxx
+++ b/writerfilter/source/dmapper/TDefTableHandler.cxx
@@ -300,13 +300,13 @@ model::ThemeColorType 
TDefTableHandler::getThemeColorTypeIndex(sal_Int32 nType)
 case NS_ooxml::LN_Value_St_ThemeColor_none:
 return model::ThemeColorType::Unknown;
 case NS_ooxml::LN_Value_St_ThemeColor_background1:
-return model::ThemeColorType::Dark1;
-case NS_ooxml::LN_Value_St_ThemeColor_text1:
 return model::ThemeColorType::Light1;
+case NS_ooxml::LN_Value_St_ThemeColor_text1:
+return model::ThemeColorType::Dark1;
 case NS_ooxml::LN_Value_St_ThemeColor_background2:
-return model::ThemeColorType::Dark2;
-case NS_ooxml::LN_Value_St_ThemeColor_text2:
 return model::ThemeColorType::Light2;
+case NS_ooxml::LN_Value_St_ThemeColor_text2:
+return model::ThemeColorType::Dark2;
 default:
 break;
 }


[Libreoffice-commits] core.git: 2 commits - include/toolkit include/xmloff oox/qa schema/libreoffice toolkit/source xmloff/CppunitTest_xmloff_draw.mk xmloff/CppunitTest_xmloff_uxmloff.mk xmloff/inc xm

2023-01-13 Thread Tomaž Vajngerl (via logerrit)
 dev/null|binary
 include/toolkit/awt/vclxfont.hxx|7 
 include/xmloff/txtprmap.hxx |2 
 include/xmloff/xmltoken.hxx |8 
 oox/qa/unit/data/ReferenceShapeFill.odp |binary
 oox/qa/unit/export.cxx  |   21 
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |   87 ++-
 toolkit/source/awt/vclxfont.cxx |3 
 toolkit/source/helper/vclunohelper.cxx  |2 
 xmloff/CppunitTest_xmloff_draw.mk   |1 
 xmloff/CppunitTest_xmloff_uxmloff.mk|1 
 xmloff/Library_xo.mk|3 
 xmloff/inc/XMLThemeColorContext.hxx |   33 +
 xmloff/inc/XMLThemeColorExport.hxx  |   30 +
 xmloff/inc/XMLThemeColorHandler.hxx |   39 -
 xmloff/inc/xmlprop.hxx  |8 
 xmloff/qa/unit/data/Reference-ThemeColors-TextAndFill.pptx  |binary
 xmloff/qa/unit/data/ReferenceShapeFill.pptx |binary
 xmloff/qa/unit/draw.cxx |  268 +---
 xmloff/source/core/xmltoken.cxx |8 
 xmloff/source/draw/XMLShapePropertySetContext.cxx   |4 
 xmloff/source/draw/sdpropls.cxx |4 
 xmloff/source/style/PagePropertySetContext.cxx  |4 
 xmloff/source/text/XMLTextPropertySetContext.cxx|6 
 xmloff/source/text/XMLTextShapeStyleContext.cxx |4 
 xmloff/source/text/XMLThemeColorContext.cxx |  116 +
 xmloff/source/text/XMLThemeColorExport.cxx  |   85 +++
 xmloff/source/text/txtexppr.cxx |7 
 xmloff/source/text/txtexppr.hxx |2 
 xmloff/source/text/txtprhdl.cxx |   18 
 xmloff/source/text/txtprmap.cxx |9 
 xmloff/source/token/tokens.txt  |8 
 32 files changed, 604 insertions(+), 184 deletions(-)

New commits:
commit 3eb53d327fb5d9689b799ff991a6c53c05eff496
Author: Tomaž Vajngerl 
AuthorDate: Sat Dec 31 20:59:03 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Jan 13 13:44:09 2023 +

xmloff: use XThemeColor in ODF, change the format for themes

Change the xmloff filter to use XThemeColor and the associated
proprties (CharColorThemeReference and FillColorThemeReference).

Change the ODF format for referencing a theme color - make it an
element instead a series of attributes on the *-properties style
element.

Change-Id: I0fa7d8ebffecc02897b7fe9824d6f1776ef36380
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144923
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/xmloff/txtprmap.hxx b/include/xmloff/txtprmap.hxx
index 37c0d7a9f330..986bbd007d8a 100644
--- a/include/xmloff/txtprmap.hxx
+++ b/include/xmloff/txtprmap.hxx
@@ -202,7 +202,7 @@
 #define CTF_FILLSTYLE   (XML_TEXT_CTF_START + 173)
 #define CTF_FILLCOLOR   (XML_TEXT_CTF_START + 174)
 #define CTF_PAGENUMBEROFFSET(XML_TEXT_CTF_START + 175)
-
+#define CTF_THEME_COLOR (XML_TEXT_CTF_START + 176)
 
 enum class TextPropMap {
 TEXT = 0,
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 34bcf3099048..e33a39deb449 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3481,8 +3481,8 @@ namespace xmloff::token {
 XML_LINKED_STYLE_NAME,
 
 XML_THEME,
-XML_THEME_COLOR,
-XML_FILL_THEME_COLOR,
+XML_CHAR_COLOR_THEME_REFERENCE,
+XML_FILL_COLOR_THEME_REFERENCE,
 XML_DK1,
 XML_LT1,
 XML_DK2,
@@ -3495,10 +3495,6 @@ namespace xmloff::token {
 XML_ACCENT6,
 XML_HLINK,
 XML_FOLHLINK,
-XML_COLOR_LUM_MOD,
-XML_COLOR_LUM_OFF,
-XML_FILL_COLOR_LUM_MOD,
-XML_FILL_COLOR_LUM_OFF,
 
 XML_CONTENT_CONTROL,
 XML_SHOWING_PLACE_HOLDER,
diff --git a/oox/qa/unit/data/ReferenceShapeFill.odp 
b/oox/qa/unit/data/ReferenceShapeFill.odp
new file mode 100644
index ..91544d20b302
Binary files /dev/null and b/oox/qa/unit/data/ReferenceShapeFill.odp differ
diff --git a/oox/qa/unit/data/refer-to-theme-shape-fill.odp 
b/oox/qa/unit/data/refer-to-theme-shape-fill.odp
deleted file mode 100644
index 3a32aa71690a..
Binary files a/oox/qa/unit/data/refer-to-theme-shape-fill.odp and /dev/null 
differ
diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx
index 289bdf49611c..fdf97b328f45 100644
--- a/oox/qa/unit/export.cxx
+++ b/oox/qa/unit/export.cxx
@@ -353,27 

[Libreoffice-commits] core.git: editeng/source forms/qa include/editeng include/svx oox/Library_oox.mk oox/qa oox/source sd/qa sd/source svx/qa svx/source sw/qa sw/source writerfilter/Library_writerfi

2023-01-12 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/items/textitem.cxx |   19 +++
 editeng/source/uno/unotext.cxx|6 +
 forms/qa/unoapi/knownissues.xcl   |2 
 include/editeng/memberids.h   |1 
 include/editeng/unoprnms.hxx  |3 
 include/editeng/unotext.hxx   |1 
 include/svx/unoshprp.hxx  |1 
 oox/Library_oox.mk|1 
 oox/qa/unit/drawingml.cxx |   71 +++--
 oox/qa/unit/shape.cxx |   11 +-
 oox/source/drawingml/fillproperties.cxx   |   21 +++
 oox/source/drawingml/textcharacterproperties.cxx  |   23 +++-
 oox/source/export/drawingml.cxx   |   99 --
 oox/source/token/properties.txt   |2 
 sd/qa/unit/uiimpress.cxx  |   61 +--
 sd/source/core/stlsheet.cxx   |9 +
 svx/qa/unit/styles.cxx|   43 ---
 svx/qa/unit/xoutdev.cxx   |   47 
 svx/source/styles/ColorSets.cxx   |   62 ---
 svx/source/table/cell.cxx |9 +
 svx/source/unodraw/unoprov.cxx|1 
 svx/source/unodraw/unoshap2.cxx   |1 
 svx/source/unodraw/unoshape.cxx   |9 +
 svx/source/xoutdev/xattr.cxx  |   15 ++
 sw/qa/core/theme/ThemeTest.cxx|9 +
 sw/source/core/unocore/unomap.cxx |1 
 sw/source/core/unocore/unomap1.cxx|2 
 sw/source/core/unocore/unomapproperties.hxx   |3 
 writerfilter/Library_writerfilter.mk  |1 
 writerfilter/source/dmapper/DomainMapper.cxx  |  119 --
 writerfilter/source/dmapper/PropertyIds.cxx   |3 
 writerfilter/source/dmapper/PropertyIds.hxx   |3 
 writerfilter/source/dmapper/TDefTableHandler.cxx  |   38 +++
 writerfilter/source/dmapper/TDefTableHandler.hxx  |4 
 writerfilter/source/dmapper/ThemeColorHandler.hxx |   68 
 35 files changed, 488 insertions(+), 281 deletions(-)

New commits:
commit 197e5f81213d14fdcbff40edf73385ecd4cd9815
Author: Tomaž Vajngerl 
AuthorDate: Sun Jan 1 23:25:38 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Jan 13 00:49:24 2023 +

introduce {Char,Fill}ColorThemeReference which uses XThemeColor

Adds a unified UNO property for theme colors *ColorTheme
(CharColorTheme and FillColorTheme) which uses XThemeColor, that
replaces the properties *Theme, *TintOrShade, *LumOff, *LumMod.
The properties are still present for backwards compatibility and
to keep ODF support working in tests as that needs a bigger change.

Reactor the code and tests to accomodate for this change.

Change-Id: If7983decb4ba528b49fe7b5968aa9efc696a9efc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144783
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index bf6017cdcf6d..5a53d6a8e14c 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -77,6 +77,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -1435,6 +1436,12 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 rVal <<= nValue;
 break;
 }
+   case MID_COLOR_THEME_REFERENCE:
+{
+auto xThemeColor = model::theme::createXThemeColor(maThemeColor);
+rVal <<= xThemeColor;
+break;
+}
 default:
 {
 rVal <<= mColor;
@@ -1509,6 +1516,18 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 maThemeColor.addTransformation({model::TransformationType::LumOff, 
nLumOff});
 }
 break;
+case MID_COLOR_THEME_REFERENCE:
+{
+css::uno::Reference xThemeColor;
+if (!(rVal >>= xThemeColor))
+return false;
+
+if (xThemeColor.is())
+{
+model::theme::setFromXThemeColor(maThemeColor, xThemeColor);
+}
+}
+break;
 default:
 {
 return rVal >>= mColor;
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index e5877a7d2e5a..82a399f00e26 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1175,6 +1175,12 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const 
SfxItemSet* pSet, const Sf
 }
 break;
 }
+case MID_COLOR_THEME_REFERENCE:
+if (pColor->GetThemeColor().getType() == 
model::ThemeColorType::Unknown)
+

[Libreoffice-commits] core.git: bin/update_pch cui/inc cui/Library_cui.mk cui/source docmodel/inc docmodel/Library_docmodel.mk docmodel/Makefile docmodel/Module_docmodel.mk docmodel/README.md docmodel

2023-01-12 Thread Tomaž Vajngerl (via logerrit)
 Repository.mk  |1 
 RepositoryModule_build.mk  |1 
 RepositoryModule_host.mk   |1 
 bin/update_pch |   31 ++---
 cui/Library_cui.mk |1 
 cui/inc/pch/precompiled_cui.hxx|   14 +-
 cui/source/tabpages/chardlg.cxx|   12 +-
 cui/source/tabpages/tpcolor.cxx|   10 +
 docmodel/Library_docmodel.mk   |   39 ++
 docmodel/Makefile  |7 +
 docmodel/Module_docmodel.mk|   18 +++
 docmodel/README.md |5 
 docmodel/inc/pch/precompiled_docmodel.cxx  |   12 ++
 docmodel/inc/pch/precompiled_docmodel.hxx  |   34 +
 docmodel/source/uno/UnoThemeColor.cxx  |   40 ++
 editeng/CppunitTest_editeng_core.mk|1 
 editeng/Library_editeng.mk |1 
 editeng/inc/pch/precompiled_editeng.hxx|7 -
 editeng/source/items/textitem.cxx  |  105 ++---
 editeng/source/uno/unotext.cxx |   22 +++
 include/docmodel/dllapi.h  |   21 +++
 include/docmodel/theme/ThemeColor.hxx  |  146 +
 include/docmodel/theme/ThemeColorType.hxx  |   42 +++
 include/docmodel/uno/UnoThemeColor.hxx |   55 +
 include/editeng/colritem.hxx   |   54 -
 include/svx/ColorSets.hxx  |   32 -
 include/svx/xcolit.hxx |9 -
 offapi/UnoApi_offapi.mk|1 
 offapi/com/sun/star/util/XThemeColor.idl   |   26 
 oox/CppunitTest_oox_drawingml.mk   |1 
 oox/CppunitTest_oox_shape.mk   |1 
 oox/CppunitTest_oox_tokenmap.mk|1 
 oox/Library_oox.mk |1 
 oox/inc/pch/precompiled_oox.hxx|   69 ---
 oox/source/export/ThemeExport.cxx  |   28 ++--
 sd/CppunitTest_sd_uiimpress.mk |1 
 sd/CppunitTest_sd_uimpress.mk  |1 
 sd/Library_sd.mk   |1 
 sd/inc/pch/precompiled_sd.hxx  |   68 ++-
 sd/source/core/stlsheet.cxx|   18 ++-
 sd/source/filter/eppt/pptx-epptooxml.cxx   |2 
 sd/source/ui/func/fuconstr.cxx |4 
 sd/source/ui/view/drtxtob1.cxx |   29 ++--
 sd/source/ui/view/drviews2.cxx |7 -
 solenv/gbuild/extensions/pre_MergedLibsList.mk |1 
 solenv/qa/python/gbuildtojson.py   |2 
 svx/CppunitTest_svx_removewhichrange.mk|1 
 svx/CppunitTest_svx_styles.mk  |1 
 svx/CppunitTest_svx_unit.mk|1 
 svx/Library_svxcore.mk |1 
 svx/inc/pch/precompiled_svx.hxx|   29 ++--
 svx/source/styles/ColorSets.cxx|   14 +-
 svx/source/table/cell.cxx  |   19 ++-
 svx/source/unodraw/unoshape.cxx|   18 ++-
 svx/source/xoutdev/xattr.cxx   |   47 ++--
 sw/CppunitTest_sw_apitests.mk  |1 
 sw/CppunitTest_sw_core_draw.mk |1 
 sw/CppunitTest_sw_core_theme.mk|1 
 sw/CppunitTest_sw_macros_test.mk   |1 
 sw/CppunitTest_sw_ooxmlimport.mk   |1 
 sw/CppunitTest_sw_ooxmlimport2.mk  |1 
 sw/CppunitTest_sw_tiledrendering.mk|1 
 sw/CppunitTest_sw_uwriter.mk   |1 
 sw/Library_sw.mk   |1 
 sw/layoutwriter_setup.mk   |1 
 sw/ooxmlexport_setup.mk|1 
 sw/qa/core/theme/ThemeTest.cxx |   20 +--
 sw/source/uibase/sidebar/ThemePanel.cxx|   13 +-
 sw/uiwriter_setup.mk   |1 
 sw/ww8export_setup.mk  |1 
 70 files changed, 883 insertions(+), 277 deletions(-)

New commits:
commit bd0f526f2d3e1ffe43a74672485815768eee6e9e
Author: Tomaž Vajngerl 
AuthorDate: Wed Dec 28 09:43:46 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Jan 12 23:15:58 2023 +

introduce docmodel comp., model::ThemeColor, use it in SvxColorItem

Added a new component docmodel, that has the document model types,
which only depend on other basic components. This is needed so the
types can be used in every relevant component - xmloff, oox, svx,
editeng,...

Introduces model::ThemeColor, which is a class used to store the
theme color data, including transformations (svx::Transformation).
For UNO use XThemeColor is added, and the implementation UnoThemeColor
which wraps svx::ThemeColor, so it can be tranported around.

Reactor all the code and tests to 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/oox include/svx oox/source

2023-01-11 Thread Tomaž Vajngerl (via logerrit)
 include/oox/drawingml/clrscheme.hxx |3 +++
 include/svx/ColorSets.hxx   |2 +-
 oox/source/drawingml/clrscheme.cxx  |   27 +++
 oox/source/drawingml/theme.cxx  |   30 --
 4 files changed, 51 insertions(+), 11 deletions(-)

New commits:
commit a55c32f955dae641a7167d8fda52ed9d25a22c2d
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 12 21:13:07 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Jan 12 06:12:28 2023 +

oox: set svx::Theme directly to a SdrPage when importing

Bypass the need to set the theme data (svx::Theme) throught UNO
as multiple nested properties. Much more properties will be added
to the svx::Theme and this will simplify handling a lot.

Change-Id: I0b54628ff22c7c823a999de257fd5bb45e736bdb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143992
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit a6253e13e0f3f866ab47e4271db9a80d8cbce708)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145371
Tested-by: Jenkins CollaboraOffice 

diff --git a/include/oox/drawingml/clrscheme.hxx 
b/include/oox/drawingml/clrscheme.hxx
index a4f0b653441a..fd7662511a88 100644
--- a/include/oox/drawingml/clrscheme.hxx
+++ b/include/oox/drawingml/clrscheme.hxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace oox::drawingml {
 
@@ -94,6 +95,8 @@ public:
 const OUString& GetName() const { return maName; }
 
 void ToAny(css::uno::Any& rVal) const;
+void fill(svx::ColorSet& rColorSet) const;
+
 };
 
 }
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index d76bf754acc1..b9c79eb23bf6 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -50,7 +50,7 @@ constexpr ThemeColorType convertToThemeColorType(sal_Int32 
nIndex)
 return static_cast(nIndex);
 }
 
-class ColorSet
+class SVXCORE_DLLPUBLIC ColorSet
 {
 OUString maColorSetName;
 std::vector maColors;
diff --git a/oox/source/drawingml/clrscheme.cxx 
b/oox/source/drawingml/clrscheme.cxx
index 19c0afd44900..225faf81eecf 100644
--- a/oox/source/drawingml/clrscheme.cxx
+++ b/oox/source/drawingml/clrscheme.cxx
@@ -120,6 +120,33 @@ void ClrScheme::ToAny(css::uno::Any& rVal) const
 rVal <<= comphelper::containerToSequence(aRet);
 }
 
+void ClrScheme::fill(svx::ColorSet& rColorSet) const
+{
+for (const auto& [nToken, rColor] : maClrScheme)
+{
+switch (nToken)
+{
+case XML_tx1:
+case XML_dk1: rColorSet.add(0, rColor); break;
+case XML_bg1:
+case XML_lt1: rColorSet.add(1, rColor); break;
+case XML_tx2:
+case XML_dk2: rColorSet.add(2, rColor); break;
+case XML_bg2:
+case XML_lt2: rColorSet.add(3, rColor); break;
+case XML_accent1: rColorSet.add(4, rColor); break;
+case XML_accent2: rColorSet.add(5, rColor); break;
+case XML_accent3: rColorSet.add(6, rColor); break;
+case XML_accent4: rColorSet.add(7, rColor); break;
+case XML_accent5: rColorSet.add(8, rColor); break;
+case XML_accent6: rColorSet.add(9, rColor); break;
+case XML_hlink: rColorSet.add(10, rColor); break;
+case XML_folHlink: rColorSet.add(11, rColor); break;
+default: break;
+}
+}
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx
index 56df9941169c..18f80e56ee97 100644
--- a/oox/source/drawingml/theme.cxx
+++ b/oox/source/drawingml/theme.cxx
@@ -24,6 +24,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 using namespace com::sun::star;
 
@@ -105,16 +110,21 @@ const TextFont* Theme::resolveFont( const OUString& rName 
) const
 
 void Theme::addTheme(const css::uno::Reference& 
xDrawPage) const
 {
-beans::PropertyValue aColorScheme;
-aColorScheme.Name = "ColorScheme";
-maClrScheme.ToAny(aColorScheme.Value);
-beans::PropertyValues aValues = {
-comphelper::makePropertyValue("Name", maThemeName),
-comphelper::makePropertyValue("ColorSchemeName", 
maClrScheme.GetName()),
-aColorScheme,
-};
-uno::Reference xPropertySet(xDrawPage, 
uno::UNO_QUERY);
-xPropertySet->setPropertyValue("Theme", uno::makeAny(aValues));
+SAL_WARN_IF(!xDrawPage.is(), "oox", "DrawPage is not set");
+
+SdrPage* pPage = GetSdrPageFromXDrawPage(xDrawPage);
+
+SAL_WARN_IF(!pPage, "oox", "Can't get SdrPage from XDrawPage");
+
+if (!pPage)
+return;
+
+auto pTheme = std::make_unique(maThemeName);
+auto pColorSet = std::make_unique(maClrScheme.GetName());
+maClrScheme.fill(*pColorSet);
+pTheme->SetColorSet(std::move(pColorSet));
+
+pPage->getSdrPageProperties().SetTheme(std::move(pTheme));
 }
 
 } // namespace oox::drawingml


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 2 commits - include/svx oox/inc oox/source sd/source svx/source sw/source

2023-01-11 Thread Tomaž Vajngerl (via logerrit)
 include/svx/ColorSets.hxx|   48 ++-
 oox/inc/drawingml/textfont.hxx   |   10 +++---
 oox/source/drawingml/textfont.cxx|   20 
 sd/source/filter/eppt/pptx-epptooxml.cxx |3 +
 sd/source/ui/func/fuconstr.cxx   |2 -
 svx/source/styles/ColorSets.cxx  |   32 +---
 sw/source/uibase/sidebar/ThemePanel.cxx  |7 ++--
 7 files changed, 70 insertions(+), 52 deletions(-)

New commits:
commit 901dae3958f23006cf77b106c76f3b93e5b7460e
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 12 20:59:59 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Jan 12 06:12:19 2023 +

svx: rename mnPitch to mnPitchFamily, add resolvePitchFamily

Rename mnPitch to mnPitchFamily as it contains both. Extract the
code to resolve what is pitch and what is family into its own
(static) function.

Change-Id: I0c17351ea690a85decefb8d73dd07644ce5c78d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143991
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 4ee7e71d850315f5ae4c3b763b0e80e8d83a6454)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145370
Tested-by: Jenkins CollaboraOffice 

diff --git a/oox/inc/drawingml/textfont.hxx b/oox/inc/drawingml/textfont.hxx
index 6bdf13ab890a..231b18cffecb 100644
--- a/oox/inc/drawingml/textfont.hxx
+++ b/oox/inc/drawingml/textfont.hxx
@@ -51,6 +51,8 @@ public:
 sal_Int16& rnFontFamily,
 const ::oox::core::XmlFilterBase& rFilter ) const;
 
+static void resolvePitch(sal_Int32 nOoxPitch, sal_Int16& rnFontPitch, 
sal_Int16& rnFontFamily);
+
 private:
 boolimplGetFontData(
 OUString& rFontName,
@@ -58,10 +60,10 @@ private:
 sal_Int16& rnFontFamily ) const;
 
 private:
-OUString maTypeface;
-OUString maPanose;
-sal_Int32   mnPitch;
-sal_Int32   mnCharset;
+OUString maTypeface;
+OUString maPanose;
+sal_Int32 mnPitchFamily;
+sal_Int32 mnCharset;
 };
 
 
diff --git a/oox/source/drawingml/textfont.cxx 
b/oox/source/drawingml/textfont.cxx
index 41dd0716a69a..ab50e821e5ec 100644
--- a/oox/source/drawingml/textfont.cxx
+++ b/oox/source/drawingml/textfont.cxx
@@ -48,7 +48,7 @@ sal_Int16 lclGetFontFamily( sal_Int32 nOoxValue )
 } // namespace
 
 TextFont::TextFont() :
-mnPitch( 0 ),
+mnPitchFamily(0),
 mnCharset( WINDOWS_CHARSET_ANSI )
 {
 }
@@ -56,16 +56,16 @@ TextFont::TextFont() :
 void TextFont::setAttributes( const AttributeList& rAttribs )
 {
 maTypeface = rAttribs.getString( XML_typeface, OUString() );
-maPanose   = rAttribs.getString( XML_panose, OUString() );
-mnPitch= rAttribs.getInteger( XML_pitchFamily, 0 );
-mnCharset  = rAttribs.getInteger( XML_charset, WINDOWS_CHARSET_DEFAULT );
+maPanose = rAttribs.getString( XML_panose, OUString() );
+mnPitchFamily = rAttribs.getInteger( XML_pitchFamily, 0 );
+mnCharset = rAttribs.getInteger( XML_charset, WINDOWS_CHARSET_DEFAULT );
 }
 
 void TextFont::setAttributes( const OUString& sFontName )
 {
 maTypeface = sFontName;
 maPanose.clear();
-mnPitch = 0;
+mnPitchFamily = 0;
 mnCharset = WINDOWS_CHARSET_DEFAULT;
 }
 
@@ -86,11 +86,17 @@ bool TextFont::getFontData( OUString& rFontName, sal_Int16& 
rnFontPitch, sal_Int
 bool TextFont::implGetFontData( OUString& rFontName, sal_Int16& rnFontPitch, 
sal_Int16& rnFontFamily ) const
 {
 rFontName = maTypeface;
-rnFontPitch = lclGetFontPitch( extractValue< sal_Int16 >( mnPitch, 0, 4 ) 
);
-rnFontFamily = lclGetFontFamily( extractValue< sal_Int16 >( mnPitch, 4, 4 
) );
+resolvePitch(mnPitchFamily, rnFontPitch, rnFontFamily);
 return !rFontName.isEmpty();
 }
 
+void TextFont::resolvePitch(sal_Int32 nOoxPitchFamily, sal_Int16& rnFontPitch, 
sal_Int16& rnFontFamily)
+{
+rnFontPitch = lclGetFontPitch(extractValue(nOoxPitchFamily, 0, 
4));
+rnFontFamily = lclGetFontFamily(extractValue(nOoxPitchFamily, 
4, 4));
+}
+
+
 } // namespace oox::drawingml
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a047aabb2756d143c8e01c1625ef435188af3085
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 12 20:17:09 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Jan 12 06:12:10 2023 +

svx: rename ThemeColorType enum values, use enum instead of index

Change-Id: I81c1553205365c4076562474078b3b0aa834b249
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143990
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 1386e26b2d7fc5173266ffbfb94bc82b1d3f7bb9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145369
Tested-by: Jenkins CollaboraOffice 

diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 6ad59a50c064..d76bf754acc1 100644
--- a/include/svx/ColorSets.hxx
+++ 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 2 commits - editeng/source include/editeng sw/CppunitTest_sw_core_theme.mk sw/Module_sw.mk sw/qa sw/source writerfilter/source xmlo

2023-01-11 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/items/textitem.cxx |   25 +++
 include/editeng/colritem.hxx  |   26 ---
 sw/CppunitTest_sw_core_theme.mk   |   62 ++
 sw/Module_sw.mk   |1 
 sw/qa/core/theme/ThemeTest.cxx|   31 +
 sw/qa/core/theme/data/ThemeColorInHeading.docx|binary
 sw/source/core/unocore/unomap.cxx |2 
 sw/source/core/unocore/unomap1.cxx|4 +
 sw/source/core/unocore/unomapproperties.hxx   |6 +
 sw/source/uibase/sidebar/ThemePanel.cxx   |   29 ++--
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |   14 ++--
 writerfilter/source/dmapper/DomainMapper.cxx  |   16 
 writerfilter/source/dmapper/PropertyIds.cxx   |2 
 writerfilter/source/dmapper/PropertyIds.hxx   |2 
 writerfilter/source/dmapper/TDefTableHandler.cxx  |   44 
 writerfilter/source/dmapper/TDefTableHandler.hxx  |1 
 xmloff/inc/XMLThemeColorHandler.hxx   |   49 ++
 xmloff/inc/enummaps.hxx   |2 
 xmloff/source/draw/sdpropls.cxx   |3 
 xmloff/source/text/txtprhdl.cxx   |6 +
 20 files changed, 273 insertions(+), 52 deletions(-)

New commits:
commit 0ba2265645f884d9a3df89fb95e8695998e2a832
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 5 13:59:22 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Jan 12 03:28:16 2023 +

editeng: move "tint or shade" variable into SvxThemeColor

Change-Id: Ia2094854a8275082cf7444307e17fe5449c43b3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143698
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 6fb682487e355933d79a8ef74560ecf318b4f705)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145368
Tested-by: Jenkins CollaboraOffice 

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 72b982b73ff9..329af5edb076 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1353,9 +1353,10 @@ bool SvxContourItem::GetPresentation
 }
 
 SvxThemeColor::SvxThemeColor()
-: maThemeIndex(-1),
-mnLumMod(1),
-mnLumOff(0)
+: maThemeIndex(-1)
+, mnLumMod(1)
+, mnLumOff(0)
+, mnTintOrShade(0)
 {
 }
 
@@ -1363,7 +1364,8 @@ bool SvxThemeColor::operator==(const SvxThemeColor& 
rThemeColor) const
 {
 return maThemeIndex == rThemeColor.maThemeIndex &&
 mnLumMod == rThemeColor.mnLumMod &&
-mnLumOff == rThemeColor.mnLumOff;
+mnLumOff == rThemeColor.mnLumOff &&
+mnTintOrShade  == rThemeColor.mnTintOrShade;
 }
 
 void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) const
@@ -1376,6 +1378,8 @@ void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) 
const
   
BAD_CAST(OString::number(mnLumMod).getStr()));
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("lum-off"),
   
BAD_CAST(OString::number(mnLumOff).getStr()));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("tint-or-shade"),
+  
BAD_CAST(OString::number(mnTintOrShade).getStr()));
 
 (void)xmlTextWriterEndElement(pWriter);
 }
@@ -1383,15 +1387,13 @@ void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 // class SvxColorItem 
 SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
 SfxPoolItem(nId),
-mColor( COL_BLACK ),
-maTintShade(0)
+mColor( COL_BLACK )
 {
 }
 
 SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) :
 SfxPoolItem( nId ),
-mColor( rCol ),
-maTintShade(0)
+mColor( rCol )
 {
 }
 
@@ -1405,8 +1407,7 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) 
const
 const SvxColorItem& rColorItem = static_cast(rAttr);
 
 return mColor == rColorItem.mColor &&
-   maThemeColor == rColorItem.maThemeColor &&
-   maTintShade == rColorItem.maTintShade;
+   maThemeColor == rColorItem.maThemeColor;
 }
 
 bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -1432,7 +1433,7 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 }
 case MID_COLOR_TINT_OR_SHADE:
 {
-rVal <<= maTintShade;
+rVal <<= maThemeColor.GetTintOrShade();
 break;
 }
 case MID_COLOR_LUM_MOD:
@@ -1488,7 +1489,7 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 sal_Int16 nTintShade = -1;
 if (!(rVal >>= nTintShade))
 return false;
-maTintShade = nTintShade;
+maThemeColor.SetTintOrShade(nTintShade);
 }
 break;
  

[Libreoffice-commits] core.git: include/svx svx/source sw/source

2023-01-04 Thread Tomaž Vajngerl (via logerrit)
 include/svx/ColorSets.hxx   |2 ++
 svx/source/styles/ColorSets.cxx |5 +
 sw/source/uibase/sidebar/ThemePanel.cxx |   15 +++
 3 files changed, 22 insertions(+)

New commits:
commit 7c10e3b120ba75a2db75342fdc68040a179404b8
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 12 22:26:41 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Jan 5 05:55:51 2023 +

sw: add the ColorSet from SdrPage into ColorSets in ThemePanel

Change-Id: I7c4ef103b2be65a8adbad5d4f00304ee22be668f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143997
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 718b79b3e66c..3d345b20c1b3 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -99,6 +99,8 @@ public:
 }
 
 const ColorSet& getColorSet(std::u16string_view rName);
+
+void insert(ColorSet const& rColorSet);
 };
 
 struct SVXCORE_DLLPUBLIC ThemeSupplementalFont
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index bb8009fdc5be..5511253f3d03 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -238,6 +238,11 @@ const ColorSet& ColorSets::getColorSet(std::u16string_view 
rName)
 return maColorSets[0];
 }
 
+void ColorSets::insert(ColorSet const& rColorSet)
+{
+maColorSets.push_back(rColorSet);
+}
+
 Theme::Theme(OUString const& rName)
 : maName(rName)
 {
diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx 
b/sw/source/uibase/sidebar/ThemePanel.cxx
index 14a58b236d91..ad0d74e2b678 100644
--- a/sw/source/uibase/sidebar/ThemePanel.cxx
+++ b/sw/source/uibase/sidebar/ThemePanel.cxx
@@ -30,6 +30,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+
 
 namespace
 {
@@ -442,6 +447,16 @@ ThemePanel::ThemePanel(weld::Widget* pParent)
 
 maColorSets.init();
 
+SwDocShell* pDocSh = static_cast(SfxObjectShell::Current());
+SwDoc* pDocument = pDocSh->GetDoc();
+if (pDocument)
+{
+SdrPage* pPage = 
pDocument->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+svx::Theme* pTheme = pPage->getSdrPageProperties().GetTheme();
+if (pTheme)
+maColorSets.insert(*pTheme->GetColorSet());
+}
+
 const std::vector& aColorSets = maColorSets.getColorSets();
 for (size_t i = 0; i < aColorSets.size(); ++i)
 {


[Libreoffice-commits] core.git: include/oox oox/Library_oox.mk oox/source

2023-01-02 Thread Tomaž Vajngerl (via logerrit)
 include/oox/export/ThemeExport.hxx |   38 +
 oox/Library_oox.mk |1 
 oox/source/export/ThemeExport.cxx  |  263 +
 3 files changed, 302 insertions(+)

New commits:
commit 958d4667e361a1d8461889117ca830a5da85d0ee
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 12 22:18:43 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Jan 2 12:44:45 2023 +

oox: add ThemeExport that exports a svx::Theme into theme.xml file

Adds ThemeExport that takes a svx::Theme as input and exports that
into a theme.xml file in the OOXML document. Currently supports
exporting of color schemes and font schemes. Format schemes are
hard-coded for now. The ThemeExport isn't yet used in any actual
export functionality.

Change-Id: I5ca9c256da65be77e7192be7d66c73d26d78ebd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143996
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/export/ThemeExport.hxx 
b/include/oox/export/ThemeExport.hxx
new file mode 100644
index ..02f222cadafe
--- /dev/null
+++ b/include/oox/export/ThemeExport.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include 
+#include 
+#include 
+#include 
+
+namespace oox
+{
+class OOX_DLLPUBLIC ThemeExport
+{
+private:
+oox::core::XmlFilterBase* mpFilterBase;
+
+public:
+ThemeExport(oox::core::XmlFilterBase* pFilterBase);
+
+void write(OUString const& rPath, svx::Theme const& rTheme);
+
+private:
+static bool writeColorSet(sax_fastparser::FSHelperPtr pFS, svx::Theme 
const& rTheme);
+static bool writeFontScheme(sax_fastparser::FSHelperPtr pFS,
+svx::FontScheme const& rFontScheme);
+static bool writeFormatScheme(sax_fastparser::FSHelperPtr pFS);
+};
+
+} // end namespace oox
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index aba27c786f8d..67f4f6e1ec0f 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -231,6 +231,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\
 oox/source/export/DMLPresetShapeExport \
 oox/source/export/shapes \
 oox/source/export/vmlexport \
+oox/source/export/ThemeExport \
 oox/source/helper/attributelist \
 oox/source/helper/binaryinputstream \
 oox/source/helper/binaryoutputstream \
diff --git a/oox/source/export/ThemeExport.cxx 
b/oox/source/export/ThemeExport.cxx
new file mode 100644
index ..f11b894f924a
--- /dev/null
+++ b/oox/source/export/ThemeExport.cxx
@@ -0,0 +1,263 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace oox
+{
+ThemeExport::ThemeExport(oox::core::XmlFilterBase* pFilterBase)
+: mpFilterBase(pFilterBase)
+
+{
+}
+
+void ThemeExport::write(OUString const& rPath, svx::Theme const& rTheme)
+{
+sax_fastparser::FSHelperPtr pFS = 
mpFilterBase->openFragmentStreamWithSerializer(
+rPath, "application/vnd.openxmlformats-officedocument.theme+xml");
+
+OUString aThemeName = rTheme.GetName();
+
+pFS->startElementNS(XML_a, XML_theme, FSNS(XML_xmlns, XML_a),
+mpFilterBase->getNamespaceURL(OOX_NS(dml)), XML_name, 
aThemeName);
+
+pFS->startElementNS(XML_a, XML_themeElements);
+
+const svx::ColorSet* pColorSet = rTheme.GetColorSet();
+
+pFS->startElementNS(XML_a, XML_clrScheme, XML_name, pColorSet->getName());
+writeColorSet(pFS, rTheme);
+pFS->endElementNS(XML_a, XML_clrScheme);
+
+svx::FontScheme const& rFontScheme = rTheme.getFontScheme();
+pFS->startElementNS(XML_a, XML_fontScheme, XML_name, 
rFontScheme.getName());
+writeFontScheme(pFS, rFontScheme);
+pFS->endElementNS(XML_a, XML_fontScheme);
+
+pFS->startElementNS(XML_a, XML_fmtScheme);
+writeFormatScheme(pFS);
+pFS->endElementNS(XML_a, XML_fmtScheme);
+
+pFS->endElementNS(XML_a, XML_themeElements);
+pFS->endElementNS(XML_a, XML_theme);
+
+pFS->endDocument();
+}
+
+namespace
+{
+void fillAttrList(rtl::Reference const& 
pAttrList,
+  svx::ThemeFont const& rThemeFont)
+{
+pAttrList->add(XML_typeface, rThemeFont.maTypeface);
+pAttrList->add(XML_panose, rThemeFont.maPanose);
+pAttrList->add(XML_pitchFamily, 

[Libreoffice-commits] core.git: include/oox oox/Library_oox.mk oox/source solenv/clang-format sw/qa writerfilter/inc writerfilter/Library_writerfilter.mk writerfilter/source

2023-01-01 Thread Tomaž Vajngerl (via logerrit)
 include/oox/drawingml/ThemeFilterBase.hxx  |   58 +
 include/oox/drawingml/themefragmenthandler.hxx |1 
 oox/Library_oox.mk |1 
 oox/source/drawingml/ThemeFilterBase.cxx   |   50 +
 oox/source/drawingml/themefragmenthandler.cxx  |   56 -
 oox/source/shape/ShapeContextHandler.cxx   |4 
 solenv/clang-format/excludelist|1 
 sw/qa/core/theme/ThemeTest.cxx |   46 +
 writerfilter/Library_writerfilter.mk   |3 
 writerfilter/inc/ooxml/OOXMLDocument.hxx   |3 
 writerfilter/source/dmapper/DomainMapper.cxx   |   27 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  |8 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx  |   19 
 writerfilter/source/dmapper/ThemeHandler.cxx   |  422 +
 writerfilter/source/dmapper/ThemeHandler.hxx   |   35 
 writerfilter/source/dmapper/ThemeTable.cxx |  563 -
 writerfilter/source/dmapper/ThemeTable.hxx |   58 -
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx|   14 
 writerfilter/source/ooxml/OOXMLDocumentImpl.hxx|9 
 writerfilter/source/ooxml/OOXMLFactory.hxx |2 
 writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.cxx |   69 +
 writerfilter/source/ooxml/OOXMLFastContextHandlerTheme.hxx |   46 +
 writerfilter/source/ooxml/model.xml|2 
 23 files changed, 821 insertions(+), 676 deletions(-)

New commits:
commit 31213fc7cae358038aaec853584782c698f8
Author: Tomaž Vajngerl 
AuthorDate: Tue Dec 6 17:33:44 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Jan 1 23:35:17 2023 +

sw: read theme from OOXML file and set it to the draw page

This change extends writerfilter to use oox::ThemeFragmentHandler
to read the theme properties, and sets that to the one and only
draw page of a Writer document.

This change also removes ThemeTable and replaces it with the
ThemeHandler, which takes theme font data from svx::Theme
instead.

In addition, a test has been writen, which loads a document with
a theme, and asserts the draw page has the theme and the theme
properties currently supported.

Change-Id: Iff0048cd21ea030ac55287707852acc463ec3cb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143699
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/drawingml/ThemeFilterBase.hxx 
b/include/oox/drawingml/ThemeFilterBase.hxx
new file mode 100644
index ..7f311e206a90
--- /dev/null
+++ b/include/oox/drawingml/ThemeFilterBase.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace oox::drawingml
+{
+class OOX_DLLPUBLIC ThemeFilterBase final : public core::XmlFilterBase
+{
+public:
+typedef rtl::Reference Pointer_t;
+
+explicit ThemeFilterBase(css::uno::Reference 
const& rxContext);
+
+virtual ~ThemeFilterBase() override;
+
+/** Has to be implemented by each filter, returns the current theme. */
+virtual const oox::drawingml::Theme* getCurrentTheme() const override;
+
+/** May be implemented by filters which handle Diagrams, default returns 
empty ptr */
+virtual std::shared_ptr getCurrentThemePtr() const 
override;
+
+void setCurrentTheme(const oox::drawingml::ThemePtr& pTheme);
+
+/** Has to be implemented by each filter to return the collection of VML 
shapes. */
+virtual oox::vml::Drawing* getVmlDrawing() override;
+
+/** Has to be implemented by each filter to return TableStyles. */
+virtual oox::drawingml::table::TableStyleListPtr getTableStyles() override;
+
+virtual oox::drawingml::chart::ChartConverter* getChartConverter() 
override;
+
+virtual oox::ole::VbaProject* implCreateVbaProject() const override;
+
+virtual bool importDocument() override { return true; }
+virtual bool exportDocument() override { return false; }
+
+private:
+virtual OUString SAL_CALL getImplementationName() override;
+
+oox::drawingml::ThemePtr mpTheme;
+};
+
+} // namespace oox::drawingml
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/themefragmenthandler.hxx 
b/include/oox/drawingml/themefragmenthandler.hxx
index e433c350de80..918a3eb861b9 100644
--- a/include/oox/drawingml/themefragmenthandler.hxx
+++ b/include/oox/drawingml/themefragmenthandler.hxx
@@ -44,6 +44,7 @@ public:
 

[Libreoffice-commits] core.git: include/oox include/svx oox/inc oox/source svx/CppunitTest_svx_unit.mk svx/qa

2023-01-01 Thread Tomaž Vajngerl (via logerrit)
 include/oox/drawingml/theme.hxx   |   12 +-
 include/svx/ColorSets.hxx |  149 ++
 oox/inc/drawingml/textfont.hxx|3 
 oox/source/drawingml/textfont.cxx |9 +
 oox/source/drawingml/theme.cxx|   69 +++-
 oox/source/drawingml/themeelementscontext.cxx |   23 ++--
 svx/CppunitTest_svx_unit.mk   |1 
 svx/qa/unit/ThemeTest.cxx |   40 ++
 8 files changed, 295 insertions(+), 11 deletions(-)

New commits:
commit d5a71bc6a28f8a3d726b2ac4688c7cef9d77ddf0
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 12 22:12:58 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Jan 1 23:34:32 2023 +

oox: add support for importing font scheme into a svx::Theme

Change-Id: I862256a17ce84c85174678f3fd03c8ef6661f2c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143995
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx
index f7b4a262ffb8..ebd05957bf3b 100644
--- a/include/oox/drawingml/theme.hxx
+++ b/include/oox/drawingml/theme.hxx
@@ -35,8 +35,12 @@ namespace com::sun::star {
 namespace drawing { class XDrawPage; }
 namespace xml::dom { class XDocument; }
 }
+namespace svx {
+class Theme;
+}
 
-namespace oox::drawingml {
+namespace oox::drawingml
+{
 
 struct EffectProperties;
 struct FillProperties;
@@ -82,6 +86,10 @@ public:
 
 FontScheme&  getFontScheme() { return maFontScheme; }
 const FontScheme&getFontScheme() const { return maFontScheme; }
+
+std::map>>& 
getSupplementalFontMap() { return maSupplementalFontMap; }
+std::map>> const& 
getSupplementalFontMap() const { return maSupplementalFontMap; }
+
 /** Returns theme font properties by scheme type (major/minor). */
 const TextCharacterProperties*  getFontStyle( sal_Int32 nSchemeType ) 
const;
 /** Returns theme font by placeholder name, e.g. the major latin theme 
font for the font name '+mj-lt'. */
@@ -99,6 +107,7 @@ public:
 const css::uno::Reference& getFragment() const { 
return mxFragment; }
 void setFragment( const css::uno::Reference< 
css::xml::dom::XDocument>& xRef ) { mxFragment=xRef; }
 
+std::unique_ptr createSvxTheme() const;
 void addTheme(const css::uno::Reference& 
xDrawPage) const;
 
 private:
@@ -111,6 +120,7 @@ private:
 LineStyleList   maLineStyleList;
 EffectStyleList maEffectStyleList;
 FontScheme  maFontScheme;
+std::map>> 
maSupplementalFontMap;
 Shape   maSpDef;
 Shape   maLnDef;
 Shape   maTxDef;
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 47e1d8866e5d..718b79b3e66c 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -101,6 +101,146 @@ public:
 const ColorSet& getColorSet(std::u16string_view rName);
 };
 
+struct SVXCORE_DLLPUBLIC ThemeSupplementalFont
+{
+OUString maScript;
+OUString maTypeface;
+};
+
+struct SVXCORE_DLLPUBLIC ThemeFont
+{
+OUString maTypeface;
+OUString maPanose;
+sal_Int16 maPitch;
+sal_Int16 maFamily;
+sal_Int32 maCharset;
+
+sal_Int16 getPitchFamily() const
+{
+return (maPitch & 0x0F) | (maFamily & 0x0F) << 4;
+}
+};
+
+class SVXCORE_DLLPUBLIC FontScheme
+{
+private:
+OUString maName;
+
+ThemeFont maMinorLatin;
+ThemeFont maMinorAsian;
+ThemeFont maMinorComplex;
+
+ThemeFont maMajorLatin;
+ThemeFont maMajorAsian;
+ThemeFont maMajorComplex;
+
+std::vector maMinorSupplementalFontList;
+std::vector maMajorSupplementalFontList;
+
+public:
+FontScheme() = default;
+FontScheme(OUString const& rName)
+: maName(rName)
+{}
+
+const OUString& getName() const
+{
+return maName;
+}
+
+ThemeFont const& getMinorLatin() const
+{
+return maMinorLatin;
+}
+void setMinorLatin(ThemeFont const& aMinor)
+{
+maMinorLatin = aMinor;
+}
+
+ThemeFont const& getMinorAsian() const
+{
+return maMinorAsian;
+}
+void setMinorAsian(ThemeFont const& aMinor)
+{
+maMinorAsian = aMinor;
+}
+
+ThemeFont const& getMinorComplex() const
+{
+return maMinorComplex;
+}
+void setMinorComplex(ThemeFont const& aMinor)
+{
+maMinorComplex = aMinor;
+}
+
+ThemeFont const& getMajorLatin() const
+{
+return maMajorLatin;
+}
+void setMajorLatin(ThemeFont const& aMajor)
+{
+maMajorLatin = aMajor;
+}
+
+ThemeFont const& getMajorAsian() const
+{
+return maMajorAsian;
+}
+void setMajorAsian(ThemeFont const& aMajor)
+{
+maMajorAsian = aMajor;
+}
+
+ThemeFont const& getMajorComplex() const
+{
+return maMajorComplex;
+}
+void 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 18 commits - basctl/source basegfx/CppunitTest_basegfx.mk basegfx/test chart2/source cui/source download.lst drawinglayer/source ed

2022-12-29 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit ed5100f96c63ec49a53969c0694ac77645175533
Author: Tomaž Vajngerl 
AuthorDate: Wed Nov 23 11:00:13 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Dec 29 16:04:40 2022 +0900

svx: convert SdrTextObj rotate and move to use gfx::Length

Change-Id: I82f10f82db8ac9d5653f4902276ee58fc18c52d6

diff --git a/include/basegfx/utils/RectangleWrapper.hxx 
b/include/basegfx/utils/RectangleWrapper.hxx
index 00586d6eae71..4f5dbe851f66 100644
--- a/include/basegfx/utils/RectangleWrapper.hxx
+++ b/include/basegfx/utils/RectangleWrapper.hxx
@@ -55,6 +55,11 @@ public:
 m_aRange.setSize(width, height);
 }
 
+void shift(gfx::Length const& rXDelta, gfx::Length const& rYDelta)
+{
+m_aRange.shift(rXDelta, rYDelta);
+}
+
 void move(sal_Int32 nXDelta, sal_Int32 nYDelta)
 {
 auto deltaX = gfx::Length::hmm(nXDelta);
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index e2a050c99dba..1ac82bc3db47 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -39,6 +39,35 @@
 
 using namespace com::sun::star;
 
+namespace
+{
+gfx::Tuple2DL rotatePoint(gfx::Tuple2DL const& rPoint, gfx::Tuple2DL const& 
rReference, double sinAngle, double cosAngle)
+{
+gfx::Length dx = rPoint.getX() - rReference.getX();
+gfx::Length dy = rPoint.getY() - rReference.getY();
+
+auto x = rReference.getX() + gfx::Length::emu(basegfx::fround(dx.raw() * 
cosAngle + dy.raw() * sinAngle));
+auto y = rReference.getY() + gfx::Length::emu(basegfx::fround(dy.raw() * 
cosAngle - dx.raw() * sinAngle));
+
+return gfx::Tuple2DL(x, y);
+}
+
+gfx::Tuple2DL toTuple(Point const& rPointHmm)
+{
+auto x = gfx::Length::hmm(rPointHmm.X());
+auto y = gfx::Length::hmm(rPointHmm.Y());
+return {x, y};
+}
+
+gfx::Size2DL toSize2D(Size const& rSizeHmm)
+{
+auto x = gfx::Length::hmm(rSizeHmm.Width());
+auto y = gfx::Length::hmm(rSizeHmm.Height());
+return {x, y};
+}
+
+} // end anonymous ns
+
 void SdrTextObj::NbcSetSnapRect(const tools::Rectangle& rRect)
 {
 if (maGeo.nRotationAngle || maGeo.nShearAngle)
@@ -91,7 +120,9 @@ Degree100 SdrTextObj::GetShearAngle(bool /*bVertical*/) const
 
 void SdrTextObj::NbcMove(const Size& rSize)
 {
-moveRectangle(rSize.Width(), rSize.Height());
+gfx::Size2DL aSize2D = toSize2D(rSize);
+maRectangle.shift(aSize2D.getWidth(), aSize2D.getHeight());
+
 moveOutRectangle(rSize.Width(), rSize.Height());
 maSnapRect.Move(rSize);
 SetBoundAndSnapRectsDirty(true);
@@ -182,27 +213,37 @@ void SdrTextObj::NbcResize(const Point& rRef, const 
Fraction& xFact, const Fract
 SetBoundAndSnapRectsDirty();
 }
 
-void SdrTextObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, 
double cs)
+void SdrTextObj::NbcRotate(const Point& rRef, Degree100 nAngle, double 
sinAngle, double cosAngle)
 {
+auto aReference = toTuple(rRef);
+
 SetGlueReallyAbsolute(true);
-tools::Long dx = getRectangle().Right() - getRectangle().Left();
-tools::Long dy = getRectangle().Bottom() - getRectangle().Top();
-Point aPoint1(getRectangle().TopLeft());
-RotatePoint(aPoint1, rRef, sn, cs);
-Point aPoint2(aPoint1.X() + dx, aPoint1.Y() + dy);
-tools::Rectangle aRectangle(aPoint1, aPoint2);
-setRectangle(aRectangle);
+auto const& rRange = maRectangle.getRange();
+
+auto nWidth = rRange.getWidth();
+auto nHeight = rRange.getHeight();
+
+gfx::Tuple2DL aPoint1(rRange.getMinX(), rRange.getMinY());
+aPoint1 = rotatePoint(aPoint1, aReference, sinAngle, cosAngle);
 
-if (maGeo.nRotationAngle==0_deg100) {
-maGeo.nRotationAngle=NormAngle36000(nAngle);
-maGeo.mfSinRotationAngle=sn;
-maGeo.mfCosRotationAngle=cs;
-} else {
-maGeo.nRotationAngle=NormAngle36000(maGeo.nRotationAngle+nAngle);
+gfx::Tuple2DL aPoint2(aPoint1.getX() + nWidth, aPoint1.getY() + nHeight);
+
+gfx::Range2DL aRange{aPoint1, aPoint2};
+maRectangle.setRange(aRange);
+
+if (maGeo.nRotationAngle == 0_deg100)
+{
+maGeo.nRotationAngle = NormAngle36000(nAngle);
+maGeo.mfSinRotationAngle = sinAngle;
+maGeo.mfCosRotationAngle = cosAngle;
+}
+else
+{
+maGeo.nRotationAngle = NormAngle36000(maGeo.nRotationAngle + nAngle);
 maGeo.RecalcSinCos();
 }
 SetBoundAndSnapRectsDirty();
-NbcRotateGluePoints(rRef,nAngle,sn,cs);
+NbcRotateGluePoints(rRef, nAngle, sinAngle, cosAngle);
 SetGlueReallyAbsolute(false);
 }
 
commit 44c5c59d5a596e3bbbfcf779ad0f6af5623fdfa3
Author: Tomaž Vajngerl 
AuthorDate: Tue Nov 22 13:33:30 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Dec 29 16:04:40 2022 +0900

svx: use RectangleWrapper for maRectangle on SdrTextObj

This is needed so we can now transition to use gfx::Length and
gfx::Range2DL to define the object position and size.

Change-Id: 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 1408 commits - accessibility/inc accessibility/source android/source basctl/inc basctl/Library_basctl.mk basctl/sdi basctl/source b

2022-12-28 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit 7e1d1ee7f9488957624455ee39a4edb3a1cbcba0
Author: Tomaž Vajngerl 
AuthorDate: Wed Nov 23 11:00:13 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Wed Dec 28 18:48:46 2022 +0900

svx: convert SdrTextObj rotate and move to use gfx::Length

Change-Id: I82f10f82db8ac9d5653f4902276ee58fc18c52d6

diff --git a/include/basegfx/utils/RectangleWrapper.hxx 
b/include/basegfx/utils/RectangleWrapper.hxx
index 00586d6eae71..4f5dbe851f66 100644
--- a/include/basegfx/utils/RectangleWrapper.hxx
+++ b/include/basegfx/utils/RectangleWrapper.hxx
@@ -55,6 +55,11 @@ public:
 m_aRange.setSize(width, height);
 }
 
+void shift(gfx::Length const& rXDelta, gfx::Length const& rYDelta)
+{
+m_aRange.shift(rXDelta, rYDelta);
+}
+
 void move(sal_Int32 nXDelta, sal_Int32 nYDelta)
 {
 auto deltaX = gfx::Length::hmm(nXDelta);
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index e2a050c99dba..1ac82bc3db47 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -39,6 +39,35 @@
 
 using namespace com::sun::star;
 
+namespace
+{
+gfx::Tuple2DL rotatePoint(gfx::Tuple2DL const& rPoint, gfx::Tuple2DL const& 
rReference, double sinAngle, double cosAngle)
+{
+gfx::Length dx = rPoint.getX() - rReference.getX();
+gfx::Length dy = rPoint.getY() - rReference.getY();
+
+auto x = rReference.getX() + gfx::Length::emu(basegfx::fround(dx.raw() * 
cosAngle + dy.raw() * sinAngle));
+auto y = rReference.getY() + gfx::Length::emu(basegfx::fround(dy.raw() * 
cosAngle - dx.raw() * sinAngle));
+
+return gfx::Tuple2DL(x, y);
+}
+
+gfx::Tuple2DL toTuple(Point const& rPointHmm)
+{
+auto x = gfx::Length::hmm(rPointHmm.X());
+auto y = gfx::Length::hmm(rPointHmm.Y());
+return {x, y};
+}
+
+gfx::Size2DL toSize2D(Size const& rSizeHmm)
+{
+auto x = gfx::Length::hmm(rSizeHmm.Width());
+auto y = gfx::Length::hmm(rSizeHmm.Height());
+return {x, y};
+}
+
+} // end anonymous ns
+
 void SdrTextObj::NbcSetSnapRect(const tools::Rectangle& rRect)
 {
 if (maGeo.nRotationAngle || maGeo.nShearAngle)
@@ -91,7 +120,9 @@ Degree100 SdrTextObj::GetShearAngle(bool /*bVertical*/) const
 
 void SdrTextObj::NbcMove(const Size& rSize)
 {
-moveRectangle(rSize.Width(), rSize.Height());
+gfx::Size2DL aSize2D = toSize2D(rSize);
+maRectangle.shift(aSize2D.getWidth(), aSize2D.getHeight());
+
 moveOutRectangle(rSize.Width(), rSize.Height());
 maSnapRect.Move(rSize);
 SetBoundAndSnapRectsDirty(true);
@@ -182,27 +213,37 @@ void SdrTextObj::NbcResize(const Point& rRef, const 
Fraction& xFact, const Fract
 SetBoundAndSnapRectsDirty();
 }
 
-void SdrTextObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, 
double cs)
+void SdrTextObj::NbcRotate(const Point& rRef, Degree100 nAngle, double 
sinAngle, double cosAngle)
 {
+auto aReference = toTuple(rRef);
+
 SetGlueReallyAbsolute(true);
-tools::Long dx = getRectangle().Right() - getRectangle().Left();
-tools::Long dy = getRectangle().Bottom() - getRectangle().Top();
-Point aPoint1(getRectangle().TopLeft());
-RotatePoint(aPoint1, rRef, sn, cs);
-Point aPoint2(aPoint1.X() + dx, aPoint1.Y() + dy);
-tools::Rectangle aRectangle(aPoint1, aPoint2);
-setRectangle(aRectangle);
+auto const& rRange = maRectangle.getRange();
+
+auto nWidth = rRange.getWidth();
+auto nHeight = rRange.getHeight();
+
+gfx::Tuple2DL aPoint1(rRange.getMinX(), rRange.getMinY());
+aPoint1 = rotatePoint(aPoint1, aReference, sinAngle, cosAngle);
 
-if (maGeo.nRotationAngle==0_deg100) {
-maGeo.nRotationAngle=NormAngle36000(nAngle);
-maGeo.mfSinRotationAngle=sn;
-maGeo.mfCosRotationAngle=cs;
-} else {
-maGeo.nRotationAngle=NormAngle36000(maGeo.nRotationAngle+nAngle);
+gfx::Tuple2DL aPoint2(aPoint1.getX() + nWidth, aPoint1.getY() + nHeight);
+
+gfx::Range2DL aRange{aPoint1, aPoint2};
+maRectangle.setRange(aRange);
+
+if (maGeo.nRotationAngle == 0_deg100)
+{
+maGeo.nRotationAngle = NormAngle36000(nAngle);
+maGeo.mfSinRotationAngle = sinAngle;
+maGeo.mfCosRotationAngle = cosAngle;
+}
+else
+{
+maGeo.nRotationAngle = NormAngle36000(maGeo.nRotationAngle + nAngle);
 maGeo.RecalcSinCos();
 }
 SetBoundAndSnapRectsDirty();
-NbcRotateGluePoints(rRef,nAngle,sn,cs);
+NbcRotateGluePoints(rRef, nAngle, sinAngle, cosAngle);
 SetGlueReallyAbsolute(false);
 }
 
commit 68178e79a1ec461b77596c81975e0961a4abf660
Author: Tomaž Vajngerl 
AuthorDate: Tue Nov 22 13:33:30 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Wed Dec 28 18:48:46 2022 +0900

svx: use RectangleWrapper for maRectangle on SdrTextObj

This is needed so we can now transition to use gfx::Length and
gfx::Range2DL to define the object position and size.

Change-Id: 

[Libreoffice-commits] core.git: 2 commits - include/oox include/svx oox/source svx/source

2022-12-26 Thread Tomaž Vajngerl (via logerrit)
 include/oox/drawingml/theme.hxx   |8 ---
 include/svx/ColorSets.hxx |   22 ++--
 oox/source/drawingml/themeelementscontext.cxx |   17 +++
 svx/source/styles/ColorSets.cxx   |   28 ++
 4 files changed, 44 insertions(+), 31 deletions(-)

New commits:
commit 29c2bba1f3ef216d226c97197185066880fc1ab5
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 12 21:48:17 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 26 23:57:14 2022 +

svx: use array for colors in ColorSet, add consts, rename vars

Use std::array for colors in ColorSet as there are always only 12
colors for a color scheme.
Add "const" to getters where appropriate.
Rename maColorSetName to maName in ColorSet - long variable name
is not needed.

Change-Id: Iacb976a22af2d2585d627b0ba65d98cbe1b825c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143994
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 692e683218e8..6b4504ebb877 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -11,6 +11,7 @@
 #ifndef INCLUDED_SVX_COLORSETS_HXX
 #define INCLUDED_SVX_COLORSETS_HXX
 
+#include 
 #include 
 
 #include 
@@ -52,19 +53,17 @@ constexpr ThemeColorType convertToThemeColorType(sal_Int32 
nIndex)
 
 class SVXCORE_DLLPUBLIC ColorSet
 {
-OUString maColorSetName;
-std::vector maColors;
+OUString maName;
+std::array maColors;
+
 public:
-ColorSet(OUString aName);
+ColorSet(OUString const& rName);
 
-void add(sal_uInt32 nIndex, ::Color aColorData)
-{
-maColors[nIndex] = aColorData;
-}
+void add(sal_uInt32 nIndex, Color aColorData);
 
 const OUString& getName() const
 {
-return maColorSetName;
+return maName;
 }
 
 Color getColor(ThemeColorType nType) const
@@ -88,7 +87,7 @@ public:
 return maColorSets;
 }
 
-const ColorSet& getColorSet(sal_uInt32 nIndex)
+const ColorSet& getColorSet(sal_uInt32 nIndex) const
 {
 return maColorSets[nIndex];
 }
@@ -99,14 +98,15 @@ public:
 /// A named theme has a named color set.
 class SVXCORE_DLLPUBLIC Theme
 {
+private:
 OUString maName;
 std::unique_ptr mpColorSet;
 
 public:
-Theme(OUString sName);
-~Theme();
+Theme(OUString const& rName);
 
 void SetColorSet(std::unique_ptr pColorSet);
+const ColorSet* GetColorSet() const;
 ColorSet* GetColorSet();
 
 void SetName(const OUString& rName);
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index 6af2ee6313bc..bb8009fdc5be 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -93,7 +93,7 @@ void UpdateFillColorSet(const 
uno::Reference& xShape, const
 
 void UpdateSdrObject(svx::Theme* pTheme, SdrObject* pObject)
 {
-svx::ColorSet* pColorSet = pTheme->GetColorSet();
+const svx::ColorSet* pColorSet = pTheme->GetColorSet();
 if (!pColorSet)
 {
 return;
@@ -126,20 +126,21 @@ void UpdateSdrObject(svx::Theme* pTheme, SdrObject* 
pObject)
 namespace svx
 {
 
-ColorSet::ColorSet(OUString aColorSetName)
-: maColorSetName(std::move(aColorSetName))
-, maColors(12)
+ColorSet::ColorSet(OUString const& rName)
+: maName(rName)
 {}
 
-ColorSets::ColorSets()
-{}
+void ColorSet::add(sal_uInt32 nIndex, Color aColorData)
+{
+maColors[nIndex] = aColorData;
+}
 
 void ColorSet::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ColorSet"));
 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
-(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("maColorSetName"),
-  
BAD_CAST(maColorSetName.toUtf8().getStr()));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("maName"),
+  BAD_CAST(maName.toUtf8().getStr()));
 
 for (const auto& rColor : maColors)
 {
@@ -153,6 +154,9 @@ void ColorSet::dumpAsXml(xmlTextWriterPtr pWriter) const
 (void)xmlTextWriterEndElement(pWriter);
 }
 
+ColorSets::ColorSets()
+{}
+
 ColorSets::~ColorSets()
 {}
 
@@ -234,15 +238,15 @@ const ColorSet& 
ColorSets::getColorSet(std::u16string_view rName)
 return maColorSets[0];
 }
 
-Theme::Theme(OUString aName)
-: maName(std::move(aName))
+Theme::Theme(OUString const& rName)
+: maName(rName)
 {
 }
 
-Theme::~Theme() {}
-
 void Theme::SetColorSet(std::unique_ptr pColorSet) { mpColorSet = 
std::move(pColorSet); }
 
+const ColorSet* Theme::GetColorSet() const { return mpColorSet.get(); }
+
 ColorSet* Theme::GetColorSet() { return mpColorSet.get(); }
 
 void Theme::SetName(const OUString& rName) { maName = rName; }
commit cffe7884342f249e82780a46f9aba4213e9dd378
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 12 21:41:50 2022 +0900
Commit: Tomaž 

[Libreoffice-commits] core.git: include/oox include/svx oox/source

2022-12-26 Thread Tomaž Vajngerl (via logerrit)
 include/oox/drawingml/clrscheme.hxx |3 +++
 include/svx/ColorSets.hxx   |2 +-
 oox/source/drawingml/clrscheme.cxx  |   27 +++
 oox/source/drawingml/theme.cxx  |   30 --
 4 files changed, 51 insertions(+), 11 deletions(-)

New commits:
commit a6253e13e0f3f866ab47e4271db9a80d8cbce708
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 12 21:13:07 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 26 08:55:14 2022 +

oox: set svx::Theme directly to a SdrPage when importing

Bypass the need to set the theme data (svx::Theme) throught UNO
as multiple nested properties. Much more properties will be added
to the svx::Theme and this will simplify handling a lot.

Change-Id: I0b54628ff22c7c823a999de257fd5bb45e736bdb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143992
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/drawingml/clrscheme.hxx 
b/include/oox/drawingml/clrscheme.hxx
index a4f0b653441a..fd7662511a88 100644
--- a/include/oox/drawingml/clrscheme.hxx
+++ b/include/oox/drawingml/clrscheme.hxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace oox::drawingml {
 
@@ -94,6 +95,8 @@ public:
 const OUString& GetName() const { return maName; }
 
 void ToAny(css::uno::Any& rVal) const;
+void fill(svx::ColorSet& rColorSet) const;
+
 };
 
 }
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 71f12c2dbe71..692e683218e8 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -50,7 +50,7 @@ constexpr ThemeColorType convertToThemeColorType(sal_Int32 
nIndex)
 return static_cast(nIndex);
 }
 
-class ColorSet
+class SVXCORE_DLLPUBLIC ColorSet
 {
 OUString maColorSetName;
 std::vector maColors;
diff --git a/oox/source/drawingml/clrscheme.cxx 
b/oox/source/drawingml/clrscheme.cxx
index 19c0afd44900..225faf81eecf 100644
--- a/oox/source/drawingml/clrscheme.cxx
+++ b/oox/source/drawingml/clrscheme.cxx
@@ -120,6 +120,33 @@ void ClrScheme::ToAny(css::uno::Any& rVal) const
 rVal <<= comphelper::containerToSequence(aRet);
 }
 
+void ClrScheme::fill(svx::ColorSet& rColorSet) const
+{
+for (const auto& [nToken, rColor] : maClrScheme)
+{
+switch (nToken)
+{
+case XML_tx1:
+case XML_dk1: rColorSet.add(0, rColor); break;
+case XML_bg1:
+case XML_lt1: rColorSet.add(1, rColor); break;
+case XML_tx2:
+case XML_dk2: rColorSet.add(2, rColor); break;
+case XML_bg2:
+case XML_lt2: rColorSet.add(3, rColor); break;
+case XML_accent1: rColorSet.add(4, rColor); break;
+case XML_accent2: rColorSet.add(5, rColor); break;
+case XML_accent3: rColorSet.add(6, rColor); break;
+case XML_accent4: rColorSet.add(7, rColor); break;
+case XML_accent5: rColorSet.add(8, rColor); break;
+case XML_accent6: rColorSet.add(9, rColor); break;
+case XML_hlink: rColorSet.add(10, rColor); break;
+case XML_folHlink: rColorSet.add(11, rColor); break;
+default: break;
+}
+}
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx
index f406f829ea91..885d87b1bb0f 100644
--- a/oox/source/drawingml/theme.cxx
+++ b/oox/source/drawingml/theme.cxx
@@ -24,6 +24,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 using namespace com::sun::star;
 
@@ -105,16 +110,21 @@ const TextFont* Theme::resolveFont( std::u16string_view 
rName ) const
 
 void Theme::addTheme(const css::uno::Reference& 
xDrawPage) const
 {
-beans::PropertyValue aColorScheme;
-aColorScheme.Name = "ColorScheme";
-maClrScheme.ToAny(aColorScheme.Value);
-beans::PropertyValues aValues = {
-comphelper::makePropertyValue("Name", maThemeName),
-comphelper::makePropertyValue("ColorSchemeName", 
maClrScheme.GetName()),
-aColorScheme,
-};
-uno::Reference xPropertySet(xDrawPage, 
uno::UNO_QUERY);
-xPropertySet->setPropertyValue("Theme", uno::Any(aValues));
+SAL_WARN_IF(!xDrawPage.is(), "oox", "DrawPage is not set");
+
+SdrPage* pPage = GetSdrPageFromXDrawPage(xDrawPage);
+
+SAL_WARN_IF(!pPage, "oox", "Can't get SdrPage from XDrawPage");
+
+if (!pPage)
+return;
+
+auto pTheme = std::make_unique(maThemeName);
+auto pColorSet = std::make_unique(maClrScheme.GetName());
+maClrScheme.fill(*pColorSet);
+pTheme->SetColorSet(std::move(pColorSet));
+
+pPage->getSdrPageProperties().SetTheme(std::move(pTheme));
 }
 
 } // namespace oox::drawingml


[Libreoffice-commits] core.git: 2 commits - include/svx oox/inc oox/source sd/source svx/source sw/source

2022-12-25 Thread Tomaž Vajngerl (via logerrit)
 include/svx/ColorSets.hxx|   48 ++-
 oox/inc/drawingml/textfont.hxx   |   10 +++---
 oox/source/drawingml/textfont.cxx|   20 
 sd/source/filter/eppt/pptx-epptooxml.cxx |3 +
 sd/source/ui/func/fuconstr.cxx   |2 -
 svx/source/styles/ColorSets.cxx  |   31 +---
 sw/source/uibase/sidebar/ThemePanel.cxx  |7 ++--
 7 files changed, 69 insertions(+), 52 deletions(-)

New commits:
commit 4ee7e71d850315f5ae4c3b763b0e80e8d83a6454
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 12 20:59:59 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 26 07:53:52 2022 +

svx: rename mnPitch to mnPitchFamily, add resolvePitchFamily

Rename mnPitch to mnPitchFamily as it contains both. Extract the
code to resolve what is pitch and what is family into its own
(static) function.

Change-Id: I0c17351ea690a85decefb8d73dd07644ce5c78d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143991
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/oox/inc/drawingml/textfont.hxx b/oox/inc/drawingml/textfont.hxx
index 6bdf13ab890a..231b18cffecb 100644
--- a/oox/inc/drawingml/textfont.hxx
+++ b/oox/inc/drawingml/textfont.hxx
@@ -51,6 +51,8 @@ public:
 sal_Int16& rnFontFamily,
 const ::oox::core::XmlFilterBase& rFilter ) const;
 
+static void resolvePitch(sal_Int32 nOoxPitch, sal_Int16& rnFontPitch, 
sal_Int16& rnFontFamily);
+
 private:
 boolimplGetFontData(
 OUString& rFontName,
@@ -58,10 +60,10 @@ private:
 sal_Int16& rnFontFamily ) const;
 
 private:
-OUString maTypeface;
-OUString maPanose;
-sal_Int32   mnPitch;
-sal_Int32   mnCharset;
+OUString maTypeface;
+OUString maPanose;
+sal_Int32 mnPitchFamily;
+sal_Int32 mnCharset;
 };
 
 
diff --git a/oox/source/drawingml/textfont.cxx 
b/oox/source/drawingml/textfont.cxx
index bcfe516893ee..e5899780ad2c 100644
--- a/oox/source/drawingml/textfont.cxx
+++ b/oox/source/drawingml/textfont.cxx
@@ -48,7 +48,7 @@ sal_Int16 lclGetFontFamily( sal_Int32 nOoxValue )
 } // namespace
 
 TextFont::TextFont() :
-mnPitch( 0 ),
+mnPitchFamily(0),
 mnCharset( WINDOWS_CHARSET_ANSI )
 {
 }
@@ -56,16 +56,16 @@ TextFont::TextFont() :
 void TextFont::setAttributes( const AttributeList& rAttribs )
 {
 maTypeface = rAttribs.getStringDefaulted( XML_typeface);
-maPanose   = rAttribs.getStringDefaulted( XML_panose);
-mnPitch= rAttribs.getInteger( XML_pitchFamily, 0 );
-mnCharset  = rAttribs.getInteger( XML_charset, WINDOWS_CHARSET_DEFAULT );
+maPanose = rAttribs.getStringDefaulted( XML_panose);
+mnPitchFamily = rAttribs.getInteger( XML_pitchFamily, 0 );
+mnCharset = rAttribs.getInteger( XML_charset, WINDOWS_CHARSET_DEFAULT );
 }
 
 void TextFont::setAttributes( const OUString& sFontName )
 {
 maTypeface = sFontName;
 maPanose.clear();
-mnPitch = 0;
+mnPitchFamily = 0;
 mnCharset = WINDOWS_CHARSET_DEFAULT;
 }
 
@@ -86,11 +86,17 @@ bool TextFont::getFontData( OUString& rFontName, sal_Int16& 
rnFontPitch, sal_Int
 bool TextFont::implGetFontData( OUString& rFontName, sal_Int16& rnFontPitch, 
sal_Int16& rnFontFamily ) const
 {
 rFontName = maTypeface;
-rnFontPitch = lclGetFontPitch( extractValue< sal_Int16 >( mnPitch, 0, 4 ) 
);
-rnFontFamily = lclGetFontFamily( extractValue< sal_Int16 >( mnPitch, 4, 4 
) );
+resolvePitch(mnPitchFamily, rnFontPitch, rnFontFamily);
 return !rFontName.isEmpty();
 }
 
+void TextFont::resolvePitch(sal_Int32 nOoxPitchFamily, sal_Int16& rnFontPitch, 
sal_Int16& rnFontFamily)
+{
+rnFontPitch = lclGetFontPitch(extractValue(nOoxPitchFamily, 0, 
4));
+rnFontFamily = lclGetFontFamily(extractValue(nOoxPitchFamily, 
4, 4));
+}
+
+
 } // namespace oox::drawingml
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1386e26b2d7fc5173266ffbfb94bc82b1d3f7bb9
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 12 20:17:09 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 26 07:53:45 2022 +

svx: rename ThemeColorType enum values, use enum instead of index

Change-Id: I81c1553205365c4076562474078b3b0aa834b249
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143990
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 91ac4e1651c7..71f12c2dbe71 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -24,6 +24,32 @@ class SdrPage;
 namespace svx
 {
 
+/// Offsets into the color list of a theme.
+enum class ThemeColorType : sal_Int32
+{
+Unknown = -1,
+Dark1 = 0,
+Light1 = 1,
+Dark2 = 2,
+Light2 = 3,
+Accent1 = 4,
+Accent2 = 5,
+Accent3 = 6,
+Accent4 = 7,
+Accent5 = 8,
+Accent6 = 9,
+

[Libreoffice-commits] core.git: editeng/source include/editeng sw/source

2022-12-25 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/items/textitem.cxx   |   25 +
 include/editeng/colritem.hxx|   26 ++
 sw/source/uibase/sidebar/ThemePanel.cxx |2 +-
 3 files changed, 28 insertions(+), 25 deletions(-)

New commits:
commit 6fb682487e355933d79a8ef74560ecf318b4f705
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 5 13:59:22 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Dec 25 13:25:25 2022 +

editeng: move "tint or shade" variable into SvxThemeColor

Change-Id: Ia2094854a8275082cf7444307e17fe5449c43b3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143698
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 147fa301d548..30b780f1b855 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1354,9 +1354,10 @@ bool SvxContourItem::GetPresentation
 }
 
 SvxThemeColor::SvxThemeColor()
-: maThemeIndex(-1),
-mnLumMod(1),
-mnLumOff(0)
+: maThemeIndex(-1)
+, mnLumMod(1)
+, mnLumOff(0)
+, mnTintOrShade(0)
 {
 }
 
@@ -1364,7 +1365,8 @@ bool SvxThemeColor::operator==(const SvxThemeColor& 
rThemeColor) const
 {
 return maThemeIndex == rThemeColor.maThemeIndex &&
 mnLumMod == rThemeColor.mnLumMod &&
-mnLumOff == rThemeColor.mnLumOff;
+mnLumOff == rThemeColor.mnLumOff &&
+mnTintOrShade  == rThemeColor.mnTintOrShade;
 }
 
 void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) const
@@ -1377,6 +1379,8 @@ void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) 
const
   
BAD_CAST(OString::number(mnLumMod).getStr()));
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("lum-off"),
   
BAD_CAST(OString::number(mnLumOff).getStr()));
+(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("tint-or-shade"),
+  
BAD_CAST(OString::number(mnTintOrShade).getStr()));
 
 (void)xmlTextWriterEndElement(pWriter);
 }
@@ -1384,15 +1388,13 @@ void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 // class SvxColorItem 
 SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
 SfxPoolItem(nId),
-mColor( COL_BLACK ),
-maTintShade(0)
+mColor( COL_BLACK )
 {
 }
 
 SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) :
 SfxPoolItem( nId ),
-mColor( rCol ),
-maTintShade(0)
+mColor( rCol )
 {
 }
 
@@ -1406,8 +1408,7 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) 
const
 const SvxColorItem& rColorItem = static_cast(rAttr);
 
 return mColor == rColorItem.mColor &&
-   maThemeColor == rColorItem.maThemeColor &&
-   maTintShade == rColorItem.maTintShade;
+   maThemeColor == rColorItem.maThemeColor;
 }
 
 bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -1433,7 +1434,7 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
 }
 case MID_COLOR_TINT_OR_SHADE:
 {
-rVal <<= maTintShade;
+rVal <<= maThemeColor.GetTintOrShade();
 break;
 }
 case MID_COLOR_LUM_MOD:
@@ -1489,7 +1490,7 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
 sal_Int16 nTintShade = -1;
 if (!(rVal >>= nTintShade))
 return false;
-maTintShade = nTintShade;
+maThemeColor.SetTintOrShade(nTintShade);
 }
 break;
 case MID_COLOR_LUM_MOD:
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx
index cbd52844b059..05a7183c8582 100644
--- a/include/editeng/colritem.hxx
+++ b/include/editeng/colritem.hxx
@@ -34,6 +34,8 @@ class EDITENG_DLLPUBLIC SvxThemeColor
 /// Luminance Offset: 100th percentage, defaults to 0%.
 sal_Int16 mnLumOff;
 
+sal_Int16 mnTintOrShade;
+
 public:
 explicit SvxThemeColor();
 bool operator==(const SvxThemeColor& rThemeColor) const;
@@ -46,8 +48,8 @@ public:
 void SetThemeIndex(sal_Int16 nIndex)
 {
 maThemeIndex = nIndex;
-}
 
+}
 void SetLumMod(sal_Int16 nLumMod) { mnLumMod = nLumMod; }
 
 sal_Int16 GetLumMod() const { return mnLumMod; }
@@ -56,6 +58,16 @@ public:
 
 sal_Int16 GetLumOff() const { return mnLumOff; }
 
+sal_Int16 GetTintOrShade() const
+{
+return mnTintOrShade;
+}
+
+void SetTintOrShade(sal_Int16 nTintOrShade)
+{
+mnTintOrShade = nTintOrShade;
+}
+
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
@@ -66,7 +78,7 @@ class EDITENG_DLLPUBLIC SvxColorItem final : public 
SfxPoolItem
 private:
 Color mColor;
 SvxThemeColor maThemeColor;
-sal_Int16 maTintShade;
+
 
 public:
 static SfxPoolItem* CreateDefault();
@@ -93,16 +105,6 @@ public:
  

[Libreoffice-commits] core.git: include/editeng sw/CppunitTest_sw_core_theme.mk sw/Module_sw.mk sw/qa sw/source writerfilter/source xmloff/inc xmloff/source

2022-12-24 Thread Tomaž Vajngerl (via logerrit)
 include/editeng/unoprnms.hxx  |2 
 sw/CppunitTest_sw_core_theme.mk   |   62 ++
 sw/Module_sw.mk   |1 
 sw/qa/core/theme/ThemeTest.cxx|   35 ++
 sw/qa/core/theme/data/ThemeColorInHeading.docx|binary
 sw/source/core/unocore/unomap.cxx |4 -
 sw/source/core/unocore/unomap1.cxx|6 +
 sw/source/core/unocore/unomapproperties.hxx   |6 +
 sw/source/uibase/sidebar/ThemePanel.cxx   |   29 ++--
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |   14 ++--
 writerfilter/source/dmapper/DomainMapper.cxx  |   16 
 writerfilter/source/dmapper/PropertyIds.cxx   |2 
 writerfilter/source/dmapper/PropertyIds.hxx   |2 
 writerfilter/source/dmapper/TDefTableHandler.cxx  |   44 
 writerfilter/source/dmapper/TDefTableHandler.hxx  |1 
 xmloff/inc/XMLThemeColorHandler.hxx   |   49 ++
 xmloff/inc/enummaps.hxx   |2 
 xmloff/source/draw/sdpropls.cxx   |3 
 xmloff/source/text/txtprhdl.cxx   |6 +
 19 files changed, 254 insertions(+), 30 deletions(-)

New commits:
commit df9f3f3fd81d4f81ee2ff984d1e1abea2963
Author: Tomaž Vajngerl 
AuthorDate: Sun Sep 20 19:27:09 2015 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sun Dec 25 02:06:58 2022 +

sw: support for reading back theme color from OOXML

OOXML supports theme colors and tint/shade value that additionally
changed the theme color. Read back which theme color + tint/shade
value was applied in the resulting color and add this attributes
as properties to be used by writer.
In sidebar theme panel the changing the theme colors now doesn't
takes this into account and changes the colors correctly.

Change-Id: I3a2d49d485fd37a1611483ee0bb5e6034ac5f88e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143697
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index 0df739ee5285..8569a3370464 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -21,6 +21,8 @@
 #include 
 
 inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR = u"CharColor";
+inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR_THEME = u"CharColorTheme";
+inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR_TINT_OR_SHADE = 
u"CharColorTintOrShade";
 inline constexpr OUStringLiteral UNO_NAME_CHAR_HEIGHT = u"CharHeight";
 inline constexpr OUStringLiteral UNO_NAME_CHAR_POSTURE = u"CharPosture";
 inline constexpr OUStringLiteral UNO_NAME_CHAR_SHADOWED = u"CharShadowed";
diff --git a/sw/CppunitTest_sw_core_theme.mk b/sw/CppunitTest_sw_core_theme.mk
new file mode 100644
index ..84b462ea8245
--- /dev/null
+++ b/sw/CppunitTest_sw_core_theme.mk
@@ -0,0 +1,62 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_core_theme))
+
+$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_core_theme))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_core_theme, \
+sw/qa/core/theme/ThemeTest \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_core_theme, \
+comphelper \
+cppu \
+cppuhelper \
+sal \
+sfx \
+subsequenttest \
+sw \
+swqahelper \
+test \
+unotest \
+utl \
+vcl \
+svt \
+tl \
+svl \
+svxcore \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_core_theme,\
+boost_headers \
+libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_core_theme,\
+-I$(SRCDIR)/sw/inc \
+-I$(SRCDIR)/sw/source/core/inc \
+-I$(SRCDIR)/sw/source/uibase/inc \
+-I$(SRCDIR)/sw/qa/inc \
+$$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sw_core_theme,\
+udkapi \
+offapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_core_theme))
+$(eval $(call gb_CppunitTest_use_vcl,sw_core_theme))
+$(eval $(call gb_CppunitTest_use_rdb,sw_core_theme,services))
+$(eval $(call gb_CppunitTest_use_configuration,sw_core_theme))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 8a217a85fbf6..a15763330763 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -154,6 +154,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
 CppunitTest_sw_filter_ww8 \
 CppunitTest_sw_filter_html \
 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 2 commits - sw/inc sw/source

2022-12-24 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |3 ++
 sw/inc/node.hxx |3 ++
 sw/source/core/access/AccessibilityCheck.cxx|   12 +++-
 sw/source/core/docnode/node.cxx |   16 +++
 sw/source/core/inc/AccessibilityCheck.hxx   |1 
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   28 ++--
 sw/source/core/txtnode/ndtxt.cxx|9 ++
 7 files changed, 69 insertions(+), 3 deletions(-)

New commits:
commit fd56017db598ae7a9a955414cfed07e11014b56c
Author: Tomaž Vajngerl 
AuthorDate: Sun Nov 13 22:21:29 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat Dec 24 12:16:57 2022 +

sw: handle joining and splitting nodes for online a11y check

Change-Id: I706bf56209beebbe2987bce436536c3d9ade51f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142655
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 5e9ba2e6bc08493b10268abdec0c22c1d7c307f6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144497
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 3d68a71f11db..5e1da9b77c99 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -66,6 +66,7 @@ private:
 public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
 void update(SwPosition const& rNewPos);
+void resetAndQueue(SwNode* pNode);
 sal_Int32 getNumberOfAccessibilityIssues() { return 
m_nAccessibilityIssues; }
 };
 
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 8099178c1eaf..a3b9e13ad52d 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -86,6 +86,7 @@ namespace sw
 struct AccessibilityCheckStatus
 {
 std::unique_ptr pCollection;
+void reset();
 };
 
 }
@@ -324,6 +325,8 @@ public:
 return m_aAccessibilityCheckStatus;
 }
 
+void resetAndQueueAccessibilityCheck();
+
 private:
 SwNode( const SwNode & rNodes ) = delete;
 SwNode & operator= ( const SwNode & rNodes ) = delete;
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 8a319c03e7aa..a1a549d25069 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -69,12 +69,22 @@
 #include 
 #include 
 #include 
+#include 
 #ifdef DBG_UTIL
 #include 
 #endif
 
 using namespace ::com::sun::star::i18n;
 
+namespace sw
+{
+
+void AccessibilityCheckStatus::reset()
+{
+pCollection.reset();
+}
+
+}
 
 /*
  * Some local helper functions for the attribute set handle of a content node.
@@ -2142,4 +2152,10 @@ void SwNode::RemoveAnchoredFly(SwFrameFormat *const 
pFlyFormat)
 m_aAnchoredFlys.erase(it);
 }
 
+void SwNode::resetAndQueueAccessibilityCheck()
+{
+GetDoc().getOnlineAccessibilityCheck()->resetAndQueue(this);
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index 1188bc7d06c5..d162e1a661ba 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -263,8 +263,7 @@ void 
OnlineAccessibilityCheck::clearAccessibilityIssuesFromAllNodes()
 SwNode* pNode = pNodes[n];
 if (pNode)
 {
-auto& rStatus = pNode->getAccessibilityCheckStatus();
-rStatus.pCollection.reset();
+pNode->getAccessibilityCheckStatus().reset();
 }
 }
 
@@ -272,6 +271,20 @@ void 
OnlineAccessibilityCheck::clearAccessibilityIssuesFromAllNodes()
 updateStatusbar();
 }
 
+void OnlineAccessibilityCheck::resetAndQueue(SwNode* pNode)
+{
+bool bOnlineCheckStatus
+= 
officecfg::Office::Common::Accessibility::OnlineAccessibilityCheck::get();
+if (!bOnlineCheckStatus)
+return;
+
+pNode->getAccessibilityCheckStatus().reset();
+m_aNodes.erase(pNode);
+runAccessibilityCheck(pNode);
+updateNodeStatus(pNode);
+updateStatusbar();
+}
+
 } // end sw
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 8eeb9b6cdf59..b3880c24fcc2 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -481,6 +481,9 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & 
rPos,
 }
 SetSmartTagDirty( true );
 
+resetAndQueueAccessibilityCheck();
+pNode->resetAndQueueAccessibilityCheck();
+
 if ( pNode->HasHints() )
 {
 if ( pNode->m_pSwpHints->CanBeDeleted() )
@@ -618,6 +621,9 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & 
rPos,
 SetSmartTags( std::move(pList2) );
 }
 
+resetAndQueueAccessibilityCheck();
+pNode->resetAndQueueAccessibilityCheck();
+
 if (pContentIndexRestore)
 {   // 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/sfx2 officecfg/registry svx/sdi sw/inc sw/sdi sw/source sw/uiconfig

2022-12-24 Thread Tomaž Vajngerl (via logerrit)
 include/sfx2/sfxsids.hrc |   14 +--
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |   14 +++
 svx/sdi/svx.sdi  |   18 

 sw/inc/OnlineAccessibilityCheck.hxx  |5 -
 sw/inc/node.hxx  |1 
 sw/sdi/_viewsh.sdi   |   11 ++
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx  |   42 
+-
 sw/source/uibase/uiview/view0.cxx|   24 
+
 sw/uiconfig/sglobal/menubar/menubar.xml  |1 
 sw/uiconfig/swriter/menubar/menubar.xml  |1 
 10 files changed, 119 insertions(+), 12 deletions(-)

New commits:
commit a71007c075e834cd5ac741cbbc9607ab8e1d877c
Author: Tomaž Vajngerl 
AuthorDate: Fri Oct 28 22:11:59 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sat Dec 24 12:16:26 2022 +

sw: add a menu option to enable/disable online a11y check

Change-Id: I656037ef4e40e7c79daef5dd73f8f10c9818ac25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142215
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 00128f14c400b661444676410b2088aca357291c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144495

diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 1937368ba2b9..d202087d95e5 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -443,15 +443,15 @@ class SvxSearchItem;
 #define SID_PASTE_ONLY_FORMULA  (SID_SFX_START + 803)
 #define SID_PASTE_ONLY_VALUE(SID_SFX_START + 804)
 #define SID_PASTE_TEXTIMPORT_DIALOG (SID_SFX_START + 805)
-#define SID_PASTE_TRANSPOSED(SID_SFX_START + 812)
-#define SID_PASTE_AS_LINK   (SID_SFX_START + 813)
+#define SID_PASTE_TRANSPOSED(SID_SFX_START + 808)
+#define SID_PASTE_AS_LINK   (SID_SFX_START + 809)
 
 // Used for redaction
-#define SID_SHAPE_NAME  (SID_SFX_START + 808)
-// FREE: SID_SFX_START + 809
-#define SID_GRAPHIC_SIZE_CHECK  (SID_SFX_START + 809)
-#define SID_ACCESSIBILITY_CHECK (SID_SFX_START + 810)
-#define SID_ASYNCHRON   (SID_SFX_START + 811)
+#define SID_SHAPE_NAME  (SID_SFX_START + 810)
+#define SID_GRAPHIC_SIZE_CHECK  (SID_SFX_START + 811)
+#define SID_ACCESSIBILITY_CHECK (SID_SFX_START + 812)
+#define SID_ASYNCHRON   (SID_SFX_START + 813)
+#define SID_ACCESSIBILITY_CHECK_ONLINE  (SID_SFX_START + 814)
 
 // default-ids for configuration
 #define SID_CONFIG  (SID_SFX_START + 904)
diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 0b1212292b13..f25abc61048e 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -4991,6 +4991,20 @@ bit 3 (0x8): #define 
UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
   9
 
   
+  
+
+  Automatic Accessibility Checking
+
+
+  Automatic A~ccessibility Checking
+
+
+  Toggle Automatic Accessibility 
Checking
+
+
+  1
+
+  
   
 
   Do Not Mark Errors
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index ac886aaa0cd4..42a43e3fa1ea 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -12476,6 +12476,24 @@ SfxVoidItem AccessibilityCheck SID_ACCESSIBILITY_CHECK
 GroupId = SfxGroupId::Modify;
 ]
 
+SfxBoolItem AccessibilityCheckOnline SID_ACCESSIBILITY_CHECK_ONLINE
+(SfxBoolItem Enable FN_PARAM_1)
+[
+AutoUpdate = TRUE,
+FastCall = FALSE,
+ReadOnlyDoc = TRUE,
+Toggle = TRUE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+
+
+AccelConfig = TRUE,
+MenuConfig = TRUE,
+ToolBoxConfig = TRUE,
+GroupId = SfxGroupId::Options;
+]
+
 XColorItem GlowColor SID_ATTR_GLOW_COLOR
 
 [
diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 7a37f05cc432..fe4652949d64 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -52,15 +52,18 @@ private:
 SwNodeOffset m_nPreviousNodeIndex;
 sal_Int32 m_nAccessibilityIssues;
 bool m_bInitialCheck;
+bool m_bOnlineCheckStatus;
 
 void runAccessibilityCheck(SwNode* pNode);
 void updateStatusbar();
 void updateNodeStatus(SwNode* pContentNode);
 void initialCheck();
+void lookForPreviousNodeAndUpdate(SwPosition const& rNewPos);
+void 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/inc sw/sdi sw/source sw/uiconfig

2022-12-24 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/strings.hrc   |1 
 sw/sdi/swriter.sdi   |2 
 sw/source/uibase/inc/AccessibilityStatusBarControl.hxx   |7 +-
 sw/source/uibase/uiview/view2.cxx|   16 +
 sw/source/uibase/utlui/AccessibilityStatusBarControl.cxx |   45 +--
 sw/uiconfig/sglobal/statusbar/statusbar.xml  |2 
 sw/uiconfig/swriter/statusbar/statusbar.xml  |2 
 7 files changed, 53 insertions(+), 22 deletions(-)

New commits:
commit de9320f7fc86c1421ff59eb218a04c6c90049c39
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 26 22:02:44 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sat Dec 24 12:15:51 2022 +

sw: improve a11y check statusbar

Change-Id: I86f589d6618ae80f26542cf83b6b5e3695ca35f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142193
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit e96dd14288172187372b3a4f82de870b1d660020)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144494
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 5748ba7122ff..b4b03968a1eb 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1087,6 +1087,7 @@
 #define STR_BOOKCTRL_HINT   NC_("STR_BOOKCTRL_HINT", "Page 
number in document. Click to open Go to Page dialog or right-click for bookmark 
list.")
 #define STR_BOOKCTRL_HINT_EXTENDED  
NC_("STR_BOOKCTRL_HINT_EXTENDED", "Page number in document (Page number on 
printed document). Click to open Go to Page dialog.")
 #define STR_TMPLCTRL_HINT   NC_("STR_TMPLCTRL_HINT", "Page 
Style. Right-click to change style or click to open Style dialog.")
+#define STR_ACCESSIBILITY_CHECK_HINT
NC_("STR_ACCESSIBILITY_CHECK_HINT", "Status of the accessibility check.")
 
 // Strings for textual attributes.
 #define STR_DROP_OVER   NC_("STR_DROP_OVER", "Drop 
Caps over")
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index f001b70ebb90..bc58977788a4 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -5970,7 +5970,7 @@ SfxStringItem StateWordCount FN_STAT_WORDCOUNT
 GroupId = SfxGroupId::View;
 ]
 
-SfxStringItem StateAccessibilityCheck FN_STAT_ACCESSIBILITY_CHECK
+SfxInt32Item StateAccessibilityCheck FN_STAT_ACCESSIBILITY_CHECK
 
 [
 AutoUpdate = FALSE,
diff --git a/sw/source/uibase/inc/AccessibilityStatusBarControl.hxx 
b/sw/source/uibase/inc/AccessibilityStatusBarControl.hxx
index 52e64b99f5ac..63744499d083 100644
--- a/sw/source/uibase/inc/AccessibilityStatusBarControl.hxx
+++ b/sw/source/uibase/inc/AccessibilityStatusBarControl.hxx
@@ -15,14 +15,17 @@ namespace sw
 {
 class AccessibilityStatusBarControl final : public SfxStatusBarControl
 {
+sal_Int32 mnIssues;
+
 public:
 SFX_DECL_STATUSBAR_CONTROL();
 
 AccessibilityStatusBarControl(sal_uInt16 nSlotId, sal_uInt16 nId, 
StatusBar& rStb);
 virtual ~AccessibilityStatusBarControl() override;
 
-virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState 
eState,
-const SfxPoolItem* pState) 
override;
+void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState,
+const SfxPoolItem* pState) override;
+void Paint(const UserDrawEvent& rEvent) override;
 };
 
 } // end sw
diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index 3472bf63ef0e..a5cdc27fd059 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1614,19 +1614,11 @@ void SwView::StateStatusLine(SfxItemSet )
 break;
 case FN_STAT_ACCESSIBILITY_CHECK:
 {
-if (rShell.GetDoc()->getOnlineAccessibilityCheck())
+std::unique_ptr const& 
rOnlineAccessibilityCheck = rShell.GetDoc()->getOnlineAccessibilityCheck();
+if (rOnlineAccessibilityCheck)
 {
-auto nIssues = 
rShell.GetDoc()->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues();
-OUString aString;
-if (nIssues > 0)
-{
-aString = u"Issues: " + OUString::number(nIssues);
-}
-else
-{
-aString = u"No Issues";
-}
-rSet.Put(SfxStringItem(FN_STAT_ACCESSIBILITY_CHECK, 
aString));
+sal_Int32 nIssues = 
rOnlineAccessibilityCheck->getNumberOfAccessibilityIssues();
+rSet.Put(SfxInt32Item(FN_STAT_ACCESSIBILITY_CHECK, 
nIssues));
 }
 }
 break;
diff --git a/sw/source/uibase/utlui/AccessibilityStatusBarControl.cxx 
b/sw/source/uibase/utlui/AccessibilityStatusBarControl.cxx
index 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 2 commits - sw/inc sw/source

2022-12-20 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |   22 +++--
 sw/inc/node.hxx |   38 -
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   80 ++--
 3 files changed, 87 insertions(+), 53 deletions(-)

New commits:
commit 0ba2610a19b032dfad7e1d7fda8350ed95832956
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 24 23:42:44 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed Dec 21 07:11:06 2022 +

sw: Change online a11y checker again from SwContentNode to SwNode

This is needed because SwTableNode is not a content node, so we
need to work with the most generic SwNode and ask if the node
derives from sw::BroadcastingModify, which is required for node
tracking (SwTableNode and SwContentNode support that).

Change-Id: Idc28a5a9f1f8a250e2a28bb955ed320d02b6c1b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141787
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 1dfb746b8ca5d5d4ef21feb67d3921ab342d782f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144473
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 47e42a27de29..7a37f05cc432 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -22,40 +22,40 @@ class SwTextNode;
 
 namespace sw
 {
-/// Contains the content node and tracks if the node
-/// gets deleted.
+/// Contains the node and tracks if the node gets deleted.
+/// Note: the node needs to extend sw::BroadcastingModify.
 class WeakContentNodeContainer : public SvtListener
 {
 private:
-SwContentNode* m_pNode;
+SwNode* m_pNode;
 
 public:
-WeakContentNodeContainer(SwContentNode* pNode);
+WeakContentNodeContainer(SwNode* pNode);
 ~WeakContentNodeContainer();
 
 /// Is the node still alive or it was deleted?
 bool isAlive();
 
-/// Returns the pointer of the content node or nullptr if the node
+/// Returns the pointer of the node or nullptr if the node
 /// got deleted.
-SwContentNode* getNode();
+SwNode* getNode();
 };
 
 class OnlineAccessibilityCheck : public SvtListener
 {
 private:
-std::map> 
m_aNodes;
+std::map> m_aNodes;
 
 SwDoc& m_rDocument;
 sw::AccessibilityCheck m_aAccessibilityCheck;
-SwContentNode* m_pPreviousNode;
+SwNode* m_pPreviousNode;
 SwNodeOffset m_nPreviousNodeIndex;
 sal_Int32 m_nAccessibilityIssues;
 bool m_bInitialCheck;
 
-void runAccessibilityCheck(SwContentNode* pNode);
+void runAccessibilityCheck(SwNode* pNode);
 void updateStatusbar();
-void updateNodeStatus(SwContentNode* pContentNode);
+void updateNodeStatus(SwNode* pContentNode);
 void initialCheck();
 
 public:
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index eae16fe70550..ef423ba3678b 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -79,6 +79,18 @@ namespace drawinglayer::attribute {
 typedef std::shared_ptr< SdrAllFillAttributesHelper > 
SdrAllFillAttributesHelperPtr;
 }
 
+// Accessibiity check
+
+namespace sw
+{
+struct AccessibilityCheckStatus
+{
+std::unique_ptr pCollection;
+bool bDirty = true;
+};
+
+}
+
 /// Base class of the Writer document model elements.
 class SW_DLLPUBLIC SwNode
 : public sw::BorderCacheOwner, private BigPtrEntry
@@ -91,6 +103,8 @@ class SW_DLLPUBLIC SwNode
 sal_uInt8 m_nAFormatNumLvl : 3;
 bool m_bIgnoreDontExpand : 1; ///< for Text Attributes - ignore the 
flag
 
+mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus;
+
 public:
 /// sw_redlinehide: redline node merge state
 enum class Merge { None, First, NonFirst, Hidden };
@@ -306,6 +320,11 @@ public:
  */
 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
 
+sw::AccessibilityCheckStatus& getAccessibilityCheckStatus()
+{
+return m_aAccessibilityCheckStatus;
+}
+
 private:
 SwNode( const SwNode & rNodes ) = delete;
 SwNode & operator= ( const SwNode & rNodes ) = delete;
@@ -357,18 +376,6 @@ class SwEndNode final : public SwNode
 SwEndNode & operator= ( const SwEndNode & rNode ) = delete;
 };
 
-// Accessibiity check
-
-namespace sw
-{
-struct AccessibilityCheckStatus
-{
-std::unique_ptr pCollection;
-bool bDirty = true;
-};
-
-}
-
 // SwContentNode
 
 class SW_DLLPUBLIC SwContentNode: public sw::BroadcastingModify, public 
SwNode, public SwIndexReg
@@ -378,8 +385,6 @@ class SW_DLLPUBLIC SwContentNode: public 
sw::BroadcastingModify, public SwNode,
 SwFormatColl* m_pCondColl;
 mutable bool mbSetModifyAtAttr;
 
-mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus;
-
 protected:
 SwContentNode( const SwNodeIndex , const SwNodeType nNodeType,
 SwFormatColl *pFormatColl );
@@ -496,11 +501,6 @@ public:
 
 void UpdateAttr(const SwUpdateAttr&);
 
-sw::AccessibilityCheckStatus& 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source

2022-12-20 Thread Tomaž Vajngerl (via logerrit)
 sw/source/uibase/uiview/view0.cxx |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 3939a61203065ab5689efbddf578bae0d3c8aa80
Author: Tomaž Vajngerl 
AuthorDate: Fri Dec 16 14:23:13 2022 +0900
Commit: Miklos Vajna 
CommitDate: Tue Dec 20 08:04:09 2022 +

Online accessibility check is experimental for now

Change-Id: Ib5556c83f1c235cfed16c441b1eac93df80f8c4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144285
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/uibase/uiview/view0.cxx 
b/sw/source/uibase/uiview/view0.cxx
index 3f05a607c984..5bd6a5b1024b 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -331,8 +332,17 @@ void SwView::StateViewOptions(SfxItemSet )
 break;
 case SID_ACCESSIBILITY_CHECK_ONLINE:
 {
-bool bOnlineAccessibilityCheck = 
officecfg::Office::Common::Accessibility::OnlineAccessibilityCheck::get();
-aBool.SetValue(bOnlineAccessibilityCheck);
+// visible only when experimental mode is enabled
+if (!officecfg::Office::Common::Misc::ExperimentalMode::get())
+{
+rSet.Put(SfxVisibilityItem(nWhich, false));
+nWhich = 0;
+}
+else
+{
+bool bOnlineAccessibilityCheck = 
officecfg::Office::Common::Accessibility::OnlineAccessibilityCheck::get();
+aBool.SetValue(bOnlineAccessibilityCheck);
+}
 }
 break;
 case FN_SHADOWCURSOR:


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/inc sw/source

2022-12-13 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |   24 +
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   89 +++-
 2 files changed, 94 insertions(+), 19 deletions(-)

New commits:
commit c7db08cc6741d7d0edb0c9956b47dcab964caea4
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 24 22:19:06 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 13 09:12:08 2022 +

sw: track content node with a11y issues, so the number is correct

Track all content node with a11y issues and handle when they are
deleted (with WeakContentNodeContainer). At update, recount the
number of a11y issues that are contained in the content nodes and
update the overall number.

Change-Id: I254c62aba0d73a365f011b1609bcddec4dd71615
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141785
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit ca03ea5c1ce7f1fa0702c004068a2592a723e669)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143704
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 48a639b9d656..9ec6f28ba6b1 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -15,15 +15,37 @@
 #include 
 #include 
 #include 
+#include 
 
 struct SwPosition;
 class SwTextNode;
 
 namespace sw
 {
+/// Contains the content node and tracks if the node
+/// gets deleted.
+class WeakContentNodeContainer : public SvtListener
+{
+private:
+SwContentNode* m_pNode;
+
+public:
+WeakContentNodeContainer(SwContentNode* pNode);
+~WeakContentNodeContainer();
+
+/// Is the node still alive or it was deleted?
+bool isAlive();
+
+/// Returns the pointer of the content node or nullptr if the node
+/// got deleted.
+SwContentNode* getNode();
+};
+
 class OnlineAccessibilityCheck : public SvtListener
 {
 private:
+std::map> 
m_aNodes;
+
 SwDoc& m_rDocument;
 sw::AccessibilityCheck m_aAccessibilityCheck;
 SwContentNode* m_pPreviousNode;
@@ -31,6 +53,8 @@ private:
 sal_Int32 m_nAccessibilityIssues;
 
 void runCheck(SwContentNode* pNode);
+void updateStatusbar();
+void updateNodeStatus(SwContentNode* pContentNode);
 
 public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index e34738466d99..a2a9783c3fd1 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -29,6 +29,32 @@
 
 namespace sw
 {
+WeakContentNodeContainer::WeakContentNodeContainer(SwContentNode* pNode)
+: m_pNode(pNode)
+{
+if (m_pNode)
+{
+EndListeningAll();
+StartListening(m_pNode->GetNotifier());
+}
+}
+
+WeakContentNodeContainer::~WeakContentNodeContainer() { EndListeningAll(); }
+
+bool WeakContentNodeContainer::isAlive()
+{
+if (!HasBroadcaster())
+m_pNode = nullptr;
+return m_pNode;
+}
+
+SwContentNode* WeakContentNodeContainer::getNode()
+{
+if (isAlive())
+return m_pNode;
+return nullptr;
+}
+
 OnlineAccessibilityCheck::OnlineAccessibilityCheck(SwDoc& rDocument)
 : m_rDocument(rDocument)
 , m_aAccessibilityCheck(_rDocument)
@@ -38,6 +64,48 @@ OnlineAccessibilityCheck::OnlineAccessibilityCheck(SwDoc& 
rDocument)
 {
 }
 
+void OnlineAccessibilityCheck::updateNodeStatus(SwContentNode* pContentNode)
+{
+m_nAccessibilityIssues = 0;
+
+auto it = m_aNodes.find(pContentNode);
+if (it == m_aNodes.end())
+{
+m_aNodes.emplace(pContentNode, 
std::make_unique(pContentNode));
+}
+
+for (auto iterator = m_aNodes.begin(); iterator != m_aNodes.end();)
+{
+auto& pWeakContentNode = iterator->second;
+if (pWeakContentNode->isAlive())
+{
+auto& rStatus = 
pWeakContentNode->getNode()->getAccessibilityCheckStatus();
+if (rStatus.pCollection)
+{
+m_nAccessibilityIssues += 
rStatus.pCollection->getIssues().size();
+++iterator;
+}
+else
+{
+iterator = m_aNodes.erase(iterator);
+}
+}
+else
+{
+iterator = m_aNodes.erase(iterator);
+}
+}
+}
+
+void OnlineAccessibilityCheck::updateStatusbar()
+{
+SfxBindings* pBindings = m_rDocument.GetDocShell() && 
m_rDocument.GetDocShell()->GetDispatcher()
+ ? 
m_rDocument.GetDocShell()->GetDispatcher()->GetBindings()
+ : nullptr;
+if (pBindings)
+pBindings->Invalidate(FN_STAT_ACCESSIBILITY_CHECK);
+}
+
 void OnlineAccessibilityCheck::runCheck(SwContentNode* pContentNode)
 {
 m_aAccessibilityCheck.getIssueCollection().clear();
@@ -56,25 +124,8 @@ void OnlineAccessibilityCheck::runCheck(SwContentNode* 
pContentNode)

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 2 commits - sw/inc sw/Library_sw.mk sw/sdi sw/source sw/uiconfig

2022-12-12 Thread Tomaž Vajngerl (via logerrit)
 sw/Library_sw.mk |1 
 sw/inc/OnlineAccessibilityCheck.hxx  |6 
 sw/inc/cmdid.h   |1 
 sw/inc/ndtxt.hxx |   13 --
 sw/inc/node.hxx  |   21 +++
 sw/sdi/_viewsh.sdi   |6 
 sw/sdi/swriter.sdi   |   17 ++
 sw/sdi/viewsh.sdi|6 
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx  |   95 +--
 sw/source/uibase/app/swmodule.cxx|2 
 sw/source/uibase/inc/AccessibilityStatusBarControl.hxx   |   30 
 sw/source/uibase/uiview/view2.cxx|   19 +++
 sw/source/uibase/utlui/AccessibilityStatusBarControl.cxx |   46 +++
 sw/uiconfig/sglobal/statusbar/statusbar.xml  |1 
 sw/uiconfig/swriter/statusbar/statusbar.xml  |1 
 15 files changed, 209 insertions(+), 56 deletions(-)

New commits:
commit 160381ff036585b7f57c4f01ba482f1d2e128d33
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 24 09:46:43 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 12 14:15:51 2022 +

sw: Run a11y check for all content nodes

Change-Id: Icc3ff1be31a01b22242c48dec6d830e645ecb310
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141784
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit fad326833699293e5f4e3254881cb56889a220c0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143703
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index f27f867ce96b..48a639b9d656 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -26,11 +26,11 @@ class OnlineAccessibilityCheck : public SvtListener
 private:
 SwDoc& m_rDocument;
 sw::AccessibilityCheck m_aAccessibilityCheck;
-SwTextNode* m_pCurrentTextNode;
-SwNodeOffset m_aCurrentNodeIndex;
+SwContentNode* m_pPreviousNode;
+SwNodeOffset m_nPreviousNodeIndex;
 sal_Int32 m_nAccessibilityIssues;
 
-void runCheck(SwTextNode* pTextNode);
+void runCheck(SwContentNode* pNode);
 
 public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 22c84d38c641..1ed4cff26f7c 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -34,7 +34,6 @@
 #include 
 #include 
 #include 
-#include 
 
 class SfxHint;
 class SwNumRule;
@@ -96,12 +95,6 @@ struct ParagraphIdleData
 bool bAutoComplDirty = true;   ///< auto complete list dirty
 };
 
-struct AccessibilityCheckStatus
-{
-std::unique_ptr pCollection;
-bool bDirty = true;
-};
-
 } // end namespace sw
 
 /// SwTextNode is a paragraph in the document model.
@@ -127,7 +120,6 @@ class SW_DLLPUBLIC SwTextNode final
 OUString m_Text;
 
 mutable sw::ParagraphIdleData m_aParagraphIdleData;
-mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus;
 
 /** Some of the chars this para are hidden. Paragraph has to be reformatted
on changing the view to print preview. */
@@ -233,11 +225,6 @@ public:
 
 /// End: Data collected during idle time
 
-sw::AccessibilityCheckStatus& getAccessibilityCheckStatus()
-{
-return m_aAccessibilityCheckStatus;
-}
-
 public:
 using SwContentNode::GetAttr;
 /// for hanging TextFormatCollections somewhere else (Outline-Numbering!)
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index bdcc9c801a49..eae16fe70550 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -30,6 +30,8 @@
 #include "fmtcol.hxx"
 #include "nodeoffset.hxx"
 
+#include 
+
 #include 
 #include 
 
@@ -355,6 +357,18 @@ class SwEndNode final : public SwNode
 SwEndNode & operator= ( const SwEndNode & rNode ) = delete;
 };
 
+// Accessibiity check
+
+namespace sw
+{
+struct AccessibilityCheckStatus
+{
+std::unique_ptr pCollection;
+bool bDirty = true;
+};
+
+}
+
 // SwContentNode
 
 class SW_DLLPUBLIC SwContentNode: public sw::BroadcastingModify, public 
SwNode, public SwIndexReg
@@ -364,6 +378,8 @@ class SW_DLLPUBLIC SwContentNode: public 
sw::BroadcastingModify, public SwNode,
 SwFormatColl* m_pCondColl;
 mutable bool mbSetModifyAtAttr;
 
+mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus;
+
 protected:
 SwContentNode( const SwNodeIndex , const SwNodeType nNodeType,
 SwFormatColl *pFormatColl );
@@ -480,6 +496,11 @@ public:
 
 void UpdateAttr(const SwUpdateAttr&);
 
+sw::AccessibilityCheckStatus& getAccessibilityCheckStatus()
+{
+return m_aAccessibilityCheckStatus;
+}
+
 private:
 SwContentNode( const SwContentNode & rNode ) = delete;
 SwContentNode & operator= ( const SwContentNode & rNode ) = delete;
diff --git 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/sfx2 officecfg/registry sfx2/source sw/inc sw/Library_sw.mk sw/source

2022-12-12 Thread Tomaž Vajngerl (via logerrit)
 include/sfx2/AccessibilityIssue.hxx|2 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   10 +
 sfx2/source/accessibility/AccessibilityIssue.cxx   |2 
 sw/Library_sw.mk   |1 
 sw/inc/OnlineAccessibilityCheck.hxx|   43 
 sw/inc/doc.hxx |6 
 sw/inc/ndtxt.hxx   |   12 +
 sw/inc/pam.hxx |3 
 sw/source/core/crsr/crsrsh.cxx |4 
 sw/source/core/doc/docnew.cxx  |4 
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx|  124 +
 11 files changed, 210 insertions(+), 1 deletion(-)

New commits:
commit 9bcaf349091e4d97e7c6ca183c13736636d25612
Author: Tomaž Vajngerl 
AuthorDate: Thu Oct 20 22:33:22 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 12 14:15:05 2022 +

sw: add online accessibility check implementation

Change-Id: Ic68aa91b1cbf23ac305ad4e361c56b91556757ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141604
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 0b96a1747fc3f96ca70fd159594fe1a478369da0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143701
Tested-by: Jenkins CollaboraOffice 

diff --git a/include/sfx2/AccessibilityIssue.hxx 
b/include/sfx2/AccessibilityIssue.hxx
index 82e6c49f2941..8cc2839229cb 100644
--- a/include/sfx2/AccessibilityIssue.hxx
+++ b/include/sfx2/AccessibilityIssue.hxx
@@ -60,6 +60,8 @@ public:
 AccessibilityIssueCollection() = default;
 
 std::vector>& getIssues();
+
+void clear();
 };
 
 } // end sfx namespace
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 4f615a4ef69b..24bcdefda38f 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6535,6 +6535,16 @@
  
  false

+   
+
+  
+Enables online accessibility check, which checks for accessibility 
issues inside the document structure
+while the user edits the document.
+  
+  Enable/Disable online accessibility check.
+ 
+ false
+   
 
 
   
diff --git a/sfx2/source/accessibility/AccessibilityIssue.cxx 
b/sfx2/source/accessibility/AccessibilityIssue.cxx
index b276faf54c3f..aa58c3924476 100644
--- a/sfx2/source/accessibility/AccessibilityIssue.cxx
+++ b/sfx2/source/accessibility/AccessibilityIssue.cxx
@@ -24,6 +24,8 @@ std::vector>& 
AccessibilityIssueCollection::
 return m_aIssues;
 }
 
+void AccessibilityIssueCollection::clear() { m_aIssues.clear(); }
+
 } // end sfx namespace
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 6e00b2e9a500..b0f11424f422 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -423,6 +423,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
 sw/source/core/tox/ToxTextGenerator \
 sw/source/core/tox/ToxWhitespaceStripper \
 sw/source/core/txtnode/GrammarContact \
+sw/source/core/txtnode/OnlineAccessibilityCheck \
 sw/source/core/txtnode/attrcontentcontrol \
 sw/source/core/txtnode/atrfld \
 sw/source/core/txtnode/atrflyin \
diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
new file mode 100644
index ..f27f867ce96b
--- /dev/null
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include "ndindex.hxx"
+#include "ndtxt.hxx"
+#include 
+#include 
+#include 
+
+struct SwPosition;
+class SwTextNode;
+
+namespace sw
+{
+class OnlineAccessibilityCheck : public SvtListener
+{
+private:
+SwDoc& m_rDocument;
+sw::AccessibilityCheck m_aAccessibilityCheck;
+SwTextNode* m_pCurrentTextNode;
+SwNodeOffset m_aCurrentNodeIndex;
+sal_Int32 m_nAccessibilityIssues;
+
+void runCheck(SwTextNode* pTextNode);
+
+public:
+OnlineAccessibilityCheck(SwDoc& rDocument);
+void update(const SwPosition& rNewPos);
+sal_Int32 getNumberOfAccessibilityIssues() { return 
m_nAccessibilityIssues; }
+};
+
+} // end sw
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index a1d466214b58..72025d5160e1 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -164,6 +164,7 @@ namespace sw {
 class 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source

2022-12-07 Thread Tomaž Vajngerl (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   97 +++
 sw/source/core/inc/AccessibilityCheck.hxx|   28 ++-
 2 files changed, 80 insertions(+), 45 deletions(-)

New commits:
commit 321029dc9de8b2125fd272c116b3ce7c557be711
Author: Tomaž Vajngerl 
AuthorDate: Thu Oct 20 22:23:06 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Dec 8 07:34:09 2022 +

sw: refactor to make a11y check for nodes independent

Add checkNodes, which will only check the current node for a11y
issues. This prepares for online a11y check.

Change-Id: I069cd200ceb58223b05baaafb7d796148e28398b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141603
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 6e66b5d75b4cda0314b64f4d12ef9e4350751470)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143700
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index d1bcb1cd5279..d984fef8336a 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -77,19 +77,6 @@ lclAddIssue(sfx::AccessibilityIssueCollection& 
rIssueCollection, OUString const&
 return pIssue;
 }
 
-class BaseCheck
-{
-protected:
-sfx::AccessibilityIssueCollection& m_rIssueCollection;
-
-public:
-BaseCheck(sfx::AccessibilityIssueCollection& rIssueCollection)
-: m_rIssueCollection(rIssueCollection)
-{
-}
-virtual ~BaseCheck() {}
-};
-
 class NodeCheck : public BaseCheck
 {
 public:
@@ -1376,41 +1363,67 @@ void AccessibilityCheck::checkObject(SdrObject* pObject)
 }
 }
 
+void AccessibilityCheck::init()
+{
+if (m_aDocumentChecks.empty())
+{
+m_aDocumentChecks.emplace_back(new 
DocumentDefaultLanguageCheck(m_aIssueCollection));
+m_aDocumentChecks.emplace_back(new 
DocumentTitleCheck(m_aIssueCollection));
+m_aDocumentChecks.emplace_back(new 
FootnoteEndnoteCheck(m_aIssueCollection));
+m_aDocumentChecks.emplace_back(new 
BackgroundImageCheck(m_aIssueCollection));
+}
+
+if (m_aNodeChecks.empty())
+{
+m_aNodeChecks.emplace_back(new 
NoTextNodeAltTextCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new 
TableNodeMergeSplitCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new 
TableFormattingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new NumberingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new HyperlinkCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new TextContrastCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new BlinkingTextCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new HeaderCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new 
TextFormattingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new 
NonInteractiveFormCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new FloatingTextCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new TableHeadingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new HeadingOrderCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new 
NewlineSpacingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new SpaceSpacingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new FakeFootnoteCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new FakeCaptionCheck(m_aIssueCollection));
+}
+}
+
+void AccessibilityCheck::checkNode(SwNode* pNode)
+{
+if (m_pDoc == nullptr || pNode == nullptr)
+return;
+
+init();
+
+for (std::shared_ptr& rpNodeCheck : m_aNodeChecks)
+{
+auto pNodeCheck = dynamic_cast(rpNodeCheck.get());
+if (pNodeCheck)
+pNodeCheck->check(pNode);
+}
+}
+
 void AccessibilityCheck::check()
 {
 if (m_pDoc == nullptr)
 return;
 
-std::vector> aDocumentChecks;
-
aDocumentChecks.push_back(std::make_unique(m_aIssueCollection));
-
aDocumentChecks.push_back(std::make_unique(m_aIssueCollection));
-
aDocumentChecks.push_back(std::make_unique(m_aIssueCollection));
-
aDocumentChecks.push_back(std::make_unique(m_aIssueCollection));
+init();
 
-for (std::unique_ptr& rpDocumentCheck : aDocumentChecks)
+for (std::shared_ptr& rpDocumentCheck : m_aDocumentChecks)
 {
-rpDocumentCheck->check(m_pDoc);
+auto pDocumentCheck = 
dynamic_cast(rpDocumentCheck.get());
+if (pDocumentCheck)
+pDocumentCheck->check(m_pDoc);
 }
 
-std::vector> aNodeChecks;
-
aNodeChecks.push_back(std::make_unique(m_aIssueCollection));
-
aNodeChecks.push_back(std::make_unique(m_aIssueCollection));
-
aNodeChecks.push_back(std::make_unique(m_aIssueCollection));
-
aNodeChecks.push_back(std::make_unique(m_aIssueCollection));
-

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 2 commits - solenv/clang-format sw/inc sw/Library_sw.mk sw/source

2022-12-06 Thread Tomaž Vajngerl (via logerrit)
 solenv/clang-format/excludelist   |2 +-
 sw/Library_sw.mk  |2 +-
 sw/inc/GrammarContact.hxx |7 ---
 sw/source/core/crsr/crsrsh.cxx|2 +-
 sw/source/core/doc/docnew.cxx |   15 +--
 sw/source/core/text/txtfrm.cxx|4 ++--
 sw/source/core/txtnode/GrammarContact.cxx |   19 +++
 sw/source/core/unocore/unoflatpara.cxx|4 ++--
 sw/source/core/unocore/unotextmarkup.cxx  |   11 +--
 9 files changed, 32 insertions(+), 34 deletions(-)

New commits:
commit a61a4da16ef2fea05787fa57c45cde11eb72e11e
Author: Tomaž Vajngerl 
AuthorDate: Fri Oct 14 13:51:51 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 6 08:44:22 2022 +

sw: Move getGrammarContact function into GrammarContact and rename

Change-Id: Id89d7eabb465f047188f8f74bd823cfb3b2f2aff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141433
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 8e2deed1457e3ab712df2820331136d531927522)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143658
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/GrammarContact.hxx b/sw/inc/GrammarContact.hxx
index 0b8014160cd4..9b47984b9587 100644
--- a/sw/inc/GrammarContact.hxx
+++ b/sw/inc/GrammarContact.hxx
@@ -83,13 +83,14 @@ public:
 /** getGrammarContact() delivers the grammar contact of the document (for a 
given textnode)
 @returns grammar contact
 */
-GrammarContact* getGrammarContact(const SwTextNode&);
+GrammarContact* getGrammarContactFor(const SwTextNode&);
 
 /** finishGrammarCheck() calls the same function of the grammar contact of the 
document (for a given textnode)
 @returns void
 */
-void finishGrammarCheck(SwTextNode&);
-}
+void finishGrammarCheckFor(SwTextNode&);
+
+} // end sw
 
 #endif // INCLUDED_SW_INC_IGRAMMARCONTACT_HXX
 
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 5e6ffab1fc54..7bb6ef051ca5 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -808,19 +808,6 @@ void SwDoc::WriteLayoutCache( SvStream& rStream )
 SwLayoutCache::Write( rStream, *this );
 }
 
-namespace sw
-{
-
-sw::GrammarContact* getGrammarContact(const SwTextNode& rTextNode)
-{
-const SwDoc& rDoc = rTextNode.GetDoc();
-if (rDoc.IsInDtor())
-return nullptr;
-return rDoc.getGrammarContact().get();
-}
-
-} // end sw
-
 ::sfx2::IXmlIdRegistry&
 SwDoc::GetXmlIdRegistry()
 {
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 58873a199adb..3ed591503bbe 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1802,7 +1802,7 @@ static void lcl_SetWrong( SwTextFrame& rFrame, SwTextNode 
const& rNode,
 if ( !rFrame.IsFollow() )
 {
 SwTextNode* pTextNode = const_cast();
-sw::GrammarContact* pGrammarContact = getGrammarContact(*pTextNode);
+sw::GrammarContact* pGrammarContact = 
sw::getGrammarContactFor(*pTextNode);
 SwGrammarMarkUp* pWrongGrammar = pGrammarContact ?
 pGrammarContact->getGrammarCheck( *pTextNode, false ) :
 pTextNode->GetGrammarCheck();
diff --git a/sw/source/core/txtnode/GrammarContact.cxx 
b/sw/source/core/txtnode/GrammarContact.cxx
index 7f7f41076c1f..4aceeb5a9be9 100644
--- a/sw/source/core/txtnode/GrammarContact.cxx
+++ b/sw/source/core/txtnode/GrammarContact.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -143,11 +144,21 @@ void GrammarContact::finishGrammarCheck( SwTextNode& 
rTextNode )
 }
 }
 
-void finishGrammarCheck( SwTextNode& rTextNode )
+sw::GrammarContact* getGrammarContactFor(const SwTextNode& rTextNode)
 {
-sw::GrammarContact* pGrammarContact = getGrammarContact( rTextNode );
+const SwDoc& rDoc = rTextNode.GetDoc();
+if (rDoc.IsInDtor())
+return nullptr;
+return rDoc.getGrammarContact().get();
+}
+
+void finishGrammarCheckFor(SwTextNode& rTextNode)
+{
+sw::GrammarContact* pGrammarContact = getGrammarContactFor(rTextNode);
 if (pGrammarContact)
-pGrammarContact->finishGrammarCheck( rTextNode );
+{
+pGrammarContact->finishGrammarCheck(rTextNode);
+}
 }
 
 } // end sw
diff --git a/sw/source/core/unocore/unoflatpara.cxx 
b/sw/source/core/unocore/unoflatpara.cxx
index 3d904907fc8d..213d851e70a6 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -190,7 +190,7 @@ void SAL_CALL SwXFlatParagraph::setChecked( ::sal_Int32 
nType, sal_Bool bVal )
 {
 GetTextNode()->SetGrammarCheckDirty( !bVal );
 if( bVal )
-sw::finishGrammarCheck( *GetTextNode() );
+sw::finishGrammarCheckFor(*GetTextNode());
 }
 }
 
diff --git a/sw/source/core/unocore/unotextmarkup.cxx 
b/sw/source/core/unocore/unotextmarkup.cxx
index 4dd534691fb3..fb7e50596af6 100644
--- 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 2 commits - include/sfx2 sw/inc sw/qa sw/source

2022-12-06 Thread Tomaž Vajngerl (via logerrit)
 include/sfx2/AccessibilityIssue.hxx  |
1 
 sw/inc/IGrammarContact.hxx   |   
48 --
 sw/inc/doc.hxx   |
6 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   
15 ++
 sw/qa/core/accessibilitycheck/data/AccessibilityTests_NumberingCheck.odt 
|binary
 sw/source/core/access/AccessibilityCheck.cxx |   
50 --
 sw/source/core/crsr/crsrsh.cxx   |
7 
 sw/source/core/doc/docnew.cxx|   
11 +
 sw/source/core/text/txtfrm.cxx   |
2 
 sw/source/core/txtnode/SwGrammarContact.cxx  |   
73 ++
 sw/source/core/unocore/unoflatpara.cxx   |
2 
 sw/source/core/unocore/unotextmarkup.cxx |
4 
 12 files changed, 122 insertions(+), 97 deletions(-)

New commits:
commit 9f8d09e5cf3ccfef524c2fd6c431f07b2e0280af
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 12 21:36:52 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 6 08:44:04 2022 +

sw: combine IGrammarContact and SwGrammarContact

Change-Id: I4b9ab45ff8e21fa5091894f2cd5e3c7de57df425
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141431
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit c7bcf51d3efe30047667fe026cbcd3cb87bdece3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143656
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/IGrammarContact.hxx b/sw/inc/IGrammarContact.hxx
index 68be355807ef..0b8014160cd4 100644
--- a/sw/inc/IGrammarContact.hxx
+++ b/sw/inc/IGrammarContact.hxx
@@ -20,29 +20,52 @@
 #ifndef INCLUDED_SW_INC_IGRAMMARCONTACT_HXX
 #define INCLUDED_SW_INC_IGRAMMARCONTACT_HXX
 
+#include 
+#include 
+#include 
+
 struct SwPosition;
 class SwTextNode;
-class SwGrammarMarkUp;
 
-/** Organizer of the contact between SwTextNodes and grammar checker
-*/
-class IGrammarContact
+namespace sw
 {
+/**
+ * This class is responsible for the delayed display of grammar checks when a 
paragraph is edited
+ * It's a client of the paragraph the cursor points to.
+ * If the cursor position changes, updateCursorPosition has to be called
+ * If the grammar checker wants to set a grammar marker at a paragraph, he has 
to request
+ * the grammar list from this class. If the requested paragraph is not edited, 
it returns
+ * the normal grammar list. But if the paragraph is the active one, a proxy 
list will be returned and
+ * all changes are set in this proxy list. If the cursor leaves the paragraph 
the proxy list
+ * will replace the old list. If the grammar checker has completed the 
paragraph ('setChecked')
+ * then a timer is setup which replaces the old list as well.
+ */
+class GrammarContact final : public SvtListener
+{
+Timer m_aTimer;
+std::unique_ptr m_pProxyList;
+bool m_isFinished;
+SwTextNode* m_pTextNode;
+DECL_LINK(TimerRepaint, Timer*, void);
+
 public:
+GrammarContact();
+~GrammarContact() { m_aTimer.Stop(); }
+
 /** Update cursor position reacts to a change of the current input cursor
 As long as the cursor in inside a paragraph, the grammar checking does
 not show new grammar faults. When the cursor leaves the paragraph, 
these
 faults are shown.
 @returns void
 */
-virtual void updateCursorPosition(const SwPosition& rNewPos) = 0;
+void updateCursorPosition(const SwPosition& rNewPos);
 
 /** getGrammarCheck checks if the given text node is blocked by the 
current cursor
 if not, the normal markup list is returned
 if blocked, it will return a markup list "proxy"
 @returns a markup list (grammar) for the given SwTextNode
 */
-virtual SwGrammarMarkUp* getGrammarCheck(SwTextNode& rTextNode, bool 
bCreate) = 0;
+SwGrammarMarkUp* getGrammarCheck(SwTextNode& rTextNode, bool bCreate);
 
 /** finishGrammarCheck() has to be called if a grammar checking has been 
completed
 for a text node. If this text node has not been hidden by the current 
proxy list
@@ -50,28 +73,23 @@ public:
 repaint will be triggered by a timer
 @returns void
 */
-virtual void finishGrammarCheck(SwTextNode& rTextNode) = 0;
+void finishGrammarCheck(SwTextNode& rTextNode);
 
-public:
-virtual ~IGrammarContact() {}
+void CheckBroadcaster();
 };
 
-/** Factory for a grammar contact
-@returns a new created grammar contact object
-*/
-IGrammarContact* createGrammarContact();
-
 /* Helper functions */
 
 /** getGrammarContact() delivers the grammar contact of the document (for a 
given textnode)
 @returns grammar contact
 */
-IGrammarContact* getGrammarContact(const SwTextNode&);
+GrammarContact* getGrammarContact(const 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 2 commits - sw/inc sw/source

2022-12-06 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/ndtxt.hxx   |   36 +--
 sw/source/core/doc/doc.cxx |4 
 sw/source/core/inc/layact.hxx  |8 +
 sw/source/core/layout/layact.cxx   |   26 +++--
 sw/source/core/text/txtfrm.cxx |2 
 sw/source/core/txtnode/ndtxt.cxx   |   17 +--
 sw/source/core/txtnode/txtedt.cxx  |  149 -
 sw/source/core/unocore/unoflatpara.cxx |2 
 sw/source/core/unocore/unoobj.cxx  |2 
 9 files changed, 98 insertions(+), 148 deletions(-)

New commits:
commit 1ca337267e4f0aa3b513461a42626ac619171833
Author: Tomaž Vajngerl 
AuthorDate: Sat Sep 24 22:35:19 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 6 08:43:47 2022 +

sw: refactor SwParaIdleData - rename, lifecycle, move to header

This renames SwParaIdleData to sw::ParagraphIdleData, moves it to
the header file and changes from a raw pointer initialized at the
SwTextNode construction and deleted at SwTextNode destruction to
a pure member variable (which has the same lifecycle). A it is not
a pointer anymore, there is no need to check if it is nullptr or
not, which simplifies the code.

Change-Id: I74413eef2cfd3666cf75177a6ea080219eee0ac0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140681
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit e051b3a6d59ed925e1cddfa72696c9a740830808)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143654
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 9e83ded061f6..21735f35e03a 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -59,7 +59,6 @@ class SwInterHyphInfo;
 class SwWrongList;
 class SwGrammarMarkUp;
 struct SwDocStat;
-struct SwParaIdleData_Impl;
 enum class ExpandMode;
 enum class SwFieldIds : sal_uInt16;
 class SwField;
@@ -75,6 +74,29 @@ namespace com::sun::star {
 
 typedef o3tl::sorted_vector< sal_Int32 > SwSoftPageBreakList;
 
+namespace sw
+{
+
+enum class WrongState { TODO, PENDING, DONE };
+
+struct ParagraphIdleData
+{
+std::unique_ptr pWrong;// for spell checking
+std::unique_ptr pGrammarCheck; // for grammar 
checking /  proof reading
+std::unique_ptr pSmartTags;
+sal_uLong nNumberOfWords  = 0;
+sal_uLong nNumberOfAsianWords  = 0;
+sal_uLong nNumberOfChars  = 0;
+sal_uLong nNumberOfCharsExcludingSpaces = 0;
+bool bWordCountDirty = true;
+WrongState eWrongDirty = WrongState::TODO; ///< online spell checking 
needed/done?
+bool bGrammarCheckDirty = true;
+bool bSmartTagDirty = true;
+bool bAutoComplDirty = true;   ///< auto complete list dirty
+};
+
+} // end namespace sw
+
 /// SwTextNode is a paragraph in the document model.
 class SW_DLLPUBLIC SwTextNode final
 : public SwContentNode
@@ -97,7 +119,7 @@ class SW_DLLPUBLIC SwTextNode final
 
 OUString m_Text;
 
-SwParaIdleData_Impl* m_pParaIdleData_Impl;
+mutable sw::ParagraphIdleData m_aParagraphIdleData;
 
 /** Some of the chars this para are hidden. Paragraph has to be reformatted
on changing the view to print preview. */
@@ -164,10 +186,6 @@ class SW_DLLPUBLIC SwTextNode final
 LanguageType nLang, sal_uInt16 nLangWhichId,
 const vcl::Font *pFont,  sal_uInt16 nFontWhichId );
 
-/// Start: Data collected during idle time
-
-SAL_DLLPRIVATE void InitSwParaStatistics( bool bNew );
-
 inline void TryDeleteSwpHints();
 
 SAL_DLLPRIVATE void impl_FormatToTextAttr(const SfxItemSet& i_rAttrSet);
@@ -177,16 +195,14 @@ class SW_DLLPUBLIC SwTextNode final
 void DelFrames_TextNodePart();
 
 public:
-enum class WrongState { TODO, PENDING, DONE };
-
 bool IsWordCountDirty() const;
-WrongState GetWrongDirty() const;
+sw::WrongState GetWrongDirty() const;
 bool IsWrongDirty() const;
 bool IsGrammarCheckDirty() const;
 bool IsSmartTagDirty() const;
 bool IsAutoCompleteWordDirty() const;
 void SetWordCountDirty( bool bNew ) const;
-void SetWrongDirty(WrongState eNew) const;
+void SetWrongDirty(sw::WrongState eNew) const;
 void SetGrammarCheckDirty( bool bNew ) const;
 void SetSmartTagDirty( bool bNew ) const;
 void SetAutoCompleteWordDirty( bool bNew ) const;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 5abb1d9d92c9..571a9bb75c4c 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1124,14 +1124,14 @@ static bool lcl_SpellAndGrammarAgain( SwNode* pNd, 
void* pArgs )
 {
 if( pTextNode->GetWrong() &&
 pTextNode->GetWrong()->InvalidateWrong() )
-pTextNode->SetWrongDirty(SwTextNode::WrongState::TODO);
+pTextNode->SetWrongDirty(sw::WrongState::TODO);
 if( pTextNode->GetGrammarCheck() &&
 pTextNode->GetGrammarCheck()->InvalidateWrong() )
 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - 2 commits - sw/source

2022-12-06 Thread Tomaž Vajngerl (via logerrit)
 sw/source/core/inc/layact.hxx|   10 ++-
 sw/source/core/layout/layact.cxx |  122 ++-
 2 files changed, 80 insertions(+), 52 deletions(-)

New commits:
commit e9426ca5750ad7947b7e1ea7fd142bca14434fa3
Author: Tomaž Vajngerl 
AuthorDate: Thu Sep 22 15:20:39 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 6 08:43:28 2022 +

sw: convert IdleJobType enum to enum class

Change-Id: Ib1843830836b8d0d03d85c82979bae2f26851259
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140679
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 9b7e904f2f115f22827e4ae3b8da51610ad0c609)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143652
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx
index b6f7db3377fa..66aeb75112ed 100644
--- a/sw/source/core/inc/layact.hxx
+++ b/sw/source/core/inc/layact.hxx
@@ -185,6 +185,14 @@ public:
 
 };
 
+enum class IdleJobType
+{
+ONLINE_SPELLING,
+AUTOCOMPLETE_WORDS,
+WORD_COUNT,
+SMART_TAGS
+};
+
 class SwLayIdle
 {
 SwRootFrame *m_pRoot;
@@ -198,7 +206,6 @@ class SwLayIdle
 void ShowIdle( Color eName );
 #endif
 
-enum IdleJobType{ ONLINE_SPELLING, AUTOCOMPLETE_WORDS, WORD_COUNT, 
SMART_TAGS };
 bool DoIdleJob_( const SwContentFrame*, IdleJobType );
 bool DoIdleJob( IdleJobType, bool bVisAreaOnly );
 
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 2720df3c57b3..88ec6c171476 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1963,13 +1963,13 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
 {
 switch ( eJob )
 {
-case ONLINE_SPELLING :
+case IdleJobType::ONLINE_SPELLING:
 bProcess = pTextNode->IsWrongDirty(); break;
-case AUTOCOMPLETE_WORDS :
+case IdleJobType::AUTOCOMPLETE_WORDS:
 bProcess = pTextNode->IsAutoCompleteWordDirty(); break;
-case WORD_COUNT :
+case IdleJobType::WORD_COUNT:
 bProcess = pTextNode->IsWordCountDirty(); break;
-case SMART_TAGS :
+case IdleJobType::SMART_TAGS:
 bProcess = pTextNode->IsSmartTagDirty(); break;
 }
 if (bProcess)
@@ -2024,7 +2024,7 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
 
 switch ( eJob )
 {
-case ONLINE_SPELLING :
+case IdleJobType::ONLINE_SPELLING:
 {
 SwRect aRepaint( 
const_cast(pTextFrame)->AutoSpell_(*pTextNode, nPos) );
 // PENDING should stop idle spell checking
@@ -2035,14 +2035,14 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
 return true;
 break;
 }
-case AUTOCOMPLETE_WORDS :
+case IdleJobType::AUTOCOMPLETE_WORDS:
 
const_cast(pTextFrame)->CollectAutoCmplWrds(*pTextNode, nPos);
 // note: bPageValid remains true here even if the cursor
 // position is skipped, so no PENDING state needed currently
 if (Application::AnyInput(VCL_INPUT_ANY & 
VclInputFlags(~VclInputFlags::TIMER)))
 return true;
 break;
-case WORD_COUNT :
+case IdleJobType::WORD_COUNT:
 {
 const sal_Int32 nEnd = pTextNode->GetText().getLength();
 SwDocStat aStat;
@@ -2051,7 +2051,7 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
 return true;
 break;
 }
-case SMART_TAGS :
+case IdleJobType::SMART_TAGS:
 {
 try {
 const SwRect aRepaint( 
const_cast(pTextFrame)->SmartTagScan(*pTextNode) );
@@ -2100,32 +2100,31 @@ bool SwLayIdle::isJobEnabled(IdleJobType eJob, const 
SwViewShell* pViewShell)
 {
 switch (eJob)
 {
-case ONLINE_SPELLING:
+case IdleJobType::ONLINE_SPELLING:
 {
 const SwViewOption* pViewOptions = pViewShell->GetViewOptions();
 return pViewOptions->IsOnlineSpell();
 }
 
-case AUTOCOMPLETE_WORDS:
+case IdleJobType::AUTOCOMPLETE_WORDS:
 {
 if (!SwViewOption::IsAutoCompleteWords() || 
SwDoc::GetAutoCompleteWords().IsLockWordLstLocked())
 return false;
 return true;
 }
 
-case WORD_COUNT:
+case IdleJobType::WORD_COUNT:
 {
 return pViewShell->getIDocumentStatistics().GetDocStat().bModified;
 }
 
-case SMART_TAGS:
+case IdleJobType::SMART_TAGS:
 {
 const SwDoc* pDoc = pViewShell->GetDoc();
 if 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - include/basegfx svx/source

2022-12-04 Thread Tomaž Vajngerl (via logerrit)
 include/basegfx/utils/RectangleWrapper.hxx |5 +
 svx/source/svdraw/svdotxtr.cxx |   73 ++---
 2 files changed, 62 insertions(+), 16 deletions(-)

New commits:
commit 6e02b415f09404656d4b3ac93d2520a4c581ef8d
Author: Tomaž Vajngerl 
AuthorDate: Wed Nov 23 11:00:13 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Wed Nov 23 11:07:34 2022 +0900

svx: convert SdrTextObj rotate and move to use gfx::Length

Change-Id: I82f10f82db8ac9d5653f4902276ee58fc18c52d6

diff --git a/include/basegfx/utils/RectangleWrapper.hxx 
b/include/basegfx/utils/RectangleWrapper.hxx
index 00586d6eae71..4f5dbe851f66 100644
--- a/include/basegfx/utils/RectangleWrapper.hxx
+++ b/include/basegfx/utils/RectangleWrapper.hxx
@@ -55,6 +55,11 @@ public:
 m_aRange.setSize(width, height);
 }
 
+void shift(gfx::Length const& rXDelta, gfx::Length const& rYDelta)
+{
+m_aRange.shift(rXDelta, rYDelta);
+}
+
 void move(sal_Int32 nXDelta, sal_Int32 nYDelta)
 {
 auto deltaX = gfx::Length::hmm(nXDelta);
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index e2a050c99dba..1ac82bc3db47 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -39,6 +39,35 @@
 
 using namespace com::sun::star;
 
+namespace
+{
+gfx::Tuple2DL rotatePoint(gfx::Tuple2DL const& rPoint, gfx::Tuple2DL const& 
rReference, double sinAngle, double cosAngle)
+{
+gfx::Length dx = rPoint.getX() - rReference.getX();
+gfx::Length dy = rPoint.getY() - rReference.getY();
+
+auto x = rReference.getX() + gfx::Length::emu(basegfx::fround(dx.raw() * 
cosAngle + dy.raw() * sinAngle));
+auto y = rReference.getY() + gfx::Length::emu(basegfx::fround(dy.raw() * 
cosAngle - dx.raw() * sinAngle));
+
+return gfx::Tuple2DL(x, y);
+}
+
+gfx::Tuple2DL toTuple(Point const& rPointHmm)
+{
+auto x = gfx::Length::hmm(rPointHmm.X());
+auto y = gfx::Length::hmm(rPointHmm.Y());
+return {x, y};
+}
+
+gfx::Size2DL toSize2D(Size const& rSizeHmm)
+{
+auto x = gfx::Length::hmm(rSizeHmm.Width());
+auto y = gfx::Length::hmm(rSizeHmm.Height());
+return {x, y};
+}
+
+} // end anonymous ns
+
 void SdrTextObj::NbcSetSnapRect(const tools::Rectangle& rRect)
 {
 if (maGeo.nRotationAngle || maGeo.nShearAngle)
@@ -91,7 +120,9 @@ Degree100 SdrTextObj::GetShearAngle(bool /*bVertical*/) const
 
 void SdrTextObj::NbcMove(const Size& rSize)
 {
-moveRectangle(rSize.Width(), rSize.Height());
+gfx::Size2DL aSize2D = toSize2D(rSize);
+maRectangle.shift(aSize2D.getWidth(), aSize2D.getHeight());
+
 moveOutRectangle(rSize.Width(), rSize.Height());
 maSnapRect.Move(rSize);
 SetBoundAndSnapRectsDirty(true);
@@ -182,27 +213,37 @@ void SdrTextObj::NbcResize(const Point& rRef, const 
Fraction& xFact, const Fract
 SetBoundAndSnapRectsDirty();
 }
 
-void SdrTextObj::NbcRotate(const Point& rRef, Degree100 nAngle, double sn, 
double cs)
+void SdrTextObj::NbcRotate(const Point& rRef, Degree100 nAngle, double 
sinAngle, double cosAngle)
 {
+auto aReference = toTuple(rRef);
+
 SetGlueReallyAbsolute(true);
-tools::Long dx = getRectangle().Right() - getRectangle().Left();
-tools::Long dy = getRectangle().Bottom() - getRectangle().Top();
-Point aPoint1(getRectangle().TopLeft());
-RotatePoint(aPoint1, rRef, sn, cs);
-Point aPoint2(aPoint1.X() + dx, aPoint1.Y() + dy);
-tools::Rectangle aRectangle(aPoint1, aPoint2);
-setRectangle(aRectangle);
+auto const& rRange = maRectangle.getRange();
+
+auto nWidth = rRange.getWidth();
+auto nHeight = rRange.getHeight();
+
+gfx::Tuple2DL aPoint1(rRange.getMinX(), rRange.getMinY());
+aPoint1 = rotatePoint(aPoint1, aReference, sinAngle, cosAngle);
 
-if (maGeo.nRotationAngle==0_deg100) {
-maGeo.nRotationAngle=NormAngle36000(nAngle);
-maGeo.mfSinRotationAngle=sn;
-maGeo.mfCosRotationAngle=cs;
-} else {
-maGeo.nRotationAngle=NormAngle36000(maGeo.nRotationAngle+nAngle);
+gfx::Tuple2DL aPoint2(aPoint1.getX() + nWidth, aPoint1.getY() + nHeight);
+
+gfx::Range2DL aRange{aPoint1, aPoint2};
+maRectangle.setRange(aRange);
+
+if (maGeo.nRotationAngle == 0_deg100)
+{
+maGeo.nRotationAngle = NormAngle36000(nAngle);
+maGeo.mfSinRotationAngle = sinAngle;
+maGeo.mfCosRotationAngle = cosAngle;
+}
+else
+{
+maGeo.nRotationAngle = NormAngle36000(maGeo.nRotationAngle + nAngle);
 maGeo.RecalcSinCos();
 }
 SetBoundAndSnapRectsDirty();
-NbcRotateGluePoints(rRef,nAngle,sn,cs);
+NbcRotateGluePoints(rRef, nAngle, sinAngle, cosAngle);
 SetGlueReallyAbsolute(false);
 }
 


[Libreoffice-commits] core.git: sw/inc sw/source

2022-11-22 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |4 +-
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   32 +---
 2 files changed, 17 insertions(+), 19 deletions(-)

New commits:
commit 6f8bd9785c3f01ac711bfe0647dc7d02a68d45a8
Author: Tomaž Vajngerl 
AuthorDate: Wed Nov 16 17:59:31 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 22 14:56:54 2022 +0100

sw: use WeakNodeContainer for m_pPreviousNode in OnlineA11yCheck

Change-Id: Iae2158ff4de0cab4307379c48011d5b6ca844b13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142821
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 8f52b73f35bd..0d9c65902905 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -41,14 +41,14 @@ public:
 SwNode* getNode();
 };
 
-class OnlineAccessibilityCheck : public SvtListener
+class OnlineAccessibilityCheck
 {
 private:
 std::map> m_aNodes;
 
 SwDoc& m_rDocument;
 sw::AccessibilityCheck m_aAccessibilityCheck;
-SwNode* m_pPreviousNode;
+std::unique_ptr m_pPreviousNode;
 SwNodeOffset m_nPreviousNodeIndex;
 sal_Int32 m_nAccessibilityIssues;
 bool m_bInitialCheck;
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index 6c03293705f7..063c2d586e12 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -35,12 +35,16 @@ WeakNodeContainer::WeakNodeContainer(SwNode* pNode)
 {
 if (m_pNode)
 {
-auto* pBroadcast = dynamic_cast(pNode);
+auto* pBroadcast = dynamic_cast(m_pNode);
 if (pBroadcast)
 {
 EndListeningAll();
 StartListening(pBroadcast->GetNotifier());
 }
+else
+{
+m_pNode = nullptr;
+}
 }
 }
 
@@ -48,6 +52,8 @@ WeakNodeContainer::~WeakNodeContainer() { EndListeningAll(); }
 
 bool WeakNodeContainer::isAlive()
 {
+if (!m_pNode)
+return false;
 if (!HasBroadcaster())
 m_pNode = nullptr;
 return m_pNode;
@@ -63,7 +69,6 @@ SwNode* WeakNodeContainer::getNode()
 OnlineAccessibilityCheck::OnlineAccessibilityCheck(SwDoc& rDocument)
 : m_rDocument(rDocument)
 , m_aAccessibilityCheck(_rDocument)
-, m_pPreviousNode(nullptr)
 , m_nPreviousNodeIndex(-1)
 , m_nAccessibilityIssues(0)
 , m_bInitialCheck(false)
@@ -177,8 +182,7 @@ void OnlineAccessibilityCheck::updateCheckerActivity()
 
 if (bOnlineCheckStatus != m_bOnlineCheckStatus)
 {
-EndListeningAll();
-m_pPreviousNode = nullptr;
+m_pPreviousNode.reset();
 m_nPreviousNodeIndex = SwNodeOffset(-1);
 m_bInitialCheck = false; // force initial check
 
@@ -218,16 +222,14 @@ void 
OnlineAccessibilityCheck::lookForPreviousNodeAndUpdate(const SwPosition& rN
 if (!pCurrentNode->IsContentNode() && !pCurrentNode->IsTableNode())
 return;
 
-auto* pCurrentBroadcast = 
dynamic_cast(pCurrentNode);
-if (!pCurrentBroadcast)
+auto pCurrentWeak = std::make_unique(pCurrentNode);
+if (!pCurrentWeak->isAlive())
 return;
 
 // Check if previous node was deleted
-if (!HasBroadcaster())
+if (!m_pPreviousNode || !m_pPreviousNode->isAlive())
 {
-EndListeningAll();
-StartListening(pCurrentBroadcast->GetNotifier());
-m_pPreviousNode = pCurrentNode;
+m_pPreviousNode = std::move(pCurrentWeak);
 m_nPreviousNodeIndex = nCurrenNodeIndex;
 return;
 }
@@ -240,9 +242,7 @@ void 
OnlineAccessibilityCheck::lookForPreviousNodeAndUpdate(const SwPosition& rN
 if (m_nPreviousNodeIndex < SwNodeOffset(0)
 || m_nPreviousNodeIndex >= pCurrentNode->GetNodes().Count())
 {
-EndListeningAll();
-StartListening(pCurrentBroadcast->GetNotifier());
-m_pPreviousNode = pCurrentNode;
+m_pPreviousNode = std::move(pCurrentWeak);
 m_nPreviousNodeIndex = nCurrenNodeIndex;
 return;
 }
@@ -257,14 +257,12 @@ void 
OnlineAccessibilityCheck::lookForPreviousNodeAndUpdate(const SwPosition& rN
 updateStatusbar();
 
 // Assign previous node and index
-EndListeningAll();
-StartListening(pCurrentBroadcast->GetNotifier());
-m_pPreviousNode = pCurrentNode;
+m_pPreviousNode = std::move(pCurrentWeak);
 m_nPreviousNodeIndex = nCurrenNodeIndex;
 }
 else
 {
-m_pPreviousNode = nullptr;
+m_pPreviousNode.reset();
 m_nPreviousNodeIndex = SwNodeOffset(-1);
 }
 }


[Libreoffice-commits] core.git: sw/inc sw/source

2022-11-22 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |8 
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   10 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit bada1fc45d6ec65c12cf9ed36e15927b27d6d49c
Author: Tomaž Vajngerl 
AuthorDate: Wed Nov 16 18:04:34 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 22 14:56:41 2022 +0100

sw: rename WeakContentNodeContainer to WeakNodeContainer

Change-Id: Ic80c0753b600ff6e846f2f38a1c46cb67763e2fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142820
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index e87f24d61d44..8f52b73f35bd 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -24,14 +24,14 @@ namespace sw
 {
 /// Contains the node and tracks if the node gets deleted.
 /// Note: the node needs to extend sw::BroadcastingModify.
-class WeakContentNodeContainer : public SvtListener
+class WeakNodeContainer : public SvtListener
 {
 private:
 SwNode* m_pNode;
 
 public:
-WeakContentNodeContainer(SwNode* pNode);
-~WeakContentNodeContainer();
+WeakNodeContainer(SwNode* pNode);
+~WeakNodeContainer();
 
 /// Is the node still alive or it was deleted?
 bool isAlive();
@@ -44,7 +44,7 @@ public:
 class OnlineAccessibilityCheck : public SvtListener
 {
 private:
-std::map> m_aNodes;
+std::map> m_aNodes;
 
 SwDoc& m_rDocument;
 sw::AccessibilityCheck m_aAccessibilityCheck;
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index 75e727b5e6d9..6c03293705f7 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -30,7 +30,7 @@
 
 namespace sw
 {
-WeakContentNodeContainer::WeakContentNodeContainer(SwNode* pNode)
+WeakNodeContainer::WeakNodeContainer(SwNode* pNode)
 : m_pNode(pNode)
 {
 if (m_pNode)
@@ -44,16 +44,16 @@ WeakContentNodeContainer::WeakContentNodeContainer(SwNode* 
pNode)
 }
 }
 
-WeakContentNodeContainer::~WeakContentNodeContainer() { EndListeningAll(); }
+WeakNodeContainer::~WeakNodeContainer() { EndListeningAll(); }
 
-bool WeakContentNodeContainer::isAlive()
+bool WeakNodeContainer::isAlive()
 {
 if (!HasBroadcaster())
 m_pNode = nullptr;
 return m_pNode;
 }
 
-SwNode* WeakContentNodeContainer::getNode()
+SwNode* WeakNodeContainer::getNode()
 {
 if (isAlive())
 return m_pNode;
@@ -84,7 +84,7 @@ void OnlineAccessibilityCheck::updateNodeStatus(SwNode* pNode)
 auto it = m_aNodes.find(pNode);
 if (it == m_aNodes.end())
 {
-m_aNodes.emplace(pNode, 
std::make_unique(pNode));
+m_aNodes.emplace(pNode, std::make_unique(pNode));
 }
 
 for (auto iterator = m_aNodes.begin(); iterator != m_aNodes.end();)


[Libreoffice-commits] core.git: icon-themes/colibre icon-themes/colibre_svg sw/inc sw/source

2022-11-22 Thread Tomaž Vajngerl (via logerrit)
 icon-themes/colibre/svx/res/a11y_check_issues_found.png |binary
 icon-themes/colibre/svx/res/a11y_check_issues_not_found.png |binary
 icon-themes/colibre_svg/svx/res/a11y_check_issues_found.svg |1 
 icon-themes/colibre_svg/svx/res/a11y_check_issues_not_found.svg |1 
 sw/inc/OnlineAccessibilityCheck.hxx |1 
 sw/inc/bitmaps.hlst |3 
 sw/inc/strings.hrc  |2 
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   17 ++-
 sw/source/uibase/inc/AccessibilityStatusBarControl.hxx  |3 
 sw/source/uibase/uiview/view0.cxx   |7 +
 sw/source/uibase/utlui/AccessibilityStatusBarControl.cxx|   50 
+-
 11 files changed, 56 insertions(+), 29 deletions(-)

New commits:
commit f8b990aaac155f0b45de3a4452bc300dcf2bb49b
Author: Tomaž Vajngerl 
AuthorDate: Mon Nov 14 22:27:50 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 22 14:56:20 2022 +0100

sw: change statusbar to use an icon, fix statusbar updating

Change-Id: I98e862c4c1124b1db8eb3e0ea7ff96effd629185
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142721
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/icon-themes/colibre/svx/res/a11y_check_issues_found.png 
b/icon-themes/colibre/svx/res/a11y_check_issues_found.png
new file mode 100644
index ..a46aa9152f75
Binary files /dev/null and 
b/icon-themes/colibre/svx/res/a11y_check_issues_found.png differ
diff --git a/icon-themes/colibre/svx/res/a11y_check_issues_not_found.png 
b/icon-themes/colibre/svx/res/a11y_check_issues_not_found.png
new file mode 100644
index ..8e4ff8edd750
Binary files /dev/null and 
b/icon-themes/colibre/svx/res/a11y_check_issues_not_found.png differ
diff --git a/icon-themes/colibre_svg/svx/res/a11y_check_issues_found.svg 
b/icon-themes/colibre_svg/svx/res/a11y_check_issues_found.svg
new file mode 100644
index ..706a4735af16
--- /dev/null
+++ b/icon-themes/colibre_svg/svx/res/a11y_check_issues_found.svg
@@ -0,0 +1 @@
+http://www.w3.org/2000/svg;>
\ No newline at end of file
diff --git a/icon-themes/colibre_svg/svx/res/a11y_check_issues_not_found.svg 
b/icon-themes/colibre_svg/svx/res/a11y_check_issues_not_found.svg
new file mode 100644
index ..f847ab83c834
--- /dev/null
+++ b/icon-themes/colibre_svg/svx/res/a11y_check_issues_not_found.svg
@@ -0,0 +1 @@
+http://www.w3.org/2000/svg;>/gt;
\ No newline at end of file
diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 5e1da9b77c99..e87f24d61d44 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -67,6 +67,7 @@ public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
 void update(SwPosition const& rNewPos);
 void resetAndQueue(SwNode* pNode);
+void updateCheckerActivity();
 sal_Int32 getNumberOfAccessibilityIssues() { return 
m_nAccessibilityIssues; }
 };
 
diff --git a/sw/inc/bitmaps.hlst b/sw/inc/bitmaps.hlst
index 0ade4923b8fe..647d2fb2f073 100644
--- a/sw/inc/bitmaps.hlst
+++ b/sw/inc/bitmaps.hlst
@@ -110,4 +110,7 @@ inline constexpr OUStringLiteral 
RID_BMP_WRAP_CONTOUR_PARALLEL = u"sw/res/wr010.
 
 inline constexpr OUStringLiteral RID_BMP_PREVIEW_FALLBACK = 
u"sw/res/image-example.png";
 
+inline constexpr OUStringLiteral RID_BMP_A11Y_CHECK_ISSUES_NOT_FOUND = 
u"svx/res/a11y_check_issues_not_found.png";
+inline constexpr OUStringLiteral RID_BMP_A11Y_CHECK_ISSUES_FOUND = 
u"svx/res/a11y_check_issues_found.png";
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index eef50782ebe5..7cf98621de2e 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1095,7 +1095,7 @@
 #define STR_BOOKCTRL_HINT   NC_("STR_BOOKCTRL_HINT", "Page 
number in document. Click to open Go to Page dialog or right-click for bookmark 
list.")
 #define STR_BOOKCTRL_HINT_EXTENDED  
NC_("STR_BOOKCTRL_HINT_EXTENDED", "Page number in document (Page number on 
printed document). Click to open Go to Page dialog.")
 #define STR_TMPLCTRL_HINT   NC_("STR_TMPLCTRL_HINT", "Page 
Style. Right-click to change style or click to open Style dialog.")
-#define STR_ACCESSIBILITY_CHECK_HINT
NC_("STR_ACCESSIBILITY_CHECK_HINT", "Status of the accessibility check.")
+#define STR_ACCESSIBILITY_CHECK_HINT
NC_("STR_ACCESSIBILITY_CHECK_HINT", "Status of the accessibility check.\nNumber 
of issues found: %issues%.")
 
 // Strings for textual attributes.
 #define STR_DROP_OVER   NC_("STR_DROP_OVER", "Drop 
Caps over")
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index f919ce124a88..75e727b5e6d9 100644
--- 

[Libreoffice-commits] core.git: sw/CppunitTest_sw_core_accessibilitycheck.mk sw/qa sw/source

2022-11-22 Thread Tomaž Vajngerl (via logerrit)
 sw/CppunitTest_sw_core_accessibilitycheck.mk |3 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |  171 +++
 sw/qa/core/accessibilitycheck/data/OnlineCheck.odt   |binary
 sw/source/core/inc/AccessibilityIssue.hxx|6 
 4 files changed, 178 insertions(+), 2 deletions(-)

New commits:
commit e7f78c3123c7bb7b8c830fa11241c357d89bad6a
Author: Tomaž Vajngerl 
AuthorDate: Sun Nov 13 22:27:54 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 22 14:56:06 2022 +0100

sw: test online a11y check - splitting and joining nodes

Change-Id: I9be3df3a4c00e7f1bbfc4f2462c8cf9a0f813f9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142656
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/CppunitTest_sw_core_accessibilitycheck.mk 
b/sw/CppunitTest_sw_core_accessibilitycheck.mk
index 7cfa8b79770b..a5b59d486c59 100644
--- a/sw/CppunitTest_sw_core_accessibilitycheck.mk
+++ b/sw/CppunitTest_sw_core_accessibilitycheck.mk
@@ -26,11 +26,12 @@ $(eval $(call 
gb_CppunitTest_use_libraries,sw_core_accessibilitycheck, \
 sfx \
 subsequenttest \
 sw \
-   swqahelper \
+swqahelper \
 test \
 unotest \
 utl \
 tl \
+vcl \
 ))
 
 $(eval $(call gb_CppunitTest_use_externals,sw_core_accessibilitycheck,\
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 6d848da7e25d..e412c8249a65 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -9,6 +9,14 @@
 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
 
 class AccessibilityCheckTest : public SwModelTestBase
 {
@@ -195,6 +203,169 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testCheckTabsFormatting)
 CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, 
aIssues[3]->m_eIssueID);
 }
 
+namespace
+{
+std::vector>
+scanAccessibilityIssuesOnNodes(SwDoc* pDocument)
+{
+std::vector> aIssues;
+auto const& pNodes = pDocument->GetNodes();
+for (SwNodeOffset n(0); n < pNodes.Count(); ++n)
+{
+SwNode* pNode = pNodes[n];
+auto& pCollection = pNode->getAccessibilityCheckStatus().pCollection;
+if (pCollection)
+{
+for (auto& pIssue : pCollection->getIssues())
+{
+aIssues.push_back(pIssue);
+}
+}
+}
+return aIssues;
+}
+
+void checkIssuePosition(std::shared_ptr const& 
pIssue, int nLine,
+sal_Int32 nStart, sal_Int32 nEnd, SwNodeOffset nIndex)
+{
+auto* pSwIssue = static_cast(pIssue.get());
+
+OString sFailMessage = OString::Concat("Start doesn't match at line: ")
+   + OString::Concat(OString::number(nLine));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailMessage.getStr(), nStart, 
pSwIssue->getStart());
+
+sFailMessage
+= OString::Concat("End doesn't match at line: ") + 
OString::Concat(OString::number(nLine));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailMessage.getStr(), nEnd, 
pSwIssue->getEnd());
+
+sFailMessage = OString::Concat("Offset doesn't match at line: ")
+   + OString::Concat(OString::number(nLine));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailMessage.getStr(), nIndex, 
pSwIssue->getNode()->GetIndex());
+}
+
+} // end anonymous ns
+
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend)
+{
+// Checks the a11y checker is setting the a11y issues to the nodes
+// correctly when splitting and appending nodes (through undo), which
+// happen on editing all the time.
+// When a node is split, it can happen that both nodes get a11y issues
+// if the node splits the area of direct formatting.
+
+createSwDoc("OnlineCheck.odt");
+SwDoc* pDoc = getSwDoc();
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// Enable online a11y checker
+{
+auto pBatch(comphelper::ConfigurationChanges::create());
+
officecfg::Office::Common::Accessibility::OnlineAccessibilityCheck::set(true, 
pBatch);
+pBatch->commit();
+}
+comphelper::ScopeGuard g([] {
+auto pBatch(comphelper::ConfigurationChanges::create());
+
officecfg::Office::Common::Accessibility::OnlineAccessibilityCheck::set(false, 
pBatch);
+pBatch->commit();
+});
+
+Scheduler::ProcessEventsToIdle();
+
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0),
+ 
pDoc->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues());
+// Trigger a11y checker
+pWrtShell->Down(/*bSelect*/ false, /*nCount*/ 0);
+
+// Check we have 1 a11y issue
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2),
+ 
pDoc->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues());
+auto aIssues 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 4 commits - basegfx/test include/basegfx include/svx svx/source tools/qa

2022-11-21 Thread Tomaž Vajngerl (via logerrit)
 basegfx/test/LengthUnitTest.cxx|   77 ---
 include/basegfx/units/Length.hxx   |  111 +++
 include/basegfx/utils/RectangleWrapper.hxx |   77 +++
 include/svx/svdotext.hxx   |   28 +-
 svx/source/svdraw/svdocirc.cxx |2 
 svx/source/svdraw/svdotext.cxx |   31 ++-
 svx/source/svdraw/svdotxtr.cxx |7 -
 tools/qa/cppunit/test_rectangle.cxx|  117 +++--
 8 files changed, 319 insertions(+), 131 deletions(-)

New commits:
commit e08d574336b1e53073d53f0b2e24466c409cd0c1
Author: Tomaž Vajngerl 
AuthorDate: Tue Nov 22 13:33:30 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 22 13:44:44 2022 +0900

svx: use RectangleWrapper for maRectangle on SdrTextObj

This is needed so we can now transition to use gfx::Length and
gfx::Range2DL to define the object position and size.

Change-Id: Ie683a869ba061f53d437bd1dfbe72fe454011730

diff --git a/include/basegfx/utils/RectangleWrapper.hxx 
b/include/basegfx/utils/RectangleWrapper.hxx
new file mode 100644
index ..00586d6eae71
--- /dev/null
+++ b/include/basegfx/utils/RectangleWrapper.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include 
+#include 
+
+namespace gfx
+{
+/**
+ * Wrapps tools::Rectangle and Range2DL, to make it easier to incrementally
+ * transition to use Range2DL.
+ */
+class RectangleWrapper
+{
+private:
+gfx::Range2DL m_aRange;
+mutable tools::Rectangle m_aRectangle;
+
+public:
+RectangleWrapper() = default;
+
+RectangleWrapper(gfx::Length x1, gfx::Length y1, gfx::Length x2, 
gfx::Length y2)
+: m_aRange(x1, y1, x2, y2)
+{
+}
+
+gfx::Range2DL const& getRange() const { return m_aRange; }
+
+void setRange(gfx::Range2DL const& rRange) { m_aRange = rRange; }
+
+tools::Rectangle const& getRectangle() const
+{
+m_aRectangle = gfx::length::toRectangleHmm(m_aRange);
+return m_aRectangle;
+}
+
+void setRectangle(tools::Rectangle const& rRectangle)
+{
+m_aRange = gfx::length::fromRectangleHmm(rRectangle);
+}
+
+void setSize(sal_Int32 nWidth, sal_Int32 nHeight)
+{
+auto width = gfx::Length::hmm(nWidth - 1);
+auto height = gfx::Length::hmm(nHeight - 1);
+
+m_aRange.setSize(width, height);
+}
+
+void move(sal_Int32 nXDelta, sal_Int32 nYDelta)
+{
+auto deltaX = gfx::Length::hmm(nXDelta);
+auto deltaY = gfx::Length::hmm(nYDelta);
+
+m_aRange.shift(deltaX, deltaY);
+}
+
+void setPosition(sal_Int32 nX, sal_Int32 nY)
+{
+auto x = gfx::Length::hmm(nX);
+auto y = gfx::Length::hmm(nY);
+
+m_aRange.setPosition(x, y);
+}
+};
+
+} // end namespace gfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index a1cccb0804a4..5ac836e03b6d 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -165,32 +166,17 @@ protected:
 // The "aRect" is also the rect of RectObj and CircObj.
 // When mbTextFrame=true the text will be formatted into this rect
 // When mbTextFrame=false the text will be centered around its middle
-tools::Rectangle maRectangle;
+gfx::RectangleWrapper maRectangle;
 
-tools::Rectangle const& getRectangle() const
-{
-return maRectangle;
-}
+tools::Rectangle const& getRectangle() const;
 
-void setRectangle(tools::Rectangle const& rRectangle)
-{
-maRectangle = rRectangle;
-}
+void setRectangle(tools::Rectangle const& rRectangle);
 
-void setRectangleSize(sal_Int32 nWidth, sal_Int32 nHeight)
-{
-maRectangle.SetSize(Size(nWidth, nHeight));
-}
+void setRectangleSize(sal_Int32 nWidth, sal_Int32 nHeight);
 
-void moveRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
-{
-maRectangle.Move(nXDelta, nYDelta);
-}
+void moveRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta);
 
-void moveRectanglePosition(sal_Int32 nX, sal_Int32 nY)
-{
-maRectangle.SetPos(Point(nX, nY));
-}
+void moveRectanglePosition(sal_Int32 nX, sal_Int32 nY);
 
 // The GeoStat contains the rotation and shear angles
 GeoStat maGeo;
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index ab8bc58ddf85..d8b47be4fbba 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -707,7 +707,6 @@ bool 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 8 commits - basctl/source basegfx/test chart2/source cui/source editeng/source filter/source include/basegfx include/editeng includ

2022-11-21 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit 0fc07542518da908684aaeb9c00e5d30f55a30e3
Author: Tomaž Vajngerl 
AuthorDate: Fri Nov 18 16:37:33 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Nov 18 22:26:53 2022 +0900

basegfx: add setSize, setPosition to range classes, add tests

Change-Id: Idf01d1254e7327f1816e7b58d882bcc5ec9efae2

diff --git a/basegfx/test/B1DRangeTest.cxx b/basegfx/test/B1DRangeTest.cxx
index 22cf662defe5..9c3c12e37684 100644
--- a/basegfx/test/B1DRangeTest.cxx
+++ b/basegfx/test/B1DRangeTest.cxx
@@ -25,72 +25,115 @@
 
 namespace basegfx
 {
-class b1Xrange : public CppUnit::TestFixture
+class B1DRangeTest : public CppUnit::TestFixture
 {
 public:
-template  void implCheck()
+void checkIntervalAxioms()
 {
 // test interval axioms
 // (http://en.wikipedia.org/wiki/Interval_%28mathematics%29)
-Type aRange;
+B1DRange aRange;
 CPPUNIT_ASSERT_MESSAGE("default ctor - empty range", aRange.isEmpty());
-CPPUNIT_ASSERT_MESSAGE("center - get cop-out value since range is 
empty",
-   aRange.getCenter() == 0);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("center - get cop-out value since range 
is empty", 0.0,
+ aRange.getCenter());
 
 // degenerate interval
 aRange.expand(1);
+CPPUNIT_ASSERT_EQUAL(B1DRange(1.0, 1.0), aRange);
 CPPUNIT_ASSERT_MESSAGE("degenerate range - still, not empty!", 
!aRange.isEmpty());
-CPPUNIT_ASSERT_MESSAGE("degenerate range - size of 0", 
aRange.getRange() == 0);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("degenerate range - size of 0", 0.0, 
aRange.getRange());
 CPPUNIT_ASSERT_MESSAGE("same value as degenerate range - is inside 
range",
-   aRange.isInside(1));
-CPPUNIT_ASSERT_MESSAGE("center - must be the single range value", 
aRange.getCenter() == 1);
+   aRange.isInside(1.0));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("center - must be the single range 
value", 1.0,
+ aRange.getCenter());
 
 // proper interval
-aRange.expand(2);
-CPPUNIT_ASSERT_MESSAGE("proper range - size of 1", aRange.getRange() 
== 1);
+aRange.expand(2.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(1.0, 2.0), aRange);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("proper range - size of 1", 1.0, 
aRange.getRange());
 CPPUNIT_ASSERT_MESSAGE("smaller value of range - is inside *closed* 
range",
aRange.isInside(1));
 CPPUNIT_ASSERT_MESSAGE("larger value of range - is inside *closed* 
range",
aRange.isInside(2));
 
 // center for proper interval that works for ints, too
-aRange.expand(3);
-CPPUNIT_ASSERT_MESSAGE("center - must be half of the range", 
aRange.getCenter() == 2);
+aRange.expand(3.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(1.0, 3.0), aRange);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("center - must be half of the range", 
2.0, aRange.getCenter());
+}
+
+void checkOverlap()
+{
+B1DRange aRange(1.0, 3.0);
+B1DRange aRange2(0.0, 1.0);
 
-// check overlap
-Type aRange2(0, 1);
 CPPUNIT_ASSERT_MESSAGE("range overlapping *includes* upper bound",
aRange.overlaps(aRange2));
 CPPUNIT_ASSERT_MESSAGE("range overlapping *includes* upper bound, but 
only barely",
!aRange.overlapsMore(aRange2));
 
-Type aRange3(0, 2);
+B1DRange aRange3(0.0, 2.0);
 CPPUNIT_ASSERT_MESSAGE("range overlapping is fully overlapping now",
aRange.overlapsMore(aRange3));
+}
 
-// check intersect
-Type aRange4(3, 4);
-aRange.intersect(aRange4);
+void checkIntersect()
+{
+B1DRange aRange(1.0, 3.0);
+B1DRange aRange2(3.0, 4.0);
+aRange.intersect(aRange2);
 CPPUNIT_ASSERT_MESSAGE("range intersection is yielding empty range!", 
!aRange.isEmpty());
 
-Type aRange5(5, 6);
-aRange.intersect(aRange5);
+B1DRange aRange3(5.0, 6.0);
+aRange.intersect(aRange3);
 CPPUNIT_ASSERT_MESSAGE("range intersection is yielding nonempty 
range!", aRange.isEmpty());
 }
 
-void check() { implCheck(); }
+void checkShift()
+{
+B1DRange aRange(1.0, 3.0);
+aRange.shift(2.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(3.0, 5.0), aRange);
+
+B1DRange aRange2(-1.0, -3.0);
+aRange2.shift(2.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(1.0, -1.0), aRange2);
+}
+
+void checkSetSize()
+{
+B1DRange aRange(1.0, 3.0);
+aRange.setSize(5.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(1.0, 6.0), aRange);
+
+B1DRange aRange2(-1.0, -3.0);
+aRange2.setSize(3.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(-3.0, 

[Libreoffice-commits] core.git: sw/inc sw/source

2022-11-18 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |1 +
 sw/inc/node.hxx |3 +++
 sw/source/core/docnode/node.cxx |   16 
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   17 +++--
 sw/source/core/txtnode/ndtxt.cxx|9 +
 5 files changed, 44 insertions(+), 2 deletions(-)

New commits:
commit 5e9ba2e6bc08493b10268abdec0c22c1d7c307f6
Author: Tomaž Vajngerl 
AuthorDate: Sun Nov 13 22:21:29 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Nov 18 11:49:58 2022 +0100

sw: handle joining and splitting nodes for online a11y check

Change-Id: I706bf56209beebbe2987bce436536c3d9ade51f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142655
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 3d68a71f11db..5e1da9b77c99 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -66,6 +66,7 @@ private:
 public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
 void update(SwPosition const& rNewPos);
+void resetAndQueue(SwNode* pNode);
 sal_Int32 getNumberOfAccessibilityIssues() { return 
m_nAccessibilityIssues; }
 };
 
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index e04266de1037..2807c0a5ef71 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -87,6 +87,7 @@ namespace sw
 struct AccessibilityCheckStatus
 {
 std::unique_ptr pCollection;
+void reset();
 };
 
 }
@@ -335,6 +336,8 @@ public:
 return m_aAccessibilityCheckStatus;
 }
 
+void resetAndQueueAccessibilityCheck();
+
 private:
 SwNode( const SwNode & rNodes ) = delete;
 SwNode & operator= ( const SwNode & rNodes ) = delete;
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 0ac601019a7e..684849468d12 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -70,12 +70,22 @@
 #include 
 #include 
 #include 
+#include 
 #ifdef DBG_UTIL
 #include 
 #endif
 
 using namespace ::com::sun::star::i18n;
 
+namespace sw
+{
+
+void AccessibilityCheckStatus::reset()
+{
+pCollection.reset();
+}
+
+}
 
 /*
  * Some local helper functions for the attribute set handle of a content node.
@@ -2189,4 +2199,10 @@ void SwNode::RemoveAnchoredFly(SwFrameFormat *const 
pFlyFormat)
 m_aAnchoredFlys.erase(it);
 }
 
+void SwNode::resetAndQueueAccessibilityCheck()
+{
+GetDoc().getOnlineAccessibilityCheck()->resetAndQueue(this);
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index 1188bc7d06c5..d162e1a661ba 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -263,8 +263,7 @@ void 
OnlineAccessibilityCheck::clearAccessibilityIssuesFromAllNodes()
 SwNode* pNode = pNodes[n];
 if (pNode)
 {
-auto& rStatus = pNode->getAccessibilityCheckStatus();
-rStatus.pCollection.reset();
+pNode->getAccessibilityCheckStatus().reset();
 }
 }
 
@@ -272,6 +271,20 @@ void 
OnlineAccessibilityCheck::clearAccessibilityIssuesFromAllNodes()
 updateStatusbar();
 }
 
+void OnlineAccessibilityCheck::resetAndQueue(SwNode* pNode)
+{
+bool bOnlineCheckStatus
+= 
officecfg::Office::Common::Accessibility::OnlineAccessibilityCheck::get();
+if (!bOnlineCheckStatus)
+return;
+
+pNode->getAccessibilityCheckStatus().reset();
+m_aNodes.erase(pNode);
+runAccessibilityCheck(pNode);
+updateNodeStatus(pNode);
+updateStatusbar();
+}
+
 } // end sw
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 4b2f114d94a3..e1d7e92036e4 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -496,6 +496,9 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & 
rPos,
 }
 SetSmartTagDirty( true );
 
+resetAndQueueAccessibilityCheck();
+pNode->resetAndQueueAccessibilityCheck();
+
 if ( pNode->HasHints() )
 {
 if ( pNode->m_pSwpHints->CanBeDeleted() )
@@ -633,6 +636,9 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & 
rPos,
 SetSmartTags( std::move(pList2) );
 }
 
+resetAndQueueAccessibilityCheck();
+pNode->resetAndQueueAccessibilityCheck();
+
 if (pContentIndexRestore)
 {   // call before making frames and before RegisterToNode
 (*pContentIndexRestore)(pNode, sw::mark::RestoreMode::NonFlys, 
false);
@@ -1091,6 +1097,8 @@ SwContentNode *SwTextNode::JoinNext()
 SetGrammarCheck( std::move(pList3) );
 SetSmartTags( std::move(pList2) );
 
+

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 4 commits - basegfx/test editeng/source include/basegfx include/editeng include/svx sd/source svx/source

2022-11-17 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit 5038cb51cb48d1661103690b44f7fac01dd5a324
Author: Tomaž Vajngerl 
AuthorDate: Fri Nov 18 16:37:33 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Nov 18 16:37:33 2022 +0900

basegfx: add setSize, setPosition to range classes, add tests

Change-Id: Idf01d1254e7327f1816e7b58d882bcc5ec9efae2

diff --git a/basegfx/test/B1DRangeTest.cxx b/basegfx/test/B1DRangeTest.cxx
index 22cf662defe5..9c3c12e37684 100644
--- a/basegfx/test/B1DRangeTest.cxx
+++ b/basegfx/test/B1DRangeTest.cxx
@@ -25,72 +25,115 @@
 
 namespace basegfx
 {
-class b1Xrange : public CppUnit::TestFixture
+class B1DRangeTest : public CppUnit::TestFixture
 {
 public:
-template  void implCheck()
+void checkIntervalAxioms()
 {
 // test interval axioms
 // (http://en.wikipedia.org/wiki/Interval_%28mathematics%29)
-Type aRange;
+B1DRange aRange;
 CPPUNIT_ASSERT_MESSAGE("default ctor - empty range", aRange.isEmpty());
-CPPUNIT_ASSERT_MESSAGE("center - get cop-out value since range is 
empty",
-   aRange.getCenter() == 0);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("center - get cop-out value since range 
is empty", 0.0,
+ aRange.getCenter());
 
 // degenerate interval
 aRange.expand(1);
+CPPUNIT_ASSERT_EQUAL(B1DRange(1.0, 1.0), aRange);
 CPPUNIT_ASSERT_MESSAGE("degenerate range - still, not empty!", 
!aRange.isEmpty());
-CPPUNIT_ASSERT_MESSAGE("degenerate range - size of 0", 
aRange.getRange() == 0);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("degenerate range - size of 0", 0.0, 
aRange.getRange());
 CPPUNIT_ASSERT_MESSAGE("same value as degenerate range - is inside 
range",
-   aRange.isInside(1));
-CPPUNIT_ASSERT_MESSAGE("center - must be the single range value", 
aRange.getCenter() == 1);
+   aRange.isInside(1.0));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("center - must be the single range 
value", 1.0,
+ aRange.getCenter());
 
 // proper interval
-aRange.expand(2);
-CPPUNIT_ASSERT_MESSAGE("proper range - size of 1", aRange.getRange() 
== 1);
+aRange.expand(2.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(1.0, 2.0), aRange);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("proper range - size of 1", 1.0, 
aRange.getRange());
 CPPUNIT_ASSERT_MESSAGE("smaller value of range - is inside *closed* 
range",
aRange.isInside(1));
 CPPUNIT_ASSERT_MESSAGE("larger value of range - is inside *closed* 
range",
aRange.isInside(2));
 
 // center for proper interval that works for ints, too
-aRange.expand(3);
-CPPUNIT_ASSERT_MESSAGE("center - must be half of the range", 
aRange.getCenter() == 2);
+aRange.expand(3.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(1.0, 3.0), aRange);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("center - must be half of the range", 
2.0, aRange.getCenter());
+}
+
+void checkOverlap()
+{
+B1DRange aRange(1.0, 3.0);
+B1DRange aRange2(0.0, 1.0);
 
-// check overlap
-Type aRange2(0, 1);
 CPPUNIT_ASSERT_MESSAGE("range overlapping *includes* upper bound",
aRange.overlaps(aRange2));
 CPPUNIT_ASSERT_MESSAGE("range overlapping *includes* upper bound, but 
only barely",
!aRange.overlapsMore(aRange2));
 
-Type aRange3(0, 2);
+B1DRange aRange3(0.0, 2.0);
 CPPUNIT_ASSERT_MESSAGE("range overlapping is fully overlapping now",
aRange.overlapsMore(aRange3));
+}
 
-// check intersect
-Type aRange4(3, 4);
-aRange.intersect(aRange4);
+void checkIntersect()
+{
+B1DRange aRange(1.0, 3.0);
+B1DRange aRange2(3.0, 4.0);
+aRange.intersect(aRange2);
 CPPUNIT_ASSERT_MESSAGE("range intersection is yielding empty range!", 
!aRange.isEmpty());
 
-Type aRange5(5, 6);
-aRange.intersect(aRange5);
+B1DRange aRange3(5.0, 6.0);
+aRange.intersect(aRange3);
 CPPUNIT_ASSERT_MESSAGE("range intersection is yielding nonempty 
range!", aRange.isEmpty());
 }
 
-void check() { implCheck(); }
+void checkShift()
+{
+B1DRange aRange(1.0, 3.0);
+aRange.shift(2.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(3.0, 5.0), aRange);
+
+B1DRange aRange2(-1.0, -3.0);
+aRange2.shift(2.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(1.0, -1.0), aRange2);
+}
+
+void checkSetSize()
+{
+B1DRange aRange(1.0, 3.0);
+aRange.setSize(5.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(1.0, 6.0), aRange);
+
+B1DRange aRange2(-1.0, -3.0);
+aRange2.setSize(3.0);
+CPPUNIT_ASSERT_EQUAL(B1DRange(-3.0, 

[Libreoffice-commits] core.git: sw/inc sw/source

2022-11-17 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |2 ++
 sw/source/core/access/AccessibilityCheck.cxx|   12 +++-
 sw/source/core/inc/AccessibilityCheck.hxx   |1 +
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   11 +++
 4 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 45d1fca81991f0d6837c98d6be6fe0d21d566fa5
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 31 11:09:46 2022 +0100
Commit: Tomaž Vajngerl 
CommitDate: Fri Nov 18 02:06:13 2022 +0100

sw: run document properties a11y checks on a loaded document

Change-Id: Iba98a91a61955af52651348409f88244d1eed2c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142216
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index fe4652949d64..3d68a71f11db 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -53,6 +53,7 @@ private:
 sal_Int32 m_nAccessibilityIssues;
 bool m_bInitialCheck;
 bool m_bOnlineCheckStatus;
+std::unique_ptr 
m_pDocumentAccessibilityIssues;
 
 void runAccessibilityCheck(SwNode* pNode);
 void updateStatusbar();
@@ -60,6 +61,7 @@ private:
 void initialCheck();
 void lookForPreviousNodeAndUpdate(SwPosition const& rNewPos);
 void clearAccessibilityIssuesFromAllNodes();
+void runDocumentLevelAccessibilityCheck();
 
 public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 802dda2b95cd..ac558a44c69e 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1411,7 +1411,7 @@ void AccessibilityCheck::checkNode(SwNode* pNode)
 }
 }
 
-void AccessibilityCheck::check()
+void AccessibilityCheck::checkDocumentProperties()
 {
 if (m_pDoc == nullptr)
 return;
@@ -1424,6 +1424,16 @@ void AccessibilityCheck::check()
 if (pDocumentCheck)
 pDocumentCheck->check(m_pDoc);
 }
+}
+
+void AccessibilityCheck::check()
+{
+if (m_pDoc == nullptr)
+return;
+
+init();
+
+checkDocumentProperties();
 
 auto const& pNodes = m_pDoc->GetNodes();
 SwNode* pNode = nullptr;
diff --git a/sw/source/core/inc/AccessibilityCheck.hxx 
b/sw/source/core/inc/AccessibilityCheck.hxx
index 1ff4cf5b16f7..c7613e8829a4 100644
--- a/sw/source/core/inc/AccessibilityCheck.hxx
+++ b/sw/source/core/inc/AccessibilityCheck.hxx
@@ -51,6 +51,7 @@ public:
 void check() override;
 void checkObject(SdrObject* pObject);
 void checkNode(SwNode* pNode);
+void checkDocumentProperties();
 };
 
 } // end sw namespace
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index db1212600644..1188bc7d06c5 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -135,11 +135,22 @@ void 
OnlineAccessibilityCheck::runAccessibilityCheck(SwNode* pNode)
 = std::make_unique(aCollection);
 }
 
+void OnlineAccessibilityCheck::runDocumentLevelAccessibilityCheck()
+{
+m_aAccessibilityCheck.getIssueCollection().clear();
+m_aAccessibilityCheck.checkDocumentProperties();
+auto aCollection = m_aAccessibilityCheck.getIssueCollection();
+m_pDocumentAccessibilityIssues
+= std::make_unique(aCollection);
+}
+
 void OnlineAccessibilityCheck::initialCheck()
 {
 if (m_bInitialCheck)
 return;
 
+runDocumentLevelAccessibilityCheck();
+
 auto const& pNodes = m_rDocument.GetNodes();
 for (SwNodeOffset n(0); n < pNodes.Count(); ++n)
 {


[Libreoffice-commits] core.git: include/sfx2 officecfg/registry svx/sdi sw/inc sw/sdi sw/source sw/uiconfig

2022-11-17 Thread Tomaž Vajngerl (via logerrit)
 include/sfx2/sfxsids.hrc |   14 +--
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |   14 +++
 svx/sdi/svx.sdi  |   18 

 sw/inc/OnlineAccessibilityCheck.hxx  |5 -
 sw/inc/node.hxx  |1 
 sw/sdi/_viewsh.sdi   |   11 ++
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx  |   42 
+-
 sw/source/uibase/uiview/view0.cxx|   24 
+
 sw/uiconfig/sglobal/menubar/menubar.xml  |1 
 sw/uiconfig/swriter/menubar/menubar.xml  |1 
 10 files changed, 119 insertions(+), 12 deletions(-)

New commits:
commit 00128f14c400b661444676410b2088aca357291c
Author: Tomaž Vajngerl 
AuthorDate: Fri Oct 28 22:11:59 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Fri Nov 18 02:05:55 2022 +0100

sw: add a menu option to enable/disable online a11y check

Change-Id: I656037ef4e40e7c79daef5dd73f8f10c9818ac25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142215
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 8333ce792d9d..eb729e873fd2 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -459,15 +459,15 @@ class SvxZoomItem;
 #define SID_PASTE_ONLY_FORMULA  (SID_SFX_START + 803)
 #define SID_PASTE_ONLY_VALUE(SID_SFX_START + 804)
 #define SID_PASTE_TEXTIMPORT_DIALOG (SID_SFX_START + 805)
-#define SID_PASTE_TRANSPOSED(SID_SFX_START + 812)
-#define SID_PASTE_AS_LINK   (SID_SFX_START + 813)
+#define SID_PASTE_TRANSPOSED(SID_SFX_START + 808)
+#define SID_PASTE_AS_LINK   (SID_SFX_START + 809)
 
 // Used for redaction
-#define SID_SHAPE_NAME  (SID_SFX_START + 808)
-// FREE: SID_SFX_START + 809
-#define SID_GRAPHIC_SIZE_CHECK  (SID_SFX_START + 809)
-#define SID_ACCESSIBILITY_CHECK (SID_SFX_START + 810)
-#define SID_ASYNCHRON   (SID_SFX_START + 811)
+#define SID_SHAPE_NAME  (SID_SFX_START + 810)
+#define SID_GRAPHIC_SIZE_CHECK  (SID_SFX_START + 811)
+#define SID_ACCESSIBILITY_CHECK (SID_SFX_START + 812)
+#define SID_ASYNCHRON   (SID_SFX_START + 813)
+#define SID_ACCESSIBILITY_CHECK_ONLINE  (SID_SFX_START + 814)
 
 // default-ids for configuration
 #define SID_CONFIG  (SID_SFX_START + 904)
diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 20817a9b4239..c355eb776ad3 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -5020,6 +5020,20 @@ bit 3 (0x8): #define 
UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
   9
 
   
+  
+
+  Automatic Accessibility Checking
+
+
+  Automatic A~ccessibility Checking
+
+
+  Toggle Automatic Accessibility 
Checking
+
+
+  1
+
+  
   
 
   Do Not Mark Errors
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 0be42759ae94..d4e4f62450b6 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -12546,6 +12546,24 @@ SfxVoidItem AccessibilityCheck SID_ACCESSIBILITY_CHECK
 GroupId = SfxGroupId::Modify;
 ]
 
+SfxBoolItem AccessibilityCheckOnline SID_ACCESSIBILITY_CHECK_ONLINE
+(SfxBoolItem Enable FN_PARAM_1)
+[
+AutoUpdate = TRUE,
+FastCall = FALSE,
+ReadOnlyDoc = TRUE,
+Toggle = TRUE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+
+
+AccelConfig = TRUE,
+MenuConfig = TRUE,
+ToolBoxConfig = TRUE,
+GroupId = SfxGroupId::Options;
+]
+
 XColorItem GlowColor SID_ATTR_GLOW_COLOR
 
 [
diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 7a37f05cc432..fe4652949d64 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -52,15 +52,18 @@ private:
 SwNodeOffset m_nPreviousNodeIndex;
 sal_Int32 m_nAccessibilityIssues;
 bool m_bInitialCheck;
+bool m_bOnlineCheckStatus;
 
 void runAccessibilityCheck(SwNode* pNode);
 void updateStatusbar();
 void updateNodeStatus(SwNode* pContentNode);
 void initialCheck();
+void lookForPreviousNodeAndUpdate(SwPosition const& rNewPos);
+void clearAccessibilityIssuesFromAllNodes();
 
 public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
-void update(const SwPosition& rNewPos);
+void 

[Libreoffice-commits] core.git: sw/inc sw/source

2022-11-17 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/viewopt.hxx  |  325 +++-
 sw/source/uibase/config/viewopt.cxx |   25 --
 sw/source/uibase/uno/unotxvw.cxx|2 
 3 files changed, 219 insertions(+), 133 deletions(-)

New commits:
commit 8c56abfa64be106c44b2d878968b9b019e126c40
Author: Tomaž Vajngerl 
AuthorDate: Thu Oct 27 22:12:35 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 17 14:54:28 2022 +0100

sw: convert ViewOptFlags1 from bitflags to struct of bools

Much easier to deal with - let compiler do the bit setting.

Change-Id: I9412e1a2f15e41c9ebf502af57b127c283fc1fa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142214
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index e8a1c299b496..7f65859c341d 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -35,42 +35,109 @@ class SwDocShell;
 namespace svtools{ class ColorConfig;}
 enum class SwFillMode;
 
-enum class ViewOptFlags1 : sal_uInt64 {
-UseHeaderFooterMenu = 0x0001,
-Tab   = 0x0002,
-Blank = 0x0004,
-HardBlank = 0x0008,
-Paragraph = 0x0010,
-Linebreak = 0x0020,
-Pagebreak = 0x0040,
-Columnbreak   = 0x0080,
-SoftHyph  = 0x0100,
-Bookmarks = 0x0200,
-Ref   = 0x0400,
-FieldName = 0x0800,
-Postits   = 0x4000,
-FieldHidden   = 0x8000,
-CharHidden= 0x0001,
-Graphic   = 0x0002,
-Table = 0x0004,
-Draw  = 0x0008,
-Control   = 0x0010,
-Crosshair = 0x0040,
-Snap  = 0x0080,
-Synchronize   = 0x0100,
-GridVisible   = 0x0200,
-OnlineSpell   = 0x0400,
-TreatSubOutlineLevelsAsContent = 0x0800,
-ShowInlineTooltips = 0x1000, //tooltips on tracked changes
-ViewMetachars = 0x2000,
-Pageback  = 0x4000,
-ShowOutlineContentVisibilityButton = 0x8000,
-ShowChangesInMargin = 0x1, //tracked deletions in margin
-ShowChangesInMargin2 = 0x2 //tracked insertions in margin
+struct ViewOptFlags1
+{
+bool bUseHeaderFooterMenu : 1;
+bool bTab : 1;
+bool bBlank : 1;
+bool bHardBlank : 1;
+bool bParagraph : 1;
+bool bLinebreak : 1;
+bool bPagebreak : 1;
+bool bColumnbreak : 1;
+bool bSoftHyph : 1;
+bool bBookmarks : 1;
+bool bRef : 1;
+bool bFieldName : 1;
+bool bPostits : 1;
+bool bFieldHidden : 1;
+bool bCharHidden : 1;
+bool bGraphic : 1;
+bool bTable : 1;
+bool bDraw : 1;
+bool bControl : 1;
+bool bCrosshair : 1;
+bool bSnap : 1;
+bool bSynchronize : 1;
+bool bGridVisible : 1;
+bool bOnlineSpell : 1;
+bool bTreatSubOutlineLevelsAsContent : 1;
+bool bShowInlineTooltips : 1; //tooltips on tracked changes
+bool bViewMetachars : 1;
+bool bPageback : 1;
+bool bShowOutlineContentVisibilityButton : 1;
+bool bShowChangesInMargin : 1; //tracked deletions in margin
+bool bShowChangesInMargin2 : 1; //tracked insertions in margin
+
+ViewOptFlags1()
+: bUseHeaderFooterMenu(false)
+, bTab(false)
+, bBlank(false)
+, bHardBlank(true)
+, bParagraph(false)
+, bLinebreak(false)
+, bPagebreak(false)
+, bColumnbreak(false)
+, bSoftHyph(true)
+, bBookmarks(false)
+, bRef(true)
+, bFieldName(false)
+, bPostits(true)
+, bFieldHidden(false)
+, bCharHidden(false)
+, bGraphic(true)
+, bTable(true)
+, bDraw(true)
+, bControl(true)
+, bCrosshair(false)
+, bSnap(false)
+, bSynchronize(false)
+, bGridVisible(false)
+, bOnlineSpell(false)
+, bTreatSubOutlineLevelsAsContent(false)
+, bShowInlineTooltips(false)
+, bViewMetachars(false)
+, bPageback(true)
+, bShowOutlineContentVisibilityButton(false)
+, bShowChangesInMargin(false)
+, bShowChangesInMargin2(false)
+{}
+
+bool operator==(const ViewOptFlags1& rOther) const
+{
+return bUseHeaderFooterMenu == rOther.bUseHeaderFooterMenu
+&& bTab == rOther.bTab
+&& bBlank == rOther.bBlank
+&& bHardBlank == rOther.bHardBlank
+&& bParagraph == rOther.bParagraph
+&& bLinebreak == rOther.bLinebreak
+&& bPagebreak == rOther.bPagebreak
+&& bColumnbreak == rOther.bColumnbreak
+&& bSoftHyph == rOther.bSoftHyph
+&& bBookmarks == rOther.bBookmarks
+&& bRef == rOther.bRef
+&& bFieldName == rOther.bFieldName
+&& bPostits == rOther.bPostits
+&& bFieldHidden == rOther.bFieldHidden
+&& bCharHidden == rOther.bCharHidden
+&& bGraphic == 

[Libreoffice-commits] core.git: sw/inc sw/sdi sw/source sw/uiconfig

2022-11-17 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/strings.hrc   |1 
 sw/sdi/swriter.sdi   |2 
 sw/source/uibase/inc/AccessibilityStatusBarControl.hxx   |7 +-
 sw/source/uibase/uiview/view2.cxx|   16 +
 sw/source/uibase/utlui/AccessibilityStatusBarControl.cxx |   45 +--
 sw/uiconfig/sglobal/statusbar/statusbar.xml  |2 
 sw/uiconfig/swriter/statusbar/statusbar.xml  |2 
 7 files changed, 53 insertions(+), 22 deletions(-)

New commits:
commit e96dd14288172187372b3a4f82de870b1d660020
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 26 22:02:44 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 17 10:07:21 2022 +0100

sw: improve a11y check statusbar

Change-Id: I86f589d6618ae80f26542cf83b6b5e3695ca35f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142193
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 2bf82cbc482f..eef50782ebe5 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1095,6 +1095,7 @@
 #define STR_BOOKCTRL_HINT   NC_("STR_BOOKCTRL_HINT", "Page 
number in document. Click to open Go to Page dialog or right-click for bookmark 
list.")
 #define STR_BOOKCTRL_HINT_EXTENDED  
NC_("STR_BOOKCTRL_HINT_EXTENDED", "Page number in document (Page number on 
printed document). Click to open Go to Page dialog.")
 #define STR_TMPLCTRL_HINT   NC_("STR_TMPLCTRL_HINT", "Page 
Style. Right-click to change style or click to open Style dialog.")
+#define STR_ACCESSIBILITY_CHECK_HINT
NC_("STR_ACCESSIBILITY_CHECK_HINT", "Status of the accessibility check.")
 
 // Strings for textual attributes.
 #define STR_DROP_OVER   NC_("STR_DROP_OVER", "Drop 
Caps over")
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 48328375735c..738f42a9c6ab 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -5974,7 +5974,7 @@ SfxStringItem StateWordCount FN_STAT_WORDCOUNT
 GroupId = SfxGroupId::View;
 ]
 
-SfxStringItem StateAccessibilityCheck FN_STAT_ACCESSIBILITY_CHECK
+SfxInt32Item StateAccessibilityCheck FN_STAT_ACCESSIBILITY_CHECK
 
 [
 AutoUpdate = FALSE,
diff --git a/sw/source/uibase/inc/AccessibilityStatusBarControl.hxx 
b/sw/source/uibase/inc/AccessibilityStatusBarControl.hxx
index 52e64b99f5ac..63744499d083 100644
--- a/sw/source/uibase/inc/AccessibilityStatusBarControl.hxx
+++ b/sw/source/uibase/inc/AccessibilityStatusBarControl.hxx
@@ -15,14 +15,17 @@ namespace sw
 {
 class AccessibilityStatusBarControl final : public SfxStatusBarControl
 {
+sal_Int32 mnIssues;
+
 public:
 SFX_DECL_STATUSBAR_CONTROL();
 
 AccessibilityStatusBarControl(sal_uInt16 nSlotId, sal_uInt16 nId, 
StatusBar& rStb);
 virtual ~AccessibilityStatusBarControl() override;
 
-virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState 
eState,
-const SfxPoolItem* pState) 
override;
+void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState,
+const SfxPoolItem* pState) override;
+void Paint(const UserDrawEvent& rEvent) override;
 };
 
 } // end sw
diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index a3bdb6bc8a22..5235e3bf4b91 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1815,19 +1815,11 @@ void SwView::StateStatusLine(SfxItemSet )
 break;
 case FN_STAT_ACCESSIBILITY_CHECK:
 {
-if (rShell.GetDoc()->getOnlineAccessibilityCheck())
+std::unique_ptr const& 
rOnlineAccessibilityCheck = rShell.GetDoc()->getOnlineAccessibilityCheck();
+if (rOnlineAccessibilityCheck)
 {
-auto nIssues = 
rShell.GetDoc()->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues();
-OUString aString;
-if (nIssues > 0)
-{
-aString = u"Issues: " + OUString::number(nIssues);
-}
-else
-{
-aString = u"No Issues";
-}
-rSet.Put(SfxStringItem(FN_STAT_ACCESSIBILITY_CHECK, 
aString));
+sal_Int32 nIssues = 
rOnlineAccessibilityCheck->getNumberOfAccessibilityIssues();
+rSet.Put(SfxInt32Item(FN_STAT_ACCESSIBILITY_CHECK, 
nIssues));
 }
 }
 break;
diff --git a/sw/source/uibase/utlui/AccessibilityStatusBarControl.cxx 
b/sw/source/uibase/utlui/AccessibilityStatusBarControl.cxx
index 55daee5d31d9..100313f709b1 100644
--- a/sw/source/uibase/utlui/AccessibilityStatusBarControl.cxx
+++ b/sw/source/uibase/utlui/AccessibilityStatusBarControl.cxx
@@ -10,16 +10,18 

[Libreoffice-commits] core.git: sw/inc sw/source

2022-11-17 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |   20 +++---
 sw/inc/node.hxx |   38 +--
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   64 +++-
 3 files changed, 65 insertions(+), 57 deletions(-)

New commits:
commit 1dfb746b8ca5d5d4ef21feb67d3921ab342d782f
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 24 23:42:44 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 17 10:06:39 2022 +0100

sw: Change online a11y checker again from SwContentNode to SwNode

This is needed because SwTableNode is not a content node, so we
need to work with the most generic SwNode and ask if the node
derives from sw::BroadcastingModify, which is required for node
tracking (SwTableNode and SwContentNode support that).

Change-Id: Idc28a5a9f1f8a250e2a28bb955ed320d02b6c1b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141787
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 47e42a27de29..7a37f05cc432 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -22,40 +22,40 @@ class SwTextNode;
 
 namespace sw
 {
-/// Contains the content node and tracks if the node
-/// gets deleted.
+/// Contains the node and tracks if the node gets deleted.
+/// Note: the node needs to extend sw::BroadcastingModify.
 class WeakContentNodeContainer : public SvtListener
 {
 private:
-SwContentNode* m_pNode;
+SwNode* m_pNode;
 
 public:
-WeakContentNodeContainer(SwContentNode* pNode);
+WeakContentNodeContainer(SwNode* pNode);
 ~WeakContentNodeContainer();
 
 /// Is the node still alive or it was deleted?
 bool isAlive();
 
-/// Returns the pointer of the content node or nullptr if the node
+/// Returns the pointer of the node or nullptr if the node
 /// got deleted.
-SwContentNode* getNode();
+SwNode* getNode();
 };
 
 class OnlineAccessibilityCheck : public SvtListener
 {
 private:
-std::map> 
m_aNodes;
+std::map> m_aNodes;
 
 SwDoc& m_rDocument;
 sw::AccessibilityCheck m_aAccessibilityCheck;
-SwContentNode* m_pPreviousNode;
+SwNode* m_pPreviousNode;
 SwNodeOffset m_nPreviousNodeIndex;
 sal_Int32 m_nAccessibilityIssues;
 bool m_bInitialCheck;
 
-void runAccessibilityCheck(SwContentNode* pNode);
+void runAccessibilityCheck(SwNode* pNode);
 void updateStatusbar();
-void updateNodeStatus(SwContentNode* pContentNode);
+void updateNodeStatus(SwNode* pContentNode);
 void initialCheck();
 
 public:
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index f62375044ca8..0d0561d6f024 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -80,6 +80,18 @@ namespace drawinglayer::attribute {
 typedef std::shared_ptr< SdrAllFillAttributesHelper > 
SdrAllFillAttributesHelperPtr;
 }
 
+// Accessibiity check
+
+namespace sw
+{
+struct AccessibilityCheckStatus
+{
+std::unique_ptr pCollection;
+bool bDirty = true;
+};
+
+}
+
 /// Base class of the Writer document model elements.
 class SW_DLLPUBLIC SwNode
 : public sw::BorderCacheOwner, private BigPtrEntry
@@ -92,6 +104,8 @@ class SW_DLLPUBLIC SwNode
 sal_uInt8 m_nAFormatNumLvl : 3;
 bool m_bIgnoreDontExpand : 1; ///< for Text Attributes - ignore the 
flag
 
+mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus;
+
 public:
 /// sw_redlinehide: redline node merge state
 enum class Merge { None, First, NonFirst, Hidden };
@@ -317,6 +331,11 @@ public:
 bool operator>(const SwNode& rOther) const { assert(() == 
()); return GetIndex() > rOther.GetIndex(); }
 bool operator>=(const SwNode& rOther) const { assert(() == 
()); return GetIndex() >= rOther.GetIndex(); }
 
+sw::AccessibilityCheckStatus& getAccessibilityCheckStatus()
+{
+return m_aAccessibilityCheckStatus;
+}
+
 private:
 SwNode( const SwNode & rNodes ) = delete;
 SwNode & operator= ( const SwNode & rNodes ) = delete;
@@ -368,18 +387,6 @@ class SwEndNode final : public SwNode
 SwEndNode & operator= ( const SwEndNode & rNode ) = delete;
 };
 
-// Accessibility check
-
-namespace sw
-{
-struct AccessibilityCheckStatus
-{
-std::unique_ptr pCollection;
-bool bDirty = true;
-};
-
-}
-
 // SwContentNode
 
 class SW_DLLPUBLIC SwContentNode: public sw::BroadcastingModify, public 
SwNode, public SwContentIndexReg
@@ -389,8 +396,6 @@ class SW_DLLPUBLIC SwContentNode: public 
sw::BroadcastingModify, public SwNode,
 SwFormatColl* m_pCondColl;
 mutable bool mbSetModifyAtAttr;
 
-mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus;
-
 protected:
 /// only used by SwContentNodeTmp in SwTextNode::Update
 SwContentNode();
@@ -515,11 +520,6 @@ public:
 
 void UpdateAttr(const SwUpdateAttr&);
 
-sw::AccessibilityCheckStatus& getAccessibilityCheckStatus()
-{
-return 

[Libreoffice-commits] core.git: sw/inc sw/source

2022-11-16 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |4 ++
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   30 ++--
 2 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit ef0858071faf93ce48237ea3948f50e288eb702b
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 24 22:38:56 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 17 05:47:28 2022 +0100

sw: initial a11y check - first run when the document is opened

When the document is opened we first need to run the a11y check
on the whole document so we can report the a11y state in the
statusbar and set the a11y issues to the nodes.

Change-Id: I0573e8fd695e3b0560fa0554f4702c88e7980a13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141786
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 9ec6f28ba6b1..47e42a27de29 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -51,10 +51,12 @@ private:
 SwContentNode* m_pPreviousNode;
 SwNodeOffset m_nPreviousNodeIndex;
 sal_Int32 m_nAccessibilityIssues;
+bool m_bInitialCheck;
 
-void runCheck(SwContentNode* pNode);
+void runAccessibilityCheck(SwContentNode* pNode);
 void updateStatusbar();
 void updateNodeStatus(SwContentNode* pContentNode);
+void initialCheck();
 
 public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index a2a9783c3fd1..7fb93c070f0f 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -61,6 +61,7 @@ OnlineAccessibilityCheck::OnlineAccessibilityCheck(SwDoc& 
rDocument)
 , m_pPreviousNode(nullptr)
 , m_nPreviousNodeIndex(-1)
 , m_nAccessibilityIssues(0)
+, m_bInitialCheck(false)
 {
 }
 
@@ -106,7 +107,7 @@ void OnlineAccessibilityCheck::updateStatusbar()
 pBindings->Invalidate(FN_STAT_ACCESSIBILITY_CHECK);
 }
 
-void OnlineAccessibilityCheck::runCheck(SwContentNode* pContentNode)
+void OnlineAccessibilityCheck::runAccessibilityCheck(SwContentNode* 
pContentNode)
 {
 m_aAccessibilityCheck.getIssueCollection().clear();
 
@@ -123,9 +124,28 @@ void OnlineAccessibilityCheck::runCheck(SwContentNode* 
pContentNode)
 
 pContentNode->getAccessibilityCheckStatus().pCollection
 = std::make_unique(aCollection);
+}
+
+void OnlineAccessibilityCheck::initialCheck()
+{
+if (m_bInitialCheck)
+return;
+
+auto const& pNodes = m_rDocument.GetNodes();
+for (SwNodeOffset n(0); n < pNodes.Count(); ++n)
+{
+SwNode* pNode = pNodes[n];
+if (pNode && pNode->IsContentNode())
+{
+auto* pCurrent = pNode->GetContentNode();
+runAccessibilityCheck(pCurrent);
+updateNodeStatus(pCurrent);
+}
+}
 
-updateNodeStatus(pContentNode);
 updateStatusbar();
+
+m_bInitialCheck = true;
 }
 
 void OnlineAccessibilityCheck::update(const SwPosition& rNewPos)
@@ -174,7 +194,9 @@ void OnlineAccessibilityCheck::update(const SwPosition& 
rNewPos)
 {
 auto* pContentNode = pNode->GetContentNode();
 
-runCheck(pContentNode);
+runAccessibilityCheck(pContentNode);
+updateNodeStatus(pContentNode);
+updateStatusbar();
 
 // Assign previous node and index
 EndListeningAll();
@@ -187,6 +209,8 @@ void OnlineAccessibilityCheck::update(const SwPosition& 
rNewPos)
 m_pPreviousNode = nullptr;
 m_nPreviousNodeIndex = SwNodeOffset(-1);
 }
+
+initialCheck();
 }
 
 } // end sw


[Libreoffice-commits] core.git: sw/inc sw/source

2022-11-16 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |   24 +
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   89 +++-
 2 files changed, 94 insertions(+), 19 deletions(-)

New commits:
commit ca03ea5c1ce7f1fa0702c004068a2592a723e669
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 24 22:19:06 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 17 05:47:03 2022 +0100

sw: track content node with a11y issues, so the number is correct

Track all content node with a11y issues and handle when they are
deleted (with WeakContentNodeContainer). At update, recount the
number of a11y issues that are contained in the content nodes and
update the overall number.

Change-Id: I254c62aba0d73a365f011b1609bcddec4dd71615
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141785
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index 48a639b9d656..9ec6f28ba6b1 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -15,15 +15,37 @@
 #include 
 #include 
 #include 
+#include 
 
 struct SwPosition;
 class SwTextNode;
 
 namespace sw
 {
+/// Contains the content node and tracks if the node
+/// gets deleted.
+class WeakContentNodeContainer : public SvtListener
+{
+private:
+SwContentNode* m_pNode;
+
+public:
+WeakContentNodeContainer(SwContentNode* pNode);
+~WeakContentNodeContainer();
+
+/// Is the node still alive or it was deleted?
+bool isAlive();
+
+/// Returns the pointer of the content node or nullptr if the node
+/// got deleted.
+SwContentNode* getNode();
+};
+
 class OnlineAccessibilityCheck : public SvtListener
 {
 private:
+std::map> 
m_aNodes;
+
 SwDoc& m_rDocument;
 sw::AccessibilityCheck m_aAccessibilityCheck;
 SwContentNode* m_pPreviousNode;
@@ -31,6 +53,8 @@ private:
 sal_Int32 m_nAccessibilityIssues;
 
 void runCheck(SwContentNode* pNode);
+void updateStatusbar();
+void updateNodeStatus(SwContentNode* pContentNode);
 
 public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index e34738466d99..a2a9783c3fd1 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -29,6 +29,32 @@
 
 namespace sw
 {
+WeakContentNodeContainer::WeakContentNodeContainer(SwContentNode* pNode)
+: m_pNode(pNode)
+{
+if (m_pNode)
+{
+EndListeningAll();
+StartListening(m_pNode->GetNotifier());
+}
+}
+
+WeakContentNodeContainer::~WeakContentNodeContainer() { EndListeningAll(); }
+
+bool WeakContentNodeContainer::isAlive()
+{
+if (!HasBroadcaster())
+m_pNode = nullptr;
+return m_pNode;
+}
+
+SwContentNode* WeakContentNodeContainer::getNode()
+{
+if (isAlive())
+return m_pNode;
+return nullptr;
+}
+
 OnlineAccessibilityCheck::OnlineAccessibilityCheck(SwDoc& rDocument)
 : m_rDocument(rDocument)
 , m_aAccessibilityCheck(_rDocument)
@@ -38,6 +64,48 @@ OnlineAccessibilityCheck::OnlineAccessibilityCheck(SwDoc& 
rDocument)
 {
 }
 
+void OnlineAccessibilityCheck::updateNodeStatus(SwContentNode* pContentNode)
+{
+m_nAccessibilityIssues = 0;
+
+auto it = m_aNodes.find(pContentNode);
+if (it == m_aNodes.end())
+{
+m_aNodes.emplace(pContentNode, 
std::make_unique(pContentNode));
+}
+
+for (auto iterator = m_aNodes.begin(); iterator != m_aNodes.end();)
+{
+auto& pWeakContentNode = iterator->second;
+if (pWeakContentNode->isAlive())
+{
+auto& rStatus = 
pWeakContentNode->getNode()->getAccessibilityCheckStatus();
+if (rStatus.pCollection)
+{
+m_nAccessibilityIssues += 
rStatus.pCollection->getIssues().size();
+++iterator;
+}
+else
+{
+iterator = m_aNodes.erase(iterator);
+}
+}
+else
+{
+iterator = m_aNodes.erase(iterator);
+}
+}
+}
+
+void OnlineAccessibilityCheck::updateStatusbar()
+{
+SfxBindings* pBindings = m_rDocument.GetDocShell() && 
m_rDocument.GetDocShell()->GetDispatcher()
+ ? 
m_rDocument.GetDocShell()->GetDispatcher()->GetBindings()
+ : nullptr;
+if (pBindings)
+pBindings->Invalidate(FN_STAT_ACCESSIBILITY_CHECK);
+}
+
 void OnlineAccessibilityCheck::runCheck(SwContentNode* pContentNode)
 {
 m_aAccessibilityCheck.getIssueCollection().clear();
@@ -56,25 +124,8 @@ void OnlineAccessibilityCheck::runCheck(SwContentNode* 
pContentNode)
 pContentNode->getAccessibilityCheckStatus().pCollection
 = std::make_unique(aCollection);
 
-m_nAccessibilityIssues = 0;
-auto const& pNodes = 

[Libreoffice-commits] core.git: sw/inc sw/source

2022-11-14 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/OnlineAccessibilityCheck.hxx |6 -
 sw/inc/ndtxt.hxx|   13 ---
 sw/inc/node.hxx |   21 
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |   85 +++-
 4 files changed, 71 insertions(+), 54 deletions(-)

New commits:
commit fad326833699293e5f4e3254881cb56889a220c0
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 24 09:46:43 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 15 07:30:15 2022 +0100

sw: Run a11y check for all content nodes

Change-Id: Icc3ff1be31a01b22242c48dec6d830e645ecb310
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141784
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
index f27f867ce96b..48a639b9d656 100644
--- a/sw/inc/OnlineAccessibilityCheck.hxx
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -26,11 +26,11 @@ class OnlineAccessibilityCheck : public SvtListener
 private:
 SwDoc& m_rDocument;
 sw::AccessibilityCheck m_aAccessibilityCheck;
-SwTextNode* m_pCurrentTextNode;
-SwNodeOffset m_aCurrentNodeIndex;
+SwContentNode* m_pPreviousNode;
+SwNodeOffset m_nPreviousNodeIndex;
 sal_Int32 m_nAccessibilityIssues;
 
-void runCheck(SwTextNode* pTextNode);
+void runCheck(SwContentNode* pNode);
 
 public:
 OnlineAccessibilityCheck(SwDoc& rDocument);
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 63b019cf8178..f28f2faf1e02 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -37,7 +37,6 @@
 #include 
 #include 
 #include 
-#include 
 
 class SfxHint;
 class SwNumRule;
@@ -102,12 +101,6 @@ struct ParagraphIdleData
 bool bAutoComplDirty = true;   ///< auto complete list dirty
 };
 
-struct AccessibilityCheckStatus
-{
-std::unique_ptr pCollection;
-bool bDirty = true;
-};
-
 } // end namespace sw
 
 /// SwTextNode is a paragraph in the document model.
@@ -135,7 +128,6 @@ class SW_DLLPUBLIC SwTextNode final
 OUString m_Text;
 
 mutable sw::ParagraphIdleData m_aParagraphIdleData;
-mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus;
 
 /** Some of the chars this para are hidden. Paragraph has to be reformatted
on changing the view to print preview. */
@@ -242,11 +234,6 @@ public:
 
 /// End: Data collected during idle time
 
-sw::AccessibilityCheckStatus& getAccessibilityCheckStatus()
-{
-return m_aAccessibilityCheckStatus;
-}
-
 public:
 using SwContentNode::GetAttr;
 /// for hanging TextFormatCollections somewhere else (Outline-Numbering!)
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 75096dd2aa28..38fdf2417be7 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -30,6 +30,8 @@
 #include "fmtcol.hxx"
 #include "nodeoffset.hxx"
 
+#include 
+
 #include 
 #include 
 
@@ -366,6 +368,18 @@ class SwEndNode final : public SwNode
 SwEndNode & operator= ( const SwEndNode & rNode ) = delete;
 };
 
+// Accessibiity check
+
+namespace sw
+{
+struct AccessibilityCheckStatus
+{
+std::unique_ptr pCollection;
+bool bDirty = true;
+};
+
+}
+
 // SwContentNode
 
 class SW_DLLPUBLIC SwContentNode: public sw::BroadcastingModify, public 
SwNode, public SwContentIndexReg
@@ -375,6 +389,8 @@ class SW_DLLPUBLIC SwContentNode: public 
sw::BroadcastingModify, public SwNode,
 SwFormatColl* m_pCondColl;
 mutable bool mbSetModifyAtAttr;
 
+mutable sw::AccessibilityCheckStatus m_aAccessibilityCheckStatus;
+
 protected:
 /// only used by SwContentNodeTmp in SwTextNode::Update
 SwContentNode();
@@ -499,6 +515,11 @@ public:
 
 void UpdateAttr(const SwUpdateAttr&);
 
+sw::AccessibilityCheckStatus& getAccessibilityCheckStatus()
+{
+return m_aAccessibilityCheckStatus;
+}
+
 private:
 SwContentNode( const SwContentNode & rNode ) = delete;
 SwContentNode & operator= ( const SwContentNode & rNode ) = delete;
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index a26be4e6e0ec..e34738466d99 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -32,17 +32,19 @@ namespace sw
 OnlineAccessibilityCheck::OnlineAccessibilityCheck(SwDoc& rDocument)
 : m_rDocument(rDocument)
 , m_aAccessibilityCheck(_rDocument)
-, m_pCurrentTextNode(nullptr)
-, m_aCurrentNodeIndex(-1)
+, m_pPreviousNode(nullptr)
+, m_nPreviousNodeIndex(-1)
 , m_nAccessibilityIssues(0)
 {
 }
 
-void OnlineAccessibilityCheck::runCheck(SwTextNode* pTextNode)
+void OnlineAccessibilityCheck::runCheck(SwContentNode* pContentNode)
 {
-m_aAccessibilityCheck.checkNode(pTextNode);
+m_aAccessibilityCheck.getIssueCollection().clear();
+
+m_aAccessibilityCheck.checkNode(pContentNode);
 
-for (SwFrameFormat* const& pFrameFormat : 

[Libreoffice-commits] core.git: sw/inc sw/Library_sw.mk sw/sdi sw/source sw/uiconfig

2022-11-14 Thread Tomaž Vajngerl (via logerrit)
 sw/Library_sw.mk |1 
 sw/inc/cmdid.h   |1 
 sw/sdi/_viewsh.sdi   |6 +
 sw/sdi/swriter.sdi   |   17 +
 sw/sdi/viewsh.sdi|6 +
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx  |   10 +++
 sw/source/uibase/app/swmodule.cxx|2 
 sw/source/uibase/inc/AccessibilityStatusBarControl.hxx   |   30 +
 sw/source/uibase/uiview/view2.cxx|   19 ++
 sw/source/uibase/utlui/AccessibilityStatusBarControl.cxx |   46 +++
 sw/uiconfig/sglobal/statusbar/statusbar.xml  |1 
 sw/uiconfig/swriter/statusbar/statusbar.xml  |1 
 12 files changed, 138 insertions(+), 2 deletions(-)

New commits:
commit e340b81d9d75d3aacfa941df4b531c6a9f5aaffa
Author: Tomaž Vajngerl 
AuthorDate: Thu Oct 20 22:35:52 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 15 00:04:16 2022 +0100

sw: add accessibility check statusbar control

A11y check statusbar control, which reports the current status of
the online a11y check.

Change-Id: I07528f39ed84136f99bc1ce07c10aa6163649305
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141605
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 7785ba9b6254..0e6c2679cb66 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -768,6 +768,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
 sw/source/uibase/uno/unomodule \
 sw/source/uibase/uno/unotxdoc \
 sw/source/uibase/uno/unotxvw \
+sw/source/uibase/utlui/AccessibilityStatusBarControl \
 sw/source/uibase/utlui/attrdesc \
 sw/source/uibase/utlui/bookctrl \
 sw/source/uibase/utlui/condedit \
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 5475184a5d2c..c0d31883c3e0 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -851,6 +851,7 @@ class SwUINumRuleItem;
 #define FN_STAT_SELMODE (FN_STAT + 5)
 #define FN_STAT_BOOKMARK(FN_STAT + 8)  /* For Popup Bookmarks*/
 #define FN_STAT_WORDCOUNT   (FN_STAT + 9)
+#define FN_STAT_ACCESSIBILITY_CHECK (FN_STAT + 10)
 
 // Region: Page preview
 #define FN_SHOW_TWO_PAGES   (FN_PGPREVIEW + 1)
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index b9fded634561..2dc3235cc3a8 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -398,6 +398,11 @@ interface BaseTextEditView
 ExecMethod = ExecuteStatusLine ;
 StateMethod = StateStatusLine ;
 ]
+FN_STAT_ACCESSIBILITY_CHECK // status()
+[
+ExecMethod = ExecuteStatusLine;
+StateMethod = StateStatusLine;
+]
 FN_STAT_BOOKMARK // status()
 [
 ExecMethod = ExecuteStatusLine ;
@@ -986,4 +991,3 @@ interface BaseTextEditView
 ]
 
 }
-
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index ca4aaf56ca8b..61e38bfe7f78 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -5974,6 +5974,23 @@ SfxStringItem StateWordCount FN_STAT_WORDCOUNT
 GroupId = SfxGroupId::View;
 ]
 
+SfxStringItem StateAccessibilityCheck FN_STAT_ACCESSIBILITY_CHECK
+
+[
+AutoUpdate = FALSE,
+FastCall = FALSE,
+ReadOnlyDoc = TRUE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+
+AccelConfig = FALSE,
+MenuConfig = FALSE,
+ToolBoxConfig = FALSE,
+GroupId = SfxGroupId::View;
+]
+
 SfxBoolItem SubScript FN_SET_SUB_SCRIPT
 
 [
diff --git a/sw/sdi/viewsh.sdi b/sw/sdi/viewsh.sdi
index cb02b883ba65..e4f3c0a362e0 100644
--- a/sw/sdi/viewsh.sdi
+++ b/sw/sdi/viewsh.sdi
@@ -464,6 +464,11 @@ interface TextPrintPreview
 ExecMethod = Execute ;
 StateMethod = GetState ;
 ]
+FN_STAT_ACCESSIBILITY_CHECK // status()
+[
+ExecMethod = Execute ;
+StateMethod = GetState ;
+]
 SID_JUMP_TO_SPECIFIC_PAGE // status()
 [
 ExecMethod = Execute ;
@@ -477,4 +482,3 @@ shell SwPagePreview
 {
 import TextPrintPreview;
 }
-
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index 109bac52545b..a26be4e6e0ec 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -21,6 +21,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
 
 namespace sw
@@ -63,6 +67,12 @@ void OnlineAccessibilityCheck::runCheck(SwTextNode* 
pTextNode)
 m_nAccessibilityIssues += 
rStatus.pCollection->getIssues().size();
 }
 }
+
+SfxBindings* pBindings = m_rDocument.GetDocShell() && 
m_rDocument.GetDocShell()->GetDispatcher()
+ ? 
m_rDocument.GetDocShell()->GetDispatcher()->GetBindings()
+ : nullptr;

[Libreoffice-commits] core.git: include/sfx2 officecfg/registry sfx2/source sw/inc sw/Library_sw.mk sw/source

2022-11-14 Thread Tomaž Vajngerl (via logerrit)
 include/sfx2/AccessibilityIssue.hxx|2 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   10 +
 sfx2/source/accessibility/AccessibilityIssue.cxx   |2 
 sw/Library_sw.mk   |1 
 sw/inc/OnlineAccessibilityCheck.hxx|   43 
 sw/inc/doc.hxx |6 
 sw/inc/ndtxt.hxx   |   12 +
 sw/source/core/crsr/crsrsh.cxx |4 
 sw/source/core/doc/docnew.cxx  |4 
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx|  124 +
 10 files changed, 207 insertions(+), 1 deletion(-)

New commits:
commit 0b96a1747fc3f96ca70fd159594fe1a478369da0
Author: Tomaž Vajngerl 
AuthorDate: Thu Oct 20 22:33:22 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 15 00:03:41 2022 +0100

sw: add online accessibility check implementation

Change-Id: Ic68aa91b1cbf23ac305ad4e361c56b91556757ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141604
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/sfx2/AccessibilityIssue.hxx 
b/include/sfx2/AccessibilityIssue.hxx
index 0c22d9e19238..d1bf1ee11766 100644
--- a/include/sfx2/AccessibilityIssue.hxx
+++ b/include/sfx2/AccessibilityIssue.hxx
@@ -59,6 +59,8 @@ public:
 AccessibilityIssueCollection() = default;
 
 std::vector>& getIssues();
+
+void clear();
 };
 
 } // end sfx namespace
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 5c0ae14167c1..2505345a8a39 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6338,6 +6338,16 @@
  
  false

+   
+
+  
+Enables online accessibility check, which checks for accessibility 
issues inside the document structure
+while the user edits the document.
+  
+  Enable/Disable online accessibility check.
+ 
+ false
+   
 
 
   
diff --git a/sfx2/source/accessibility/AccessibilityIssue.cxx 
b/sfx2/source/accessibility/AccessibilityIssue.cxx
index b276faf54c3f..aa58c3924476 100644
--- a/sfx2/source/accessibility/AccessibilityIssue.cxx
+++ b/sfx2/source/accessibility/AccessibilityIssue.cxx
@@ -24,6 +24,8 @@ std::vector>& 
AccessibilityIssueCollection::
 return m_aIssues;
 }
 
+void AccessibilityIssueCollection::clear() { m_aIssues.clear(); }
+
 } // end sfx namespace
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 483f00601b04..7785ba9b6254 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -430,6 +430,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
 sw/source/core/tox/ToxTextGenerator \
 sw/source/core/tox/ToxWhitespaceStripper \
 sw/source/core/txtnode/GrammarContact \
+sw/source/core/txtnode/OnlineAccessibilityCheck \
 sw/source/core/txtnode/attrcontentcontrol \
 sw/source/core/txtnode/atrfld \
 sw/source/core/txtnode/atrflyin \
diff --git a/sw/inc/OnlineAccessibilityCheck.hxx 
b/sw/inc/OnlineAccessibilityCheck.hxx
new file mode 100644
index ..f27f867ce96b
--- /dev/null
+++ b/sw/inc/OnlineAccessibilityCheck.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include "ndindex.hxx"
+#include "ndtxt.hxx"
+#include 
+#include 
+#include 
+
+struct SwPosition;
+class SwTextNode;
+
+namespace sw
+{
+class OnlineAccessibilityCheck : public SvtListener
+{
+private:
+SwDoc& m_rDocument;
+sw::AccessibilityCheck m_aAccessibilityCheck;
+SwTextNode* m_pCurrentTextNode;
+SwNodeOffset m_aCurrentNodeIndex;
+sal_Int32 m_nAccessibilityIssues;
+
+void runCheck(SwTextNode* pTextNode);
+
+public:
+OnlineAccessibilityCheck(SwDoc& rDocument);
+void update(const SwPosition& rNewPos);
+sal_Int32 getNumberOfAccessibilityIssues() { return 
m_nAccessibilityIssues; }
+};
+
+} // end sw
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index de5ec6112a00..80aa234cc6e3 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -163,6 +163,7 @@ namespace sw {
 class DocumentStylePoolManager;
 class DocumentExternalDataManager;
 class GrammarContact;
+class OnlineAccessibilityCheck;
 }
 
 namespace com::sun::star {
@@ -285,6 +286,7 @@ class SW_DLLPUBLIC SwDoc final
  

[Libreoffice-commits] core.git: sw/source

2022-11-13 Thread Tomaž Vajngerl (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   97 +++
 sw/source/core/inc/AccessibilityCheck.hxx|   28 ++-
 2 files changed, 80 insertions(+), 45 deletions(-)

New commits:
commit 6e66b5d75b4cda0314b64f4d12ef9e4350751470
Author: Tomaž Vajngerl 
AuthorDate: Thu Oct 20 22:23:06 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Nov 14 04:15:37 2022 +0100

sw: refactor to make a11y check for nodes independent

Add checkNodes, which will only check the current node for a11y
issues. This prepares for online a11y check.

Change-Id: I069cd200ceb58223b05baaafb7d796148e28398b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141603
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 897ee0d43c58..802dda2b95cd 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -77,19 +77,6 @@ lclAddIssue(sfx::AccessibilityIssueCollection& 
rIssueCollection, OUString const&
 return pIssue;
 }
 
-class BaseCheck
-{
-protected:
-sfx::AccessibilityIssueCollection& m_rIssueCollection;
-
-public:
-BaseCheck(sfx::AccessibilityIssueCollection& rIssueCollection)
-: m_rIssueCollection(rIssueCollection)
-{
-}
-virtual ~BaseCheck() {}
-};
-
 class NodeCheck : public BaseCheck
 {
 public:
@@ -1377,41 +1364,67 @@ void AccessibilityCheck::checkObject(SdrObject* pObject)
 }
 }
 
+void AccessibilityCheck::init()
+{
+if (m_aDocumentChecks.empty())
+{
+m_aDocumentChecks.emplace_back(new 
DocumentDefaultLanguageCheck(m_aIssueCollection));
+m_aDocumentChecks.emplace_back(new 
DocumentTitleCheck(m_aIssueCollection));
+m_aDocumentChecks.emplace_back(new 
FootnoteEndnoteCheck(m_aIssueCollection));
+m_aDocumentChecks.emplace_back(new 
BackgroundImageCheck(m_aIssueCollection));
+}
+
+if (m_aNodeChecks.empty())
+{
+m_aNodeChecks.emplace_back(new 
NoTextNodeAltTextCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new 
TableNodeMergeSplitCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new 
TableFormattingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new NumberingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new HyperlinkCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new TextContrastCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new BlinkingTextCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new HeaderCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new 
TextFormattingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new 
NonInteractiveFormCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new FloatingTextCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new TableHeadingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new HeadingOrderCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new 
NewlineSpacingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new SpaceSpacingCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new FakeFootnoteCheck(m_aIssueCollection));
+m_aNodeChecks.emplace_back(new FakeCaptionCheck(m_aIssueCollection));
+}
+}
+
+void AccessibilityCheck::checkNode(SwNode* pNode)
+{
+if (m_pDoc == nullptr || pNode == nullptr)
+return;
+
+init();
+
+for (std::shared_ptr& rpNodeCheck : m_aNodeChecks)
+{
+auto pNodeCheck = dynamic_cast(rpNodeCheck.get());
+if (pNodeCheck)
+pNodeCheck->check(pNode);
+}
+}
+
 void AccessibilityCheck::check()
 {
 if (m_pDoc == nullptr)
 return;
 
-std::vector> aDocumentChecks;
-
aDocumentChecks.push_back(std::make_unique(m_aIssueCollection));
-
aDocumentChecks.push_back(std::make_unique(m_aIssueCollection));
-
aDocumentChecks.push_back(std::make_unique(m_aIssueCollection));
-
aDocumentChecks.push_back(std::make_unique(m_aIssueCollection));
+init();
 
-for (std::unique_ptr& rpDocumentCheck : aDocumentChecks)
+for (std::shared_ptr& rpDocumentCheck : m_aDocumentChecks)
 {
-rpDocumentCheck->check(m_pDoc);
+auto pDocumentCheck = 
dynamic_cast(rpDocumentCheck.get());
+if (pDocumentCheck)
+pDocumentCheck->check(m_pDoc);
 }
 
-std::vector> aNodeChecks;
-
aNodeChecks.push_back(std::make_unique(m_aIssueCollection));
-
aNodeChecks.push_back(std::make_unique(m_aIssueCollection));
-
aNodeChecks.push_back(std::make_unique(m_aIssueCollection));
-
aNodeChecks.push_back(std::make_unique(m_aIssueCollection));
-
aNodeChecks.push_back(std::make_unique(m_aIssueCollection));
-
aNodeChecks.push_back(std::make_unique(m_aIssueCollection));
-
aNodeChecks.push_back(std::make_unique(m_aIssueCollection));

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/source

2022-11-12 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/view/output.cxx |   21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 2f5b91c4fd99dd13dacfc9ee675ddd2f32cf7b8c
Author: Tomaž Vajngerl 
AuthorDate: Sun Feb 6 18:30:39 2022 +0900
Commit: Aron Budea 
CommitDate: Sat Nov 12 15:19:37 2022 +0100

sc: fix rendering of conditional formatting icon

The bWorksInPixels flag isn't needed as it means some rendering
information is in pixel instead of logic, but we render in logic,
not in pixels as it is falsely assumed. So don't take into account
the bWorksInPixels flag and just render in pixels when LOKit is
active.

Change-Id: I3703d459a2d1444c397f2d9e97af9f0d3010d544
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129546
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit d0a11f591a57754362bb86c4bb07869bc18e5f75)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142609
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 1b40ae0b4b62..d2a65bac6df0 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -910,7 +910,7 @@ const BitmapEx& getIcon(sc::IconSetBitmapMap & 
rIconSetBitmapMap, ScIconSetType
 }
 
 void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* 
pOldIconSetInfo, const tools::Rectangle& rRect, tools::Long nOneX, tools::Long 
nOneY,
-sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
+sc::IconSetBitmapMap & rIconSetBitmapMap)
 {
 ScIconSetType eType = pOldIconSetInfo->eIconSetType;
 sal_Int32 nIndex = pOldIconSetInfo->nIconIndex;
@@ -920,16 +920,15 @@ void drawIconSets(vcl::RenderContext& rRenderContext, 
const ScIconSetInfo* pOldI
 
 if (pOldIconSetInfo->mnHeight)
 {
-if (bWorksInPixels)
+if (comphelper::LibreOfficeKit::isActive())
 {
 aHeight = rRenderContext.LogicToPixel(Size(0, 
pOldIconSetInfo->mnHeight), MapMode(MapUnit::MapTwip)).Height();
-if (comphelper::LibreOfficeKit::isActive())
-{
-aHeight *= comphelper::LibreOfficeKit::getDPIScale();
-}
+aHeight *= comphelper::LibreOfficeKit::getDPIScale();
 }
 else
+{
 aHeight = o3tl::convert(pOldIconSetInfo->mnHeight, 
o3tl::Length::twip, o3tl::Length::mm100);
+}
 }
 
 Size aSize = rIcon.GetSizePixel();
@@ -945,7 +944,7 @@ void drawIconSets(vcl::RenderContext& rRenderContext, const 
ScIconSetInfo* pOldI
 void drawCells(vcl::RenderContext& rRenderContext, std::optional const 
& pColor, const SvxBrushItem* pBackground, std::optional& pOldColor, 
const SvxBrushItem*& pOldBackground,
 tools::Rectangle& rRect, tools::Long nPosX, tools::Long nLayoutSign, 
tools::Long nOneX, tools::Long nOneY, const ScDataBarInfo* pDataBarInfo, const 
ScDataBarInfo*& pOldDataBarInfo,
 const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& 
pOldIconSetInfo,
-sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
+sc::IconSetBitmapMap & rIconSetBitmapMap)
 {
 tools::Long nSignedOneX = nOneX * nLayoutSign;
 // need to paint if old color scale has been used and now
@@ -962,7 +961,7 @@ void drawCells(vcl::RenderContext& rRenderContext, 
std::optional const &
 if( pOldDataBarInfo )
 drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY);
 if( pOldIconSetInfo )
-drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap, bWorksInPixels);
+drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap);
 
 rRect.SetLeft( nPosX - nSignedOneX );
 }
@@ -982,7 +981,7 @@ void drawCells(vcl::RenderContext& rRenderContext, 
std::optional const &
 if( pOldDataBarInfo )
 drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY);
 if( pOldIconSetInfo )
-drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap, bWorksInPixels);
+drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap);
 
 rRect.SetLeft( nPosX - nSignedOneX );
 }
@@ -1166,7 +1165,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& 
rRenderContext)
 if (bWorksInPixels)
 nPosXLogic = rRenderContext.PixelToLogic(Point(nPosX, 
0)).X();
 
-drawCells(rRenderContext, pColor, pBackground, pOldColor, 
pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, 
pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, 
mpDoc->GetIconSetBitmapMap(), bWorksInPixels);
+drawCells(rRenderContext, pColor, pBackground, pOldColor, 
pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/source

2022-11-12 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/view/output.cxx |   25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

New commits:
commit 3d86217598fd6507536d2c9998f9c404abae3d6a
Author: Tomaž Vajngerl 
AuthorDate: Mon Jan 10 14:54:31 2022 +0900
Commit: Aron Budea 
CommitDate: Sat Nov 12 15:19:17 2022 +0100

sc: fix cond. format icon size, when we work with pixels

This is the case when the device is bWorksInPixels is true, which
is the case when running LOKit.

Change-Id: Ibfced11bf614604521240908f4821fb9abfbf362
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128200
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit f2e1c6033890e513aa8e6b15dd6f26905d4622c8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142608
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 82126f68fe1d..1b40ae0b4b62 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -910,7 +910,7 @@ const BitmapEx& getIcon(sc::IconSetBitmapMap & 
rIconSetBitmapMap, ScIconSetType
 }
 
 void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* 
pOldIconSetInfo, const tools::Rectangle& rRect, tools::Long nOneX, tools::Long 
nOneY,
-sc::IconSetBitmapMap & rIconSetBitmapMap)
+sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
 {
 ScIconSetType eType = pOldIconSetInfo->eIconSetType;
 sal_Int32 nIndex = pOldIconSetInfo->nIconIndex;
@@ -919,7 +919,18 @@ void drawIconSets(vcl::RenderContext& rRenderContext, 
const ScIconSetInfo* pOldI
 tools::Long aHeight = o3tl::convert(10, o3tl::Length::pt, 
o3tl::Length::mm100);
 
 if (pOldIconSetInfo->mnHeight)
-aHeight = o3tl::convert(pOldIconSetInfo->mnHeight, o3tl::Length::twip, 
o3tl::Length::mm100);
+{
+if (bWorksInPixels)
+{
+aHeight = rRenderContext.LogicToPixel(Size(0, 
pOldIconSetInfo->mnHeight), MapMode(MapUnit::MapTwip)).Height();
+if (comphelper::LibreOfficeKit::isActive())
+{
+aHeight *= comphelper::LibreOfficeKit::getDPIScale();
+}
+}
+else
+aHeight = o3tl::convert(pOldIconSetInfo->mnHeight, 
o3tl::Length::twip, o3tl::Length::mm100);
+}
 
 Size aSize = rIcon.GetSizePixel();
 double fRatio = aSize.Width() / aSize.Height();
@@ -934,7 +945,7 @@ void drawIconSets(vcl::RenderContext& rRenderContext, const 
ScIconSetInfo* pOldI
 void drawCells(vcl::RenderContext& rRenderContext, std::optional const 
& pColor, const SvxBrushItem* pBackground, std::optional& pOldColor, 
const SvxBrushItem*& pOldBackground,
 tools::Rectangle& rRect, tools::Long nPosX, tools::Long nLayoutSign, 
tools::Long nOneX, tools::Long nOneY, const ScDataBarInfo* pDataBarInfo, const 
ScDataBarInfo*& pOldDataBarInfo,
 const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& 
pOldIconSetInfo,
-sc::IconSetBitmapMap & rIconSetBitmapMap)
+sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
 {
 tools::Long nSignedOneX = nOneX * nLayoutSign;
 // need to paint if old color scale has been used and now
@@ -951,7 +962,7 @@ void drawCells(vcl::RenderContext& rRenderContext, 
std::optional const &
 if( pOldDataBarInfo )
 drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY);
 if( pOldIconSetInfo )
-drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap);
+drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap, bWorksInPixels);
 
 rRect.SetLeft( nPosX - nSignedOneX );
 }
@@ -971,7 +982,7 @@ void drawCells(vcl::RenderContext& rRenderContext, 
std::optional const &
 if( pOldDataBarInfo )
 drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY);
 if( pOldIconSetInfo )
-drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap);
+drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap, bWorksInPixels);
 
 rRect.SetLeft( nPosX - nSignedOneX );
 }
@@ -1155,7 +1166,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& 
rRenderContext)
 if (bWorksInPixels)
 nPosXLogic = rRenderContext.PixelToLogic(Point(nPosX, 
0)).X();
 
-drawCells(rRenderContext, pColor, pBackground, pOldColor, 
pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, 
pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, 
mpDoc->GetIconSetBitmapMap());
+drawCells(rRenderContext, pColor, pBackground, pOldColor, 
pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, 
pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, 
mpDoc->GetIconSetBitmapMap(), 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 34 commits - basctl/source basegfx/CppunitTest_basegfx.mk basegfx/test chart2/source cui/inc cui/source dbaccess/CppunitTest_dbacce

2022-11-09 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit ed0dad35ec234c7c60a69f0b1e33ae02010cec8d
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 26 20:21:37 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 10 10:02:00 2022 +0900

svx: change PaperInfo to return gfx::Length paper sizes

Change-Id: Ie99a748ab9282893a852278be9793f7379522541

diff --git a/editeng/source/items/paperinf.cxx 
b/editeng/source/items/paperinf.cxx
index 86401e63f387..130e7c020a41 100644
--- a/editeng/source/items/paperinf.cxx
+++ b/editeng/source/items/paperinf.cxx
@@ -39,6 +39,12 @@ Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit 
)
 : OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM), 
MapMode(eUnit));
 }
 
+gfx::Size2DL SvxPaperInfo::getPaperSize(Paper ePaper)
+{
+PaperInfo aInfo(ePaper);
+return { gfx::Length::hmm(aInfo.getWidth()), 
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
 /*
  Description:   Return the paper size of the printer, aligned to our
 own sizes. If no Printer is set in the system, A4 portrait
@@ -108,6 +114,12 @@ Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit )
 : OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM), 
MapMode(eUnit));
 }
 
+gfx::Size2DL SvxPaperInfo::getDefaultPaperSize()
+{
+PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
+return { gfx::Length::hmm(aInfo.getWidth()), 
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
 /*
  Description:   String representation for the SV-defines of paper size
 */
diff --git a/include/editeng/paperinf.hxx b/include/editeng/paperinf.hxx
index 2ccc8fbf96fa..20bc1441ba74 100644
--- a/include/editeng/paperinf.hxx
+++ b/include/editeng/paperinf.hxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 // forward ---
@@ -42,6 +43,9 @@ public:
 static PaperGetSvxPaper( const Size , MapUnit eUnit );
 static tools::Long GetSloppyPaperDimension( tools::Long nSize );
 static OUString GetName( Paper ePaper );
+
+static gfx::Size2DL getPaperSize(Paper ePaper);
+static gfx::Size2DL getDefaultPaperSize();
 };
 
 // INLINE -
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index c9b38f1bbebf..c1a238f72c0f 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -371,6 +371,13 @@ public:
 , maLower(0_emu)
 {}
 
+Border(gfx::Length const& nLeft, gfx::Length const& nUpper, gfx::Length 
const& nRight, gfx::Length const& nLower)
+: maLeft(nLeft)
+, maRight(nRight)
+, maUpper(nUpper)
+, maLower(nLower)
+{}
+
 gfx::Length const& getLeft() const { return maLeft; }
 gfx::Length const& getRight() const { return maRight; }
 gfx::Length const& getUpper() const { return maUpper; }
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index a14e4382a8e0..4b8f8360e6ac 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -499,7 +499,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 return;
 
 // #i57181# Paper size depends on Language, like in Writer
-Size aDefSize = SvxPaperInfo::GetDefaultPaperSize( MapUnit::Map100thMM );
+gfx::Size2DL aDefaultSize = SvxPaperInfo::getDefaultPaperSize();
 
 // Insert handout page
 rtl::Reference pHandoutPage = AllocSdPage(false);
@@ -516,8 +516,8 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 }
 else
 {
-pHandoutPage->setSize(gfx::length::fromSizeHmm(aDefSize));
-pHandoutPage->SetBorder(0, 0, 0, 0);
+pHandoutPage->setSize(aDefaultSize);
+pHandoutPage->setBorder(svx::Border());
 }
 
 pHandoutPage->SetPageKind(PageKind::Handout);
@@ -553,7 +553,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 else if (meDocType == DocumentType::Draw)
 {
 // Draw: always use default size with margins
-pPage->setSize(gfx::length::fromSizeHmm(aDefSize));
+pPage->setSize(aDefaultSize);
 
 SfxPrinter* pPrinter = mpDocSh->GetPrinter(false);
 if (pPrinter && pPrinter->IsValid())
@@ -563,12 +563,12 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument 
const * pRefDocument /* =
 aPageOffset -= pPrinter->PixelToLogic( Point() );
 ::tools::Long nOffset = !aPageOffset.X() && !aPageOffset.Y() ? 
0 : PRINT_OFFSET;
 
-sal_uLong nTop= aPageOffset.Y();
-sal_uLong nLeft   = aPageOffset.X();
-sal_uLong nBottom = 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 2 commits - editeng/source include/editeng include/svx sd/source svx/source

2022-11-09 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit ed05ec17833bbef42b33e8cd8dd408f6a8354cd8
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 26 20:21:37 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 10 10:01:16 2022 +0900

svx: change PaperInfo to return gfx::Length paper sizes

Change-Id: Ie99a748ab9282893a852278be9793f7379522541

diff --git a/editeng/source/items/paperinf.cxx 
b/editeng/source/items/paperinf.cxx
index 86401e63f387..130e7c020a41 100644
--- a/editeng/source/items/paperinf.cxx
+++ b/editeng/source/items/paperinf.cxx
@@ -39,6 +39,12 @@ Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit 
)
 : OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM), 
MapMode(eUnit));
 }
 
+gfx::Size2DL SvxPaperInfo::getPaperSize(Paper ePaper)
+{
+PaperInfo aInfo(ePaper);
+return { gfx::Length::hmm(aInfo.getWidth()), 
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
 /*
  Description:   Return the paper size of the printer, aligned to our
 own sizes. If no Printer is set in the system, A4 portrait
@@ -108,6 +114,12 @@ Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit )
 : OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM), 
MapMode(eUnit));
 }
 
+gfx::Size2DL SvxPaperInfo::getDefaultPaperSize()
+{
+PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
+return { gfx::Length::hmm(aInfo.getWidth()), 
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
 /*
  Description:   String representation for the SV-defines of paper size
 */
diff --git a/include/editeng/paperinf.hxx b/include/editeng/paperinf.hxx
index 2ccc8fbf96fa..20bc1441ba74 100644
--- a/include/editeng/paperinf.hxx
+++ b/include/editeng/paperinf.hxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 // forward ---
@@ -42,6 +43,9 @@ public:
 static PaperGetSvxPaper( const Size , MapUnit eUnit );
 static tools::Long GetSloppyPaperDimension( tools::Long nSize );
 static OUString GetName( Paper ePaper );
+
+static gfx::Size2DL getPaperSize(Paper ePaper);
+static gfx::Size2DL getDefaultPaperSize();
 };
 
 // INLINE -
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index c9b38f1bbebf..c1a238f72c0f 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -371,6 +371,13 @@ public:
 , maLower(0_emu)
 {}
 
+Border(gfx::Length const& nLeft, gfx::Length const& nUpper, gfx::Length 
const& nRight, gfx::Length const& nLower)
+: maLeft(nLeft)
+, maRight(nRight)
+, maUpper(nUpper)
+, maLower(nLower)
+{}
+
 gfx::Length const& getLeft() const { return maLeft; }
 gfx::Length const& getRight() const { return maRight; }
 gfx::Length const& getUpper() const { return maUpper; }
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index a14e4382a8e0..4b8f8360e6ac 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -499,7 +499,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 return;
 
 // #i57181# Paper size depends on Language, like in Writer
-Size aDefSize = SvxPaperInfo::GetDefaultPaperSize( MapUnit::Map100thMM );
+gfx::Size2DL aDefaultSize = SvxPaperInfo::getDefaultPaperSize();
 
 // Insert handout page
 rtl::Reference pHandoutPage = AllocSdPage(false);
@@ -516,8 +516,8 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 }
 else
 {
-pHandoutPage->setSize(gfx::length::fromSizeHmm(aDefSize));
-pHandoutPage->SetBorder(0, 0, 0, 0);
+pHandoutPage->setSize(aDefaultSize);
+pHandoutPage->setBorder(svx::Border());
 }
 
 pHandoutPage->SetPageKind(PageKind::Handout);
@@ -553,7 +553,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 else if (meDocType == DocumentType::Draw)
 {
 // Draw: always use default size with margins
-pPage->setSize(gfx::length::fromSizeHmm(aDefSize));
+pPage->setSize(aDefaultSize);
 
 SfxPrinter* pPrinter = mpDocSh->GetPrinter(false);
 if (pPrinter && pPrinter->IsValid())
@@ -563,12 +563,12 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument 
const * pRefDocument /* =
 aPageOffset -= pPrinter->PixelToLogic( Point() );
 ::tools::Long nOffset = !aPageOffset.X() && !aPageOffset.Y() ? 
0 : PRINT_OFFSET;
 
-sal_uLong nTop= aPageOffset.Y();
-sal_uLong nLeft   = aPageOffset.X();
-sal_uLong nBottom = 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 162 commits - basctl/source basegfx/CppunitTest_basegfx.mk basegfx/test basic/source chart2/qa chart2/source chart2/uiconfig .clang

2022-11-09 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit 98d609d4bba69815d0e972ee61383694372b32e4
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 26 20:21:37 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 10 00:02:41 2022 +0900

svx: change PaperInfo to return gfx::Length paper sizes

Change-Id: Ie99a748ab9282893a852278be9793f7379522541

diff --git a/editeng/source/items/paperinf.cxx 
b/editeng/source/items/paperinf.cxx
index 86401e63f387..130e7c020a41 100644
--- a/editeng/source/items/paperinf.cxx
+++ b/editeng/source/items/paperinf.cxx
@@ -39,6 +39,12 @@ Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit 
)
 : OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM), 
MapMode(eUnit));
 }
 
+gfx::Size2DL SvxPaperInfo::getPaperSize(Paper ePaper)
+{
+PaperInfo aInfo(ePaper);
+return { gfx::Length::hmm(aInfo.getWidth()), 
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
 /*
  Description:   Return the paper size of the printer, aligned to our
 own sizes. If no Printer is set in the system, A4 portrait
@@ -108,6 +114,12 @@ Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit )
 : OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM), 
MapMode(eUnit));
 }
 
+gfx::Size2DL SvxPaperInfo::getDefaultPaperSize()
+{
+PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
+return { gfx::Length::hmm(aInfo.getWidth()), 
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
 /*
  Description:   String representation for the SV-defines of paper size
 */
diff --git a/include/editeng/paperinf.hxx b/include/editeng/paperinf.hxx
index 2ccc8fbf96fa..20bc1441ba74 100644
--- a/include/editeng/paperinf.hxx
+++ b/include/editeng/paperinf.hxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 // forward ---
@@ -42,6 +43,9 @@ public:
 static PaperGetSvxPaper( const Size , MapUnit eUnit );
 static tools::Long GetSloppyPaperDimension( tools::Long nSize );
 static OUString GetName( Paper ePaper );
+
+static gfx::Size2DL getPaperSize(Paper ePaper);
+static gfx::Size2DL getDefaultPaperSize();
 };
 
 // INLINE -
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index c9b38f1bbebf..c1a238f72c0f 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -371,6 +371,13 @@ public:
 , maLower(0_emu)
 {}
 
+Border(gfx::Length const& nLeft, gfx::Length const& nUpper, gfx::Length 
const& nRight, gfx::Length const& nLower)
+: maLeft(nLeft)
+, maRight(nRight)
+, maUpper(nUpper)
+, maLower(nLower)
+{}
+
 gfx::Length const& getLeft() const { return maLeft; }
 gfx::Length const& getRight() const { return maRight; }
 gfx::Length const& getUpper() const { return maUpper; }
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index a14e4382a8e0..4b8f8360e6ac 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -499,7 +499,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 return;
 
 // #i57181# Paper size depends on Language, like in Writer
-Size aDefSize = SvxPaperInfo::GetDefaultPaperSize( MapUnit::Map100thMM );
+gfx::Size2DL aDefaultSize = SvxPaperInfo::getDefaultPaperSize();
 
 // Insert handout page
 rtl::Reference pHandoutPage = AllocSdPage(false);
@@ -516,8 +516,8 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 }
 else
 {
-pHandoutPage->setSize(gfx::length::fromSizeHmm(aDefSize));
-pHandoutPage->SetBorder(0, 0, 0, 0);
+pHandoutPage->setSize(aDefaultSize);
+pHandoutPage->setBorder(svx::Border());
 }
 
 pHandoutPage->SetPageKind(PageKind::Handout);
@@ -553,7 +553,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 else if (meDocType == DocumentType::Draw)
 {
 // Draw: always use default size with margins
-pPage->setSize(gfx::length::fromSizeHmm(aDefSize));
+pPage->setSize(aDefaultSize);
 
 SfxPrinter* pPrinter = mpDocSh->GetPrinter(false);
 if (pPrinter && pPrinter->IsValid())
@@ -563,12 +563,12 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument 
const * pRefDocument /* =
 aPageOffset -= pPrinter->PixelToLogic( Point() );
 ::tools::Long nOffset = !aPageOffset.X() && !aPageOffset.Y() ? 
0 : PRINT_OFFSET;
 
-sal_uLong nTop= aPageOffset.Y();
-sal_uLong nLeft   = aPageOffset.X();
-sal_uLong nBottom = 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 191 commits - basctl/source basegfx/CppunitTest_basegfx.mk basegfx/test bin/upload_symbols.py chart2/qa chart2/source configure.ac

2022-11-04 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit 3992e14a0a0d2ced60c55c999a9755d2ea73c4cd
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 26 20:21:37 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Fri Nov 4 20:39:15 2022 +0100

svx: change PaperInfo to return gfx::Length paper sizes

Change-Id: Ie99a748ab9282893a852278be9793f7379522541

diff --git a/editeng/source/items/paperinf.cxx 
b/editeng/source/items/paperinf.cxx
index 86401e63f387..130e7c020a41 100644
--- a/editeng/source/items/paperinf.cxx
+++ b/editeng/source/items/paperinf.cxx
@@ -39,6 +39,12 @@ Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit 
)
 : OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM), 
MapMode(eUnit));
 }
 
+gfx::Size2DL SvxPaperInfo::getPaperSize(Paper ePaper)
+{
+PaperInfo aInfo(ePaper);
+return { gfx::Length::hmm(aInfo.getWidth()), 
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
 /*
  Description:   Return the paper size of the printer, aligned to our
 own sizes. If no Printer is set in the system, A4 portrait
@@ -108,6 +114,12 @@ Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit )
 : OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM), 
MapMode(eUnit));
 }
 
+gfx::Size2DL SvxPaperInfo::getDefaultPaperSize()
+{
+PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
+return { gfx::Length::hmm(aInfo.getWidth()), 
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
 /*
  Description:   String representation for the SV-defines of paper size
 */
diff --git a/include/editeng/paperinf.hxx b/include/editeng/paperinf.hxx
index 2ccc8fbf96fa..20bc1441ba74 100644
--- a/include/editeng/paperinf.hxx
+++ b/include/editeng/paperinf.hxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 // forward ---
@@ -42,6 +43,9 @@ public:
 static PaperGetSvxPaper( const Size , MapUnit eUnit );
 static tools::Long GetSloppyPaperDimension( tools::Long nSize );
 static OUString GetName( Paper ePaper );
+
+static gfx::Size2DL getPaperSize(Paper ePaper);
+static gfx::Size2DL getDefaultPaperSize();
 };
 
 // INLINE -
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index c9b38f1bbebf..c1a238f72c0f 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -371,6 +371,13 @@ public:
 , maLower(0_emu)
 {}
 
+Border(gfx::Length const& nLeft, gfx::Length const& nUpper, gfx::Length 
const& nRight, gfx::Length const& nLower)
+: maLeft(nLeft)
+, maRight(nRight)
+, maUpper(nUpper)
+, maLower(nLower)
+{}
+
 gfx::Length const& getLeft() const { return maLeft; }
 gfx::Length const& getRight() const { return maRight; }
 gfx::Length const& getUpper() const { return maUpper; }
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index a14e4382a8e0..4b8f8360e6ac 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -499,7 +499,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 return;
 
 // #i57181# Paper size depends on Language, like in Writer
-Size aDefSize = SvxPaperInfo::GetDefaultPaperSize( MapUnit::Map100thMM );
+gfx::Size2DL aDefaultSize = SvxPaperInfo::getDefaultPaperSize();
 
 // Insert handout page
 rtl::Reference pHandoutPage = AllocSdPage(false);
@@ -516,8 +516,8 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 }
 else
 {
-pHandoutPage->setSize(gfx::length::fromSizeHmm(aDefSize));
-pHandoutPage->SetBorder(0, 0, 0, 0);
+pHandoutPage->setSize(aDefaultSize);
+pHandoutPage->setBorder(svx::Border());
 }
 
 pHandoutPage->SetPageKind(PageKind::Handout);
@@ -553,7 +553,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 else if (meDocType == DocumentType::Draw)
 {
 // Draw: always use default size with margins
-pPage->setSize(gfx::length::fromSizeHmm(aDefSize));
+pPage->setSize(aDefaultSize);
 
 SfxPrinter* pPrinter = mpDocSh->GetPrinter(false);
 if (pPrinter && pPrinter->IsValid())
@@ -563,12 +563,12 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument 
const * pRefDocument /* =
 aPageOffset -= pPrinter->PixelToLogic( Point() );
 ::tools::Long nOffset = !aPageOffset.X() && !aPageOffset.Y() ? 
0 : PRINT_OFFSET;
 
-sal_uLong nTop= aPageOffset.Y();
-sal_uLong nLeft   = aPageOffset.X();
-sal_uLong nBottom = 

[Libreoffice-commits] core.git: sd/qa vcl/source

2022-11-04 Thread Tomaž Vajngerl (via logerrit)
 sd/qa/unit/data/odg/FitToFrameText.odg |binary
 sd/qa/unit/layout-tests.cxx|   22 ++
 vcl/source/gdi/mtfxmldump.cxx  |7 ++-
 3 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 14175b130ff97c5576ff872dcf3163954c6f80f8
Author: Tomaž Vajngerl 
AuthorDate: Wed Nov 2 22:48:35 2022 +0100
Commit: Tomaž Vajngerl 
CommitDate: Fri Nov 4 15:18:39 2022 +0100

add a test for "fit to frame" text rendering

Change-Id: If304f12e1f1fbe3afea4885975302b77b428567f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142187
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sd/qa/unit/data/odg/FitToFrameText.odg 
b/sd/qa/unit/data/odg/FitToFrameText.odg
new file mode 100644
index ..e65b0a3a2102
Binary files /dev/null and b/sd/qa/unit/data/odg/FitToFrameText.odg differ
diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx
index 2a7c0e0a200b..d2bf22622885 100644
--- a/sd/qa/unit/layout-tests.cxx
+++ b/sd/qa/unit/layout-tests.cxx
@@ -292,6 +292,28 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testBnc480256)
 assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[8]/linecolor[1]", 
"color", "#ff");
 }
 
+CPPUNIT_TEST_FIXTURE(SdLayoutTest, testFitToFrameTextFitting)
+{
+// This test checks that the text fitting is working correctly when
+// the textbox is set to "fit to frame" by stretching the text to or
+// near the textbox boundary. The problem is especially complicated
+// when the font size is set to a higher number (like 999)
+//
+// The text fitting behaviour when "fit by frame" is enabled is to
+// always fit the text into the text box (without forcing the text
+// into new line) by shrinking or expanding the text horizontally
+// and vertically.
+
+xmlDocUniquePtr pXmlDoc = load("odg/FitToFrameText.odg");
+
+assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]", "x", "0");
+assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]", "y", "406");
+assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]/dxarray", 
"first", "114");
+#ifndef _WIN32 // Windows seems to differ in text layouting, so ignore for now
+assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]/dxarray", 
"last", "7010");
+#endif
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
index 2dc7e7b9d3e1..5319c2834686 100644
--- a/vcl/source/gdi/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -811,11 +811,16 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& 
rMetaFile, tools::XmlWriter& r
 
 if (!pMetaTextArrayAction->GetDXArray().empty())
 {
+auto & rArray = pMetaTextArrayAction->GetDXArray();
 rWriter.startElement("dxarray");
+if (aIndex < o3tl::narrowing(rArray.size()))
+rWriter.attribute("first", rArray[aIndex]);
+if (aIndex + aLength - 1 < 
o3tl::narrowing(rArray.size()))
+rWriter.attribute("last", rArray[aIndex + aLength - 
1]);
 OUStringBuffer sDxLengthString;
 for (sal_Int32 i = 0; i < aLength - aIndex; ++i)
 {
-
sDxLengthString.append(pMetaTextArrayAction->GetDXArray()[aIndex + i]);
+sDxLengthString.append(rArray[aIndex + i]);
 sDxLengthString.append(" ");
 }
 rWriter.content(sDxLengthString);


[Libreoffice-commits] core.git: Branch 'distro/vector/vector-7.0' - 6 commits - editeng/inc editeng/source include/editeng include/svl include/svx oox/source sd/qa sd/source svx/source

2022-11-03 Thread Tomaž Vajngerl (via logerrit)
 editeng/inc/editdoc.hxx |   28 
 editeng/source/editeng/editdoc.cxx  |8 -
 editeng/source/editeng/editeng.cxx  |4 
 editeng/source/editeng/editobj.cxx  |6 
 editeng/source/editeng/editobj2.hxx |   10 -
 editeng/source/editeng/impedit.hxx  |   30 ++--
 editeng/source/editeng/impedit2.cxx |4 
 editeng/source/editeng/impedit3.cxx |  118 +--
 editeng/source/editeng/impedit4.cxx |6 
 editeng/source/outliner/outlin2.cxx |7 -
 editeng/source/outliner/outliner.cxx|   12 -
 include/editeng/editeng.hxx |4 
 include/editeng/outliner.hxx|4 
 include/svl/solar.hrc   |2 
 include/svx/svdotext.hxx|2 
 include/svx/unoshprp.hxx|4 
 oox/source/export/drawingml.cxx |5 
 sd/qa/unit/export-tests-ooxml2.cxx  |5 
 sd/source/ui/view/drtxtob.cxx   |6 
 svx/source/svdraw/svdotext.cxx  |  171 
 svx/source/svdraw/svdotextdecomposition.cxx |2 
 svx/source/unodraw/unoshape.cxx |   26 
 22 files changed, 246 insertions(+), 218 deletions(-)

New commits:
commit e87afb348cbb4e9e37cd3e6b1cca031a48f137ca
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 31 13:28:27 2022 +0100
Commit: Miklos Vajna 
CommitDate: Thu Nov 3 15:39:27 2022 +0100

fix rendering of text when "fit to frame" is enabled

This changes the nStretchX and nStretchY from sal_uInt16 to double
so the text in text boxes is rendered correctly (text should be
resized to the same size as the textbox).

(cherry picked from commit 4c349be1d74c669e5804c3c43f3f0a3960c88bc5)

Conflicts:
editeng/source/editeng/impedit.hxx
editeng/source/editeng/impedit4.cxx
sd/qa/unit/import-tests2.cxx
sd/source/ui/view/drtxtob.cxx
svx/source/svdraw/svdotext.cxx

Change-Id: Ic92d03043af0abe86f1b67ae15522d0176ebb

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 73d85a07b7ce..e8f57b80cd5e 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2251,12 +2251,12 @@ bool EditEngine::HasText( const SvxSearchItem& 
rSearchItem )
 return pImpEditEngine->HasText( rSearchItem );
 }
 
-void EditEngine::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
+void EditEngine::SetGlobalCharStretching(double nX, double nY)
 {
 pImpEditEngine->SetCharStretching( nX, nY );
 }
 
-void EditEngine::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+void EditEngine::GetGlobalCharStretching(double& rX, double& rY) const
 {
 pImpEditEngine->GetCharStretching( rX, rY );
 }
diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index f93d4a6205ad..6d42ec021e5a 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -79,10 +79,10 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew)
 }
 
 XParaPortionList::XParaPortionList(
-OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 _nStretchX, sal_uInt16 
_nStretchY)
+OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, double nStretchY)
 : pRefDevPtr(pRefDev)
-, nStretchX(_nStretchX)
-, nStretchY(_nStretchY)
+, mnStretchX(nStretchX)
+, mnStretchY(nStretchY)
 , nPaperWidth(nPW)
 {
 }
diff --git a/editeng/source/editeng/editobj2.hxx 
b/editeng/source/editeng/editobj2.hxx
index 41bbc5404e50..e817f68cc8a6 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -95,12 +95,12 @@ class XParaPortionList
 ListType maList;
 
 VclPtr pRefDevPtr;
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double  mnStretchX;
+double  mnStretchY;
 sal_uInt32  nPaperWidth;
 
 public:
-XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 
_nStretchX, sal_uInt16 _nStretchY);
+XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, 
double nStretchY);
 
 void push_back(XParaPortion* p);
 const XParaPortion& operator[](size_t i) const;
@@ -109,8 +109,8 @@ public:
 sal_uInt32  GetPaperWidth() const   { return nPaperWidth; }
 boolRefDevIsVirtual() const {return 
pRefDevPtr->IsVirtual();}
 const MapMode&  GetRefMapMode() const   { return 
pRefDevPtr->GetMapMode(); }
-sal_uInt16  GetStretchX() const { return nStretchX; }
-sal_uInt16  GetStretchY() const { return nStretchY; }
+double  GetStretchX() const { return mnStretchX; }
+double  GetStretchY() const { return mnStretchY; }
 };
 
 class ContentInfo
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index bf6196953ea6..9c4159ec9796 100644
--- 

[Libreoffice-commits] core.git: sd/qa svx/source

2022-11-03 Thread Tomaž Vajngerl (via logerrit)
 sd/qa/unit/export-tests-ooxml3.cxx |2 +-
 svx/source/svdraw/svdotext.cxx |   15 +++
 2 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit 7f73a779e33dd91fad0111629c6b3420c2c9aea0
Author: Tomaž Vajngerl 
AuthorDate: Wed Nov 2 20:15:31 2022 +0100
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 3 09:53:54 2022 +0100

optimize text fitting algorithm to correctly calculate the fit

As we converted the chart stretching variable from int to double
this can cause the text fitting algorithm to calculate the fit
wrong. This commit changes the text fitting algorithm a bit so
that it produces similar result as before the change.

Change test testAutofittedTextboxIndent from 691200 to 712800 as
the fitting algorithm changed a bit. Visually the document still
looks correct.

Change-Id: Ib75733360039d80a5aed836f757c3f8e8ec56d61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142186
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 62fe34150896..2f2576ed1ce6 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -2068,7 +2068,7 @@ void SdOOXMLExportTest3::testAutofittedTextboxIndent()
 
 xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile, 
"ppt/slides/slide1.xml");
 assertXPath(pXmlDocContent1, 
"/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p[1]/a:pPr", "marL",
-"691200");
+"712800");
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest3);
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 5e2a8721cd89..6e47273fe175 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1252,9 +1252,8 @@ void SdrTextObj::ImpAutoFitText(SdrOutliner& rOutliner, 
const Size& rTextSize,
 // loop early-exits if we detect an already attained value
 double nMinStretchX = 0.0;
 double nMinStretchY = 0.0;
-sal_uInt16 aOldStretchXVals[]={0,0,0,0,0,0,0,0,0,0};
-const size_t aStretchArySize=SAL_N_ELEMENTS(aOldStretchXVals);
-for(unsigned int i=0; i aOldStretchXVals = {0,0,0,0,0,0,0,0,0,0};
+for (size_t i = 0; i < aOldStretchXVals.size(); ++i)
 {
 const Size aCurrTextSize = rOutliner.CalcTextSizeNTP();
 double fFactor = 1.0;
@@ -1279,7 +1278,7 @@ void SdrTextObj::ImpAutoFitText(SdrOutliner& rOutliner, 
const Size& rTextSize,
 double nCurrStretchX, nCurrStretchY;
 rOutliner.GetGlobalCharStretching(nCurrStretchX, nCurrStretchY);
 
-if (fFactor >= 1.0 )
+if (fFactor >= 0.98)
 {
 // resulting text area fits into available shape rect -
 // err on the larger stretching, to optimally fill area
@@ -1287,14 +1286,14 @@ void SdrTextObj::ImpAutoFitText(SdrOutliner& rOutliner, 
const Size& rTextSize,
 nMinStretchY = std::max(nMinStretchY, nCurrStretchY);
 }
 
-aOldStretchXVals[i] = nCurrStretchX;
-if( std::find(aOldStretchXVals, aOldStretchXVals+i, nCurrStretchX) != 
aOldStretchXVals+i )
+aOldStretchXVals[i] = basegfx::fround(nCurrStretchX * 10.0);
+if (std::find(aOldStretchXVals.begin(), aOldStretchXVals.begin() + i, 
basegfx::fround(nCurrStretchX * 10.0)) != aOldStretchXVals.begin() + i)
 break; // same value already attained once; algo is looping, exit
 
 if (fFactor < 1.0 || nCurrStretchX != 100)
 {
-nCurrStretchX = nCurrStretchX * fFactor;
-nCurrStretchY = nCurrStretchY * fFactor;
+nCurrStretchX = double(basegfx::fround(nCurrStretchX * fFactor * 
100.0)) / 100.00;
+nCurrStretchY = double(basegfx::fround(nCurrStretchY * fFactor * 
100.0)) / 100.00;
 
 rOutliner.SetGlobalCharStretching(std::min(100.0, nCurrStretchX), 
std::min(100.0, nCurrStretchY));
 SAL_INFO("svx", "zoom is " << nCurrStretchX);


[Libreoffice-commits] core.git: editeng/source include/editeng sd/qa sd/source svx/source

2022-11-03 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/editeng/editeng.cxx  |4 -
 editeng/source/editeng/editobj.cxx  |6 -
 editeng/source/editeng/editobj2.hxx |   10 +-
 editeng/source/editeng/impedit.hxx  |   30 +++
 editeng/source/editeng/impedit2.cxx |4 -
 editeng/source/editeng/impedit3.cxx |   41 --
 editeng/source/editeng/impedit4.cxx |6 -
 editeng/source/outliner/outlin2.cxx |7 -
 editeng/source/outliner/outliner.cxx|   12 +--
 include/editeng/editeng.hxx |4 -
 include/editeng/outliner.hxx|4 -
 sd/qa/unit/import-tests2.cxx|4 -
 sd/source/ui/view/drtxtob.cxx   |6 -
 svx/source/svdraw/svdotext.cxx  |  110 ++--
 svx/source/svdraw/svdotextdecomposition.cxx |2 
 15 files changed, 139 insertions(+), 111 deletions(-)

New commits:
commit 4c349be1d74c669e5804c3c43f3f0a3960c88bc5
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 31 13:28:27 2022 +0100
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 3 07:24:22 2022 +0100

fix rendering of text when "fit to frame" is enabled

This changes the nStretchX and nStretchY from sal_uInt16 to double
so the text in text boxes is rendered correctly (text should be
resized to the same size as the textbox).

Change-Id: Ic92d03043af0abe86f1b67ae15522d0176ebb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142064
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 88bc04a9efed..c8a66d0470a4 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2266,12 +2266,12 @@ bool EditEngine::HasText( const SvxSearchItem& 
rSearchItem )
 return pImpEditEngine->HasText( rSearchItem );
 }
 
-void EditEngine::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
+void EditEngine::SetGlobalCharStretching(double nX, double nY)
 {
 pImpEditEngine->SetCharStretching( nX, nY );
 }
 
-void EditEngine::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+void EditEngine::GetGlobalCharStretching(double& rX, double& rY) const
 {
 pImpEditEngine->GetCharStretching( rX, rY );
 }
diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index 6d57c7497c2b..437754d70def 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -71,10 +71,10 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew)
 }
 
 XParaPortionList::XParaPortionList(
-OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 _nStretchX, sal_uInt16 
_nStretchY)
+OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, double nStretchY)
 : pRefDevPtr(pRefDev)
-, nStretchX(_nStretchX)
-, nStretchY(_nStretchY)
+, mnStretchX(nStretchX)
+, mnStretchY(nStretchY)
 , nPaperWidth(nPW)
 {
 }
diff --git a/editeng/source/editeng/editobj2.hxx 
b/editeng/source/editeng/editobj2.hxx
index 250341fd4283..86a2e379be20 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -94,12 +94,12 @@ class XParaPortionList
 ListType maList;
 
 VclPtr pRefDevPtr;
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double  mnStretchX;
+double  mnStretchY;
 sal_uInt32  nPaperWidth;
 
 public:
-XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 
_nStretchX, sal_uInt16 _nStretchY);
+XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, 
double nStretchY);
 
 void push_back(XParaPortion* p);
 const XParaPortion& operator[](size_t i) const;
@@ -108,8 +108,8 @@ public:
 sal_uInt32  GetPaperWidth() const   { return nPaperWidth; }
 boolRefDevIsVirtual() const {return 
pRefDevPtr->IsVirtual();}
 const MapMode&  GetRefMapMode() const   { return 
pRefDevPtr->GetMapMode(); }
-sal_uInt16  GetStretchX() const { return nStretchX; }
-sal_uInt16  GetStretchY() const { return nStretchY; }
+double  GetStretchX() const { return mnStretchX; }
+double  GetStretchY() const { return mnStretchY; }
 };
 
 class ContentInfo
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index b761e3bc4135..f75e71b7f509 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -528,8 +528,8 @@ private:
 
 Color   maBackgroundColor;
 
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double mnStretchX;
+double mnStretchY;
 
 CharCompressTypenAsianCompressionMode;
 
@@ -1080,8 +1080,8 @@ public:
 SvxCellJustifyMethodGetJustifyMethod( sal_Int32 nPara ) const;
 SvxCellVerJustify   GetVerJustification( sal_Int32 nPara ) const;
 
-voidSetCharStretching( sal_uInt16 nX, sal_uInt16 nY );
-inline void   

[Libreoffice-commits] core.git: editeng/source

2022-11-01 Thread Tomaž Vajngerl (via logerrit)
 editeng/source/editeng/impedit3.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 8ec62a84c84d818d01cd3e6dcb874e1a801512c7
Author: Tomaž Vajngerl 
AuthorDate: Tue Oct 18 21:20:47 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Nov 1 07:31:19 2022 +0100

editeng: rename aBuf to aCharPositionArray

Change-Id: Ie7614ee9eefe1160f6d1e6105cc5bf7b92a35cc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142063
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 3b69ff6cf66e..3f0418dc7505 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -838,7 +838,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 EditLine aSaveLine( *pLine );
 SvxFont aTmpFont( pNode->GetCharAttribs().GetDefFont() );
 
-std::vector aBuf( pNode->Len() );
+std::vector aCharPositionArray(pNode->Len());
 
 bool bSameLineAgain = false;// For TextRanger, if the height changes.
 TabInfo aCurrentTab;
@@ -1234,14 +1234,14 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 if (bContinueLastPortion)
 {
  Size aSize( aTmpFont.QuickGetTextSize( GetRefDevice(),
-pParaPortion->GetNode()->GetString(), nTmpPos, 
nPortionLen,  ));
+pParaPortion->GetNode()->GetString(), nTmpPos, 
nPortionLen,  ));
  pPortion->adjustSize(aSize.Width(), 0);
  if (pPortion->GetSize().Height() < aSize.Height())
  pPortion->setHeight(aSize.Height());
 }
 else
 {
-auto aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), 
pParaPortion->GetNode()->GetString(), nTmpPos, nPortionLen, );
+auto aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), 
pParaPortion->GetNode()->GetString(), nTmpPos, nPortionLen, 
);
 pPortion->SetSize(aSize);
 }
 
@@ -1256,7 +1256,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 // => Always simply quick inserts.
 size_t nPos = nTmpPos - pLine->GetStart();
 EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
-rArray.insert( rArray.begin() + nPos, aBuf.data(), aBuf.data() 
+ nPortionLen);
+rArray.insert( rArray.begin() + nPos, 
aCharPositionArray.data(), aCharPositionArray.data() + nPortionLen);
 
 // And now check for Compression:
 if ( !bContinueLastPortion && nPortionLen && 
GetAsianCompressionMode() != CharCompressType::NONE )


[Libreoffice-commits] core.git: editeng/inc editeng/source

2022-10-31 Thread Tomaž Vajngerl (via logerrit)
 editeng/inc/editdoc.hxx |   24 
 editeng/source/editeng/impedit3.cxx |   69 ++--
 2 files changed, 59 insertions(+), 34 deletions(-)

New commits:
commit 190cd40e01bd36e99b265ef5da36a382199f18b9
Author: Tomaž Vajngerl 
AuthorDate: Tue Oct 18 21:14:41 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 31 13:31:12 2022 +0100

editeng: don't use GetSize to set the size

Change-Id: I80a2701d7c125dbe6c80f8c32b125c7b176a8bb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142062
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index 4b92a9be258f..e5c3abbef0cf 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -409,7 +409,29 @@ public:
 sal_Int32  GetLen() const  { return nLen; }
 void   SetLen( sal_Int32 nL ) { nLen = nL; }
 
-Size&  GetSize()   { return aOutSz; }
+void setWidth(tools::Long nWidth)
+{
+aOutSz.setWidth(nWidth);
+}
+
+void setHeight(tools::Long nHeight)
+{
+aOutSz.setHeight(nHeight);
+}
+
+void adjustSize(tools::Long nDeltaX, tools::Long nDeltaY)
+{
+if (nDeltaX != 0)
+aOutSz.AdjustWidth(nDeltaX);
+if (nDeltaY != 0)
+aOutSz.AdjustHeight(nDeltaY);
+}
+
+void SetSize(const Size& rSize)
+{
+aOutSz = rSize;
+}
+
 const Size&GetSize() const { return aOutSz; }
 
 void   SetKind(PortionKind n)  { nKind = n; }
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index d98ea6e4188e..ed560fb0e138 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1016,7 +1016,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 nTmpWidth -= rPrev.GetSize().Width();
 nTmpPos = nTmpPos - rPrev.GetLen();
 rPrev.SetLen(rPrev.GetLen() + nTmpLen);
-rPrev.GetSize().setWidth( -1 );
+rPrev.setWidth(-1);
 }
 
 assert( nTmpPortion < pParaPortion->GetTextPortions().Count() 
&& "No more Portions left!" );
@@ -1079,11 +1079,11 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 
 pPortion->SetKind(PortionKind::TAB);
 pPortion->SetExtraValue( 
aCurrentTab.aTabStop.GetFill() );
-pPortion->GetSize().setWidth( aCurrentTab.nTabPos - 
(nTmpWidth+nStartX) );
+pPortion->setWidth( aCurrentTab.nTabPos - 
(nTmpWidth+nStartX) );
 
 // Height needed...
 SeekCursor( pNode, nTmpPos+1, aTmpFont );
-pPortion->GetSize().setHeight( 
GetRefDevice()->GetTextHeight() );
+pPortion->setHeight( GetRefDevice()->GetTextHeight() );
 
 DBG_ASSERT( pPortion->GetSize().Width() >= 0, "Tab 
incorrectly calculated!" );
 
@@ -1095,7 +1095,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 {
 // What now?
 // make the tab fitting
-pPortion->GetSize().setWidth( nXWidth-nOldTmpWidth 
);
+pPortion->setWidth( nXWidth-nOldTmpWidth );
 nTmpWidth = nXWidth-1;
 bEOL = true;
 bBrokenLine = true;
@@ -1109,7 +1109,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 case EE_FEATURE_LINEBR:
 {
 assert( pPortion );
-pPortion->GetSize().setWidth( 0 );
+pPortion->setWidth(0);
 bEOL = true;
 bLineBreak = true;
 pPortion->SetKind( PortionKind::LINEBREAK );
@@ -1128,8 +1128,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 OUString aFieldValue = static_cast(pNextFeature)->GetFieldValue();
 // get size, but also DXArray to allow length 
information in line breaking below
 std::vector aTmpDXArray;
-pPortion->GetSize() = 
aTmpFont.QuickGetTextSize(GetRefDevice(),
-aFieldValue, 0, aFieldValue.getLength(), 
);
+
pPortion->SetSize(aTmpFont.QuickGetTextSize(GetRefDevice(),
+aFieldValue, 0, aFieldValue.getLength(), 
));
 
 // So no scrolling for oversized fields
 if ( pPortion->GetSize().Width() > nXWidth )
@@ -1235,21 +1235,23 @@ 

[Libreoffice-commits] core.git: editeng/inc editeng/source

2022-10-31 Thread Tomaž Vajngerl (via logerrit)
 editeng/inc/editdoc.hxx|4 ++--
 editeng/source/editeng/editdoc.cxx |8 
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 9f02ccb4b4fa891e9e74e320d9ca0da40b1a626a
Author: Tomaž Vajngerl 
AuthorDate: Tue Oct 18 21:06:55 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 31 13:30:47 2022 +0100

editeng: prefix the instance variable aDefFont-> maDefFont

Change-Id: Ie9d18c19792962159e4e2ff4ddf91560323e42e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142061
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index 2a7aa0128423..4b92a9be258f 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -728,7 +728,7 @@ private:
 rtl::Reference pItemPool;
 Link  aModifyHdl;
 
-SvxFont aDefFont;   //faster than ever from the pool!!
+SvxFont maDefFont;   //faster than ever from the pool!!
 sal_uInt16  nDefTab;
 boolbIsVertical:1;
 TextRotationmnRotation;
@@ -755,7 +755,7 @@ public:
 voidSetModifyHdl( const Link& rLink ) { 
aModifyHdl = rLink; }
 
 voidCreateDefFont( bool bUseStyles );
-const SvxFont&  GetDefFont() const { return aDefFont; }
+const SvxFont&  GetDefFont() const { return maDefFont; }
 
 voidSetDefTab( sal_uInt16 nTab ){ nDefTab = nTab ? nTab : 
DEFTAB; }
 sal_uInt16  GetDefTab() const   { return nDefTab; }
diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index 108230a1666d..1fbf46de184b 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2039,14 +2039,14 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& 
rSet, bool bSearchInParent, S
 void EditDoc::CreateDefFont( bool bUseStyles )
 {
 SfxItemSetFixed aTmpSet( GetItemPool() );
-CreateFont( aDefFont, aTmpSet );
-aDefFont.SetVertical( IsEffectivelyVertical() );
-aDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? 
(IsTopToBottom() ? 2700 : 900) : 0) );
+CreateFont(maDefFont, aTmpSet);
+maDefFont.SetVertical( IsEffectivelyVertical() );
+maDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? 
(IsTopToBottom() ? 2700 : 900) : 0) );
 
 for ( sal_Int32 nNode = 0; nNode < Count(); nNode++ )
 {
 ContentNode* pNode = GetObject( nNode );
-pNode->GetCharAttribs().GetDefFont() = aDefFont;
+pNode->GetCharAttribs().GetDefFont() = maDefFont;
 if ( bUseStyles )
 pNode->CreateDefFont();
 }


[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 405 commits - basctl/source basegfx/CppunitTest_basegfx.mk basegfx/source basegfx/test basic/source bin/crashreportScraper.py canva

2022-10-31 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit 3edf6ad994528057283c90f9adbdfb4b77e8d5ce
Author: Tomaž Vajngerl 
AuthorDate: Tue Oct 18 21:28:29 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 31 11:07:11 2022 +0100

editeng: fix rendering of text when "fit to frame" is enabbled

This changes the nStretchX and nStretchY from sal_uInt16 to double
so the text in text boxes is rendered correctly (text should be
resized to the same size as the textbox).

Change-Id: Ic92d03043af0abe86f1b67ae15522d0176ebbb51

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 88bc04a9efed..c8a66d0470a4 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2266,12 +2266,12 @@ bool EditEngine::HasText( const SvxSearchItem& 
rSearchItem )
 return pImpEditEngine->HasText( rSearchItem );
 }
 
-void EditEngine::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
+void EditEngine::SetGlobalCharStretching(double nX, double nY)
 {
 pImpEditEngine->SetCharStretching( nX, nY );
 }
 
-void EditEngine::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+void EditEngine::GetGlobalCharStretching(double& rX, double& rY) const
 {
 pImpEditEngine->GetCharStretching( rX, rY );
 }
diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index 6d57c7497c2b..437754d70def 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -71,10 +71,10 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew)
 }
 
 XParaPortionList::XParaPortionList(
-OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 _nStretchX, sal_uInt16 
_nStretchY)
+OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, double nStretchY)
 : pRefDevPtr(pRefDev)
-, nStretchX(_nStretchX)
-, nStretchY(_nStretchY)
+, mnStretchX(nStretchX)
+, mnStretchY(nStretchY)
 , nPaperWidth(nPW)
 {
 }
diff --git a/editeng/source/editeng/editobj2.hxx 
b/editeng/source/editeng/editobj2.hxx
index 250341fd4283..86a2e379be20 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -94,12 +94,12 @@ class XParaPortionList
 ListType maList;
 
 VclPtr pRefDevPtr;
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double  mnStretchX;
+double  mnStretchY;
 sal_uInt32  nPaperWidth;
 
 public:
-XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 
_nStretchX, sal_uInt16 _nStretchY);
+XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, 
double nStretchY);
 
 void push_back(XParaPortion* p);
 const XParaPortion& operator[](size_t i) const;
@@ -108,8 +108,8 @@ public:
 sal_uInt32  GetPaperWidth() const   { return nPaperWidth; }
 boolRefDevIsVirtual() const {return 
pRefDevPtr->IsVirtual();}
 const MapMode&  GetRefMapMode() const   { return 
pRefDevPtr->GetMapMode(); }
-sal_uInt16  GetStretchX() const { return nStretchX; }
-sal_uInt16  GetStretchY() const { return nStretchY; }
+double  GetStretchX() const { return mnStretchX; }
+double  GetStretchY() const { return mnStretchY; }
 };
 
 class ContentInfo
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index b761e3bc4135..20e116b2ab3f 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -528,8 +528,8 @@ private:
 
 Color   maBackgroundColor;
 
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double mnStretchX;
+double mnStretchY;
 
 CharCompressTypenAsianCompressionMode;
 
@@ -1080,8 +1080,8 @@ public:
 SvxCellJustifyMethodGetJustifyMethod( sal_Int32 nPara ) const;
 SvxCellVerJustify   GetVerJustification( sal_Int32 nPara ) const;
 
-voidSetCharStretching( sal_uInt16 nX, sal_uInt16 nY );
-inline void GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const;
+voidSetCharStretching(double nX, double nY);
+inline void GetCharStretching(double& rX, double& rY) const;
 
 sal_Int32   GetBigTextObjectStart() const  
 { return nBigTextObjectStart; }
 
@@ -1282,43 +1282,43 @@ inline ParaPortion* ImpEditEngine::FindParaPortion( 
ContentNode const * pNode )
 return GetParaPortions()[ nPos ];
 }
 
-inline void ImpEditEngine::GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+inline void ImpEditEngine::GetCharStretching(double& rX, double& rY) const
 {
-rX = nStretchX;
-rY = nStretchY;
+rX = mnStretchX;
+rY = mnStretchY;
 }
 
 inline short ImpEditEngine::GetXValue( short nXValue ) const
 {
-if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
+if ( !aStatus.DoStretch() || ( mnStretchX == 100.0 ) )
 return nXValue;
 
-return 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 3 commits - editeng/source include/editeng include/svx sd/qa sd/source svx/source

2022-10-26 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit 39a5579ed5bcf500d2ba026cb7f376d270b7eafd
Author: Tomaž Vajngerl 
AuthorDate: Tue Oct 18 21:28:29 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 26 21:22:31 2022 +0200

editeng: fix rendering of text when "fit to frame" is enabbled

This changes the nStretchX and nStretchY from sal_uInt16 to double
so the text in text boxes is rendered correctly (text should be
resized to the same size as the textbox).

Change-Id: Ic92d03043af0abe86f1b67ae15522d0176ebbb51

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 88bc04a9efed..c8a66d0470a4 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2266,12 +2266,12 @@ bool EditEngine::HasText( const SvxSearchItem& 
rSearchItem )
 return pImpEditEngine->HasText( rSearchItem );
 }
 
-void EditEngine::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
+void EditEngine::SetGlobalCharStretching(double nX, double nY)
 {
 pImpEditEngine->SetCharStretching( nX, nY );
 }
 
-void EditEngine::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+void EditEngine::GetGlobalCharStretching(double& rX, double& rY) const
 {
 pImpEditEngine->GetCharStretching( rX, rY );
 }
diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index 6d57c7497c2b..437754d70def 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -71,10 +71,10 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew)
 }
 
 XParaPortionList::XParaPortionList(
-OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 _nStretchX, sal_uInt16 
_nStretchY)
+OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, double nStretchY)
 : pRefDevPtr(pRefDev)
-, nStretchX(_nStretchX)
-, nStretchY(_nStretchY)
+, mnStretchX(nStretchX)
+, mnStretchY(nStretchY)
 , nPaperWidth(nPW)
 {
 }
diff --git a/editeng/source/editeng/editobj2.hxx 
b/editeng/source/editeng/editobj2.hxx
index 250341fd4283..86a2e379be20 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -94,12 +94,12 @@ class XParaPortionList
 ListType maList;
 
 VclPtr pRefDevPtr;
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double  mnStretchX;
+double  mnStretchY;
 sal_uInt32  nPaperWidth;
 
 public:
-XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 
_nStretchX, sal_uInt16 _nStretchY);
+XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, 
double nStretchY);
 
 void push_back(XParaPortion* p);
 const XParaPortion& operator[](size_t i) const;
@@ -108,8 +108,8 @@ public:
 sal_uInt32  GetPaperWidth() const   { return nPaperWidth; }
 boolRefDevIsVirtual() const {return 
pRefDevPtr->IsVirtual();}
 const MapMode&  GetRefMapMode() const   { return 
pRefDevPtr->GetMapMode(); }
-sal_uInt16  GetStretchX() const { return nStretchX; }
-sal_uInt16  GetStretchY() const { return nStretchY; }
+double  GetStretchX() const { return mnStretchX; }
+double  GetStretchY() const { return mnStretchY; }
 };
 
 class ContentInfo
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index b761e3bc4135..20e116b2ab3f 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -528,8 +528,8 @@ private:
 
 Color   maBackgroundColor;
 
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double mnStretchX;
+double mnStretchY;
 
 CharCompressTypenAsianCompressionMode;
 
@@ -1080,8 +1080,8 @@ public:
 SvxCellJustifyMethodGetJustifyMethod( sal_Int32 nPara ) const;
 SvxCellVerJustify   GetVerJustification( sal_Int32 nPara ) const;
 
-voidSetCharStretching( sal_uInt16 nX, sal_uInt16 nY );
-inline void GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const;
+voidSetCharStretching(double nX, double nY);
+inline void GetCharStretching(double& rX, double& rY) const;
 
 sal_Int32   GetBigTextObjectStart() const  
 { return nBigTextObjectStart; }
 
@@ -1282,43 +1282,43 @@ inline ParaPortion* ImpEditEngine::FindParaPortion( 
ContentNode const * pNode )
 return GetParaPortions()[ nPos ];
 }
 
-inline void ImpEditEngine::GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+inline void ImpEditEngine::GetCharStretching(double& rX, double& rY) const
 {
-rX = nStretchX;
-rY = nStretchY;
+rX = mnStretchX;
+rY = mnStretchY;
 }
 
 inline short ImpEditEngine::GetXValue( short nXValue ) const
 {
-if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
+if ( !aStatus.DoStretch() || ( mnStretchX == 100.0 ) )
 return nXValue;
 
-return 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 9 commits - basegfx/test editeng/inc editeng/source filter/source include/basegfx include/editeng include/svx sd/qa sd/source svx/s

2022-10-26 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit 08e0010da2a24ccc65e6a98af89363e0eeeb6a45
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 26 20:21:37 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 26 20:23:58 2022 +0200

svx: change PaperInfo to return gfx::Length paper sizes

Change-Id: Ie99a748ab9282893a852278be9793f7379522541

diff --git a/editeng/source/items/paperinf.cxx 
b/editeng/source/items/paperinf.cxx
index 86401e63f387..130e7c020a41 100644
--- a/editeng/source/items/paperinf.cxx
+++ b/editeng/source/items/paperinf.cxx
@@ -39,6 +39,12 @@ Size SvxPaperInfo::GetPaperSize( Paper ePaper, MapUnit eUnit 
)
 : OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM), 
MapMode(eUnit));
 }
 
+gfx::Size2DL SvxPaperInfo::getPaperSize(Paper ePaper)
+{
+PaperInfo aInfo(ePaper);
+return { gfx::Length::hmm(aInfo.getWidth()), 
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
 /*
  Description:   Return the paper size of the printer, aligned to our
 own sizes. If no Printer is set in the system, A4 portrait
@@ -108,6 +114,12 @@ Size SvxPaperInfo::GetDefaultPaperSize( MapUnit eUnit )
 : OutputDevice::LogicToLogic(aRet, MapMode(MapUnit::Map100thMM), 
MapMode(eUnit));
 }
 
+gfx::Size2DL SvxPaperInfo::getDefaultPaperSize()
+{
+PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
+return { gfx::Length::hmm(aInfo.getWidth()), 
gfx::Length::hmm(aInfo.getHeight()) };
+}
+
 /*
  Description:   String representation for the SV-defines of paper size
 */
diff --git a/include/editeng/paperinf.hxx b/include/editeng/paperinf.hxx
index 2ccc8fbf96fa..20bc1441ba74 100644
--- a/include/editeng/paperinf.hxx
+++ b/include/editeng/paperinf.hxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 // forward ---
@@ -42,6 +43,9 @@ public:
 static PaperGetSvxPaper( const Size , MapUnit eUnit );
 static tools::Long GetSloppyPaperDimension( tools::Long nSize );
 static OUString GetName( Paper ePaper );
+
+static gfx::Size2DL getPaperSize(Paper ePaper);
+static gfx::Size2DL getDefaultPaperSize();
 };
 
 // INLINE -
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index c9b38f1bbebf..c1a238f72c0f 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -371,6 +371,13 @@ public:
 , maLower(0_emu)
 {}
 
+Border(gfx::Length const& nLeft, gfx::Length const& nUpper, gfx::Length 
const& nRight, gfx::Length const& nLower)
+: maLeft(nLeft)
+, maRight(nRight)
+, maUpper(nUpper)
+, maLower(nLower)
+{}
+
 gfx::Length const& getLeft() const { return maLeft; }
 gfx::Length const& getRight() const { return maRight; }
 gfx::Length const& getUpper() const { return maUpper; }
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index a14e4382a8e0..4b8f8360e6ac 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -499,7 +499,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 return;
 
 // #i57181# Paper size depends on Language, like in Writer
-Size aDefSize = SvxPaperInfo::GetDefaultPaperSize( MapUnit::Map100thMM );
+gfx::Size2DL aDefaultSize = SvxPaperInfo::getDefaultPaperSize();
 
 // Insert handout page
 rtl::Reference pHandoutPage = AllocSdPage(false);
@@ -516,8 +516,8 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 }
 else
 {
-pHandoutPage->setSize(gfx::length::fromSizeHmm(aDefSize));
-pHandoutPage->SetBorder(0, 0, 0, 0);
+pHandoutPage->setSize(aDefaultSize);
+pHandoutPage->setBorder(svx::Border());
 }
 
 pHandoutPage->SetPageKind(PageKind::Handout);
@@ -553,7 +553,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const 
* pRefDocument /* =
 else if (meDocType == DocumentType::Draw)
 {
 // Draw: always use default size with margins
-pPage->setSize(gfx::length::fromSizeHmm(aDefSize));
+pPage->setSize(aDefaultSize);
 
 SfxPrinter* pPrinter = mpDocSh->GetPrinter(false);
 if (pPrinter && pPrinter->IsValid())
@@ -563,12 +563,12 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument 
const * pRefDocument /* =
 aPageOffset -= pPrinter->PixelToLogic( Point() );
 ::tools::Long nOffset = !aPageOffset.X() && !aPageOffset.Y() ? 
0 : PRINT_OFFSET;
 
-sal_uLong nTop= aPageOffset.Y();
-sal_uLong nLeft   = aPageOffset.X();
-sal_uLong nBottom = 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 2 commits - editeng/source include/editeng include/svx sd/source svx/source

2022-10-26 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit 42e916c3be5be328c705d384e8ccf8a40a2d7ef0
Author: Tomaž Vajngerl 
AuthorDate: Tue Oct 18 21:28:29 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 26 13:16:08 2022 +0200

editeng: fix rendering of text when "fit to frame" is enabbled

This changes the nStretchX and nStretchY from sal_uInt16 to double
so the text in text boxes is rendered correctly (text should be
resized to the same size as the textbox).

Change-Id: Ic92d03043af0abe86f1b67ae15522d0176ebbb51

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 88bc04a9efed..c8a66d0470a4 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2266,12 +2266,12 @@ bool EditEngine::HasText( const SvxSearchItem& 
rSearchItem )
 return pImpEditEngine->HasText( rSearchItem );
 }
 
-void EditEngine::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
+void EditEngine::SetGlobalCharStretching(double nX, double nY)
 {
 pImpEditEngine->SetCharStretching( nX, nY );
 }
 
-void EditEngine::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+void EditEngine::GetGlobalCharStretching(double& rX, double& rY) const
 {
 pImpEditEngine->GetCharStretching( rX, rY );
 }
diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index 6d57c7497c2b..437754d70def 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -71,10 +71,10 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew)
 }
 
 XParaPortionList::XParaPortionList(
-OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 _nStretchX, sal_uInt16 
_nStretchY)
+OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, double nStretchY)
 : pRefDevPtr(pRefDev)
-, nStretchX(_nStretchX)
-, nStretchY(_nStretchY)
+, mnStretchX(nStretchX)
+, mnStretchY(nStretchY)
 , nPaperWidth(nPW)
 {
 }
diff --git a/editeng/source/editeng/editobj2.hxx 
b/editeng/source/editeng/editobj2.hxx
index 250341fd4283..86a2e379be20 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -94,12 +94,12 @@ class XParaPortionList
 ListType maList;
 
 VclPtr pRefDevPtr;
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double  mnStretchX;
+double  mnStretchY;
 sal_uInt32  nPaperWidth;
 
 public:
-XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 
_nStretchX, sal_uInt16 _nStretchY);
+XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, 
double nStretchY);
 
 void push_back(XParaPortion* p);
 const XParaPortion& operator[](size_t i) const;
@@ -108,8 +108,8 @@ public:
 sal_uInt32  GetPaperWidth() const   { return nPaperWidth; }
 boolRefDevIsVirtual() const {return 
pRefDevPtr->IsVirtual();}
 const MapMode&  GetRefMapMode() const   { return 
pRefDevPtr->GetMapMode(); }
-sal_uInt16  GetStretchX() const { return nStretchX; }
-sal_uInt16  GetStretchY() const { return nStretchY; }
+double  GetStretchX() const { return mnStretchX; }
+double  GetStretchY() const { return mnStretchY; }
 };
 
 class ContentInfo
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index b761e3bc4135..20e116b2ab3f 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -528,8 +528,8 @@ private:
 
 Color   maBackgroundColor;
 
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double mnStretchX;
+double mnStretchY;
 
 CharCompressTypenAsianCompressionMode;
 
@@ -1080,8 +1080,8 @@ public:
 SvxCellJustifyMethodGetJustifyMethod( sal_Int32 nPara ) const;
 SvxCellVerJustify   GetVerJustification( sal_Int32 nPara ) const;
 
-voidSetCharStretching( sal_uInt16 nX, sal_uInt16 nY );
-inline void GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const;
+voidSetCharStretching(double nX, double nY);
+inline void GetCharStretching(double& rX, double& rY) const;
 
 sal_Int32   GetBigTextObjectStart() const  
 { return nBigTextObjectStart; }
 
@@ -1282,43 +1282,43 @@ inline ParaPortion* ImpEditEngine::FindParaPortion( 
ContentNode const * pNode )
 return GetParaPortions()[ nPos ];
 }
 
-inline void ImpEditEngine::GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+inline void ImpEditEngine::GetCharStretching(double& rX, double& rY) const
 {
-rX = nStretchX;
-rY = nStretchY;
+rX = mnStretchX;
+rY = mnStretchY;
 }
 
 inline short ImpEditEngine::GetXValue( short nXValue ) const
 {
-if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
+if ( !aStatus.DoStretch() || ( mnStretchX == 100.0 ) )
 return nXValue;
 
-return 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 3 commits - basegfx/test editeng/source include/basegfx include/editeng include/svx sd/source svx/source

2022-10-25 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit fae1277c528cbfb9c3bff881b629dc3af1a33980
Author: Tomaž Vajngerl 
AuthorDate: Tue Oct 18 21:28:29 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Oct 25 21:06:52 2022 +0200

editeng: fix rendering of text when "fit to frame" is enabbled

This changes the nStretchX and nStretchY from sal_uInt16 to double
so the text in text boxes is rendered correctly (text should be
resized to the same size as the textbox).

Change-Id: Ic92d03043af0abe86f1b67ae15522d0176ebbb51

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 88bc04a9efed..c8a66d0470a4 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2266,12 +2266,12 @@ bool EditEngine::HasText( const SvxSearchItem& 
rSearchItem )
 return pImpEditEngine->HasText( rSearchItem );
 }
 
-void EditEngine::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
+void EditEngine::SetGlobalCharStretching(double nX, double nY)
 {
 pImpEditEngine->SetCharStretching( nX, nY );
 }
 
-void EditEngine::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+void EditEngine::GetGlobalCharStretching(double& rX, double& rY) const
 {
 pImpEditEngine->GetCharStretching( rX, rY );
 }
diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index 6d57c7497c2b..437754d70def 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -71,10 +71,10 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew)
 }
 
 XParaPortionList::XParaPortionList(
-OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 _nStretchX, sal_uInt16 
_nStretchY)
+OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, double nStretchY)
 : pRefDevPtr(pRefDev)
-, nStretchX(_nStretchX)
-, nStretchY(_nStretchY)
+, mnStretchX(nStretchX)
+, mnStretchY(nStretchY)
 , nPaperWidth(nPW)
 {
 }
diff --git a/editeng/source/editeng/editobj2.hxx 
b/editeng/source/editeng/editobj2.hxx
index 250341fd4283..86a2e379be20 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -94,12 +94,12 @@ class XParaPortionList
 ListType maList;
 
 VclPtr pRefDevPtr;
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double  mnStretchX;
+double  mnStretchY;
 sal_uInt32  nPaperWidth;
 
 public:
-XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 
_nStretchX, sal_uInt16 _nStretchY);
+XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, 
double nStretchY);
 
 void push_back(XParaPortion* p);
 const XParaPortion& operator[](size_t i) const;
@@ -108,8 +108,8 @@ public:
 sal_uInt32  GetPaperWidth() const   { return nPaperWidth; }
 boolRefDevIsVirtual() const {return 
pRefDevPtr->IsVirtual();}
 const MapMode&  GetRefMapMode() const   { return 
pRefDevPtr->GetMapMode(); }
-sal_uInt16  GetStretchX() const { return nStretchX; }
-sal_uInt16  GetStretchY() const { return nStretchY; }
+double  GetStretchX() const { return mnStretchX; }
+double  GetStretchY() const { return mnStretchY; }
 };
 
 class ContentInfo
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index b761e3bc4135..20e116b2ab3f 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -528,8 +528,8 @@ private:
 
 Color   maBackgroundColor;
 
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double mnStretchX;
+double mnStretchY;
 
 CharCompressTypenAsianCompressionMode;
 
@@ -1080,8 +1080,8 @@ public:
 SvxCellJustifyMethodGetJustifyMethod( sal_Int32 nPara ) const;
 SvxCellVerJustify   GetVerJustification( sal_Int32 nPara ) const;
 
-voidSetCharStretching( sal_uInt16 nX, sal_uInt16 nY );
-inline void GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const;
+voidSetCharStretching(double nX, double nY);
+inline void GetCharStretching(double& rX, double& rY) const;
 
 sal_Int32   GetBigTextObjectStart() const  
 { return nBigTextObjectStart; }
 
@@ -1282,43 +1282,43 @@ inline ParaPortion* ImpEditEngine::FindParaPortion( 
ContentNode const * pNode )
 return GetParaPortions()[ nPos ];
 }
 
-inline void ImpEditEngine::GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+inline void ImpEditEngine::GetCharStretching(double& rX, double& rY) const
 {
-rX = nStretchX;
-rY = nStretchY;
+rX = mnStretchX;
+rY = mnStretchY;
 }
 
 inline short ImpEditEngine::GetXValue( short nXValue ) const
 {
-if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
+if ( !aStatus.DoStretch() || ( mnStretchX == 100.0 ) )
 return nXValue;
 
-return 

[Libreoffice-commits] core.git: sw/inc sw/source

2022-10-24 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/GrammarContact.hxx |7 ---
 sw/source/core/doc/docnew.cxx |   13 -
 sw/source/core/text/txtfrm.cxx|2 +-
 sw/source/core/txtnode/GrammarContact.cxx |   17 ++---
 sw/source/core/unocore/unoflatpara.cxx|2 +-
 sw/source/core/unocore/unotextmarkup.cxx  |8 
 6 files changed, 24 insertions(+), 25 deletions(-)

New commits:
commit 8e2deed1457e3ab712df2820331136d531927522
Author: Tomaž Vajngerl 
AuthorDate: Fri Oct 14 13:51:51 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 24 20:04:57 2022 +0200

sw: Move getGrammarContact function into GrammarContact and rename

Change-Id: Id89d7eabb465f047188f8f74bd823cfb3b2f2aff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141433
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/GrammarContact.hxx b/sw/inc/GrammarContact.hxx
index f2dc8ebe0ee2..9cc24121158b 100644
--- a/sw/inc/GrammarContact.hxx
+++ b/sw/inc/GrammarContact.hxx
@@ -82,12 +82,13 @@ public:
 /** getGrammarContact() delivers the grammar contact of the document (for a 
given textnode)
 @returns grammar contact
 */
-GrammarContact* getGrammarContact(const SwTextNode&);
+GrammarContact* getGrammarContactFor(const SwTextNode&);
 
 /** finishGrammarCheck() calls the same function of the grammar contact of the 
document (for a given textnode)
 @returns void
 */
-void finishGrammarCheck(SwTextNode&);
-}
+void finishGrammarCheckFor(SwTextNode&);
+
+} // end sw
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 01cd2062cc74..bd80ba17d261 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -808,19 +808,6 @@ void SwDoc::WriteLayoutCache( SvStream& rStream )
 SwLayoutCache::Write( rStream, *this );
 }
 
-namespace sw
-{
-
-sw::GrammarContact* getGrammarContact(const SwTextNode& rTextNode)
-{
-const SwDoc& rDoc = rTextNode.GetDoc();
-if (rDoc.IsInDtor())
-return nullptr;
-return rDoc.getGrammarContact().get();
-}
-
-} // end sw
-
 ::sfx2::IXmlIdRegistry&
 SwDoc::GetXmlIdRegistry()
 {
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 07640f318534..ddd2ef9c0acf 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1801,7 +1801,7 @@ static void lcl_SetWrong( SwTextFrame& rFrame, SwTextNode 
const& rNode,
 if ( !rFrame.IsFollow() )
 {
 SwTextNode* pTextNode = const_cast();
-sw::GrammarContact* pGrammarContact = getGrammarContact(*pTextNode);
+sw::GrammarContact* pGrammarContact = 
sw::getGrammarContactFor(*pTextNode);
 SwGrammarMarkUp* pWrongGrammar = pGrammarContact ?
 pGrammarContact->getGrammarCheck( *pTextNode, false ) :
 pTextNode->GetGrammarCheck();
diff --git a/sw/source/core/txtnode/GrammarContact.cxx 
b/sw/source/core/txtnode/GrammarContact.cxx
index 233fe2ed3432..47e2fac264c0 100644
--- a/sw/source/core/txtnode/GrammarContact.cxx
+++ b/sw/source/core/txtnode/GrammarContact.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -143,11 +144,21 @@ void GrammarContact::finishGrammarCheck( SwTextNode& 
rTextNode )
 }
 }
 
-void finishGrammarCheck( SwTextNode& rTextNode )
+sw::GrammarContact* getGrammarContactFor(const SwTextNode& rTextNode)
 {
-sw::GrammarContact* pGrammarContact = getGrammarContact( rTextNode );
+const SwDoc& rDoc = rTextNode.GetDoc();
+if (rDoc.IsInDtor())
+return nullptr;
+return rDoc.getGrammarContact().get();
+}
+
+void finishGrammarCheckFor(SwTextNode& rTextNode)
+{
+sw::GrammarContact* pGrammarContact = getGrammarContactFor(rTextNode);
 if (pGrammarContact)
-pGrammarContact->finishGrammarCheck( rTextNode );
+{
+pGrammarContact->finishGrammarCheck(rTextNode);
+}
 }
 
 } // end sw
diff --git a/sw/source/core/unocore/unoflatpara.cxx 
b/sw/source/core/unocore/unoflatpara.cxx
index 84194fd63a7b..ea2343e8b18a 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -190,7 +190,7 @@ void SAL_CALL SwXFlatParagraph::setChecked( ::sal_Int32 
nType, sal_Bool bVal )
 {
 GetTextNode()->SetGrammarCheckDirty( !bVal );
 if( bVal )
-sw::finishGrammarCheck( *GetTextNode() );
+sw::finishGrammarCheckFor(*GetTextNode());
 }
 }
 
diff --git a/sw/source/core/unocore/unotextmarkup.cxx 
b/sw/source/core/unocore/unotextmarkup.cxx
index 26249cb7b1f6..eb31601dd64a 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -156,7 +156,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup(
 }
 else if ( nType == text::TextMarkupType::PROOFREADING || nType == 
text::TextMarkupType::SENTENCE )
 {
-sw::GrammarContact* pGrammarContact = 

[Libreoffice-commits] core.git: solenv/clang-format sw/inc sw/Library_sw.mk sw/source

2022-10-24 Thread Tomaž Vajngerl (via logerrit)
 solenv/clang-format/excludelist   |2 +-
 sw/Library_sw.mk  |2 +-
 sw/source/core/crsr/crsrsh.cxx|2 +-
 sw/source/core/doc/docnew.cxx |2 +-
 sw/source/core/text/txtfrm.cxx|2 +-
 sw/source/core/txtnode/GrammarContact.cxx |2 +-
 sw/source/core/unocore/unoflatpara.cxx|2 +-
 sw/source/core/unocore/unotextmarkup.cxx  |3 +--
 8 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit dba424efc15aa2915c38721c27edf0cc1d716bd1
Author: Tomaž Vajngerl 
AuthorDate: Thu Oct 13 18:56:33 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 24 14:35:24 2022 +0200

sw: rename IGrammarContact*, SwGrammarContact* to GrammarContact*

Change-Id: Ifa9effa5aa8eb014ebf120768893bc982ce73fd0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141432
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index a84fe3ddc985..ece753ea6256 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -12734,7 +12734,7 @@ sw/source/core/tox/ToxWhitespaceStripper.cxx
 sw/source/core/tox/tox.cxx
 sw/source/core/tox/toxhlp.cxx
 sw/source/core/tox/txmsrt.cxx
-sw/source/core/txtnode/SwGrammarContact.cxx
+sw/source/core/txtnode/GrammarContact.cxx
 sw/source/core/txtnode/atrfld.cxx
 sw/source/core/txtnode/atrflyin.cxx
 sw/source/core/txtnode/atrftn.cxx
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 218d92cc748b..483f00601b04 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -429,7 +429,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
 sw/source/core/tox/ToxTabStopTokenHandler \
 sw/source/core/tox/ToxTextGenerator \
 sw/source/core/tox/ToxWhitespaceStripper \
-sw/source/core/txtnode/SwGrammarContact \
+sw/source/core/txtnode/GrammarContact \
 sw/source/core/txtnode/attrcontentcontrol \
 sw/source/core/txtnode/atrfld \
 sw/source/core/txtnode/atrflyin \
diff --git a/sw/inc/IGrammarContact.hxx b/sw/inc/GrammarContact.hxx
similarity index 100%
rename from sw/inc/IGrammarContact.hxx
rename to sw/inc/GrammarContact.hxx
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 41a12ab26229..901e3b149644 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -55,7 +55,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 55bb56da9dc7..01cd2062cc74 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -75,7 +75,7 @@
 #include 
 #include 
 #include "swstylemanager.hxx"
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 405d124c09e0..07640f318534 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -68,7 +68,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/core/txtnode/SwGrammarContact.cxx 
b/sw/source/core/txtnode/GrammarContact.cxx
similarity index 99%
rename from sw/source/core/txtnode/SwGrammarContact.cxx
rename to sw/source/core/txtnode/GrammarContact.cxx
index aaddc1406cfb..233fe2ed3432 100644
--- a/sw/source/core/txtnode/SwGrammarContact.cxx
+++ b/sw/source/core/txtnode/GrammarContact.cxx
@@ -17,7 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/core/unocore/unoflatpara.cxx 
b/sw/source/core/unocore/unoflatpara.cxx
index 4f2c8e385620..84194fd63a7b 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -42,7 +42,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/core/unocore/unotextmarkup.cxx 
b/sw/source/core/unocore/unotextmarkup.cxx
index 86add0f34c9c..26249cb7b1f6 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -34,8 +34,7 @@
 #include 
 #include 
 #include 
-
-#include 
+#include 
 
 #include 
 #include 


[Libreoffice-commits] core.git: 2 commits - include/sfx2 sw/inc sw/qa sw/source

2022-10-21 Thread Tomaž Vajngerl (via logerrit)
 include/sfx2/AccessibilityIssue.hxx  |
1 
 sw/inc/IGrammarContact.hxx   |   
48 --
 sw/inc/doc.hxx   |
6 
 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |   
15 ++
 sw/qa/core/accessibilitycheck/data/AccessibilityTests_NumberingCheck.odt 
|binary
 sw/source/core/access/AccessibilityCheck.cxx |   
50 --
 sw/source/core/crsr/crsrsh.cxx   |
7 
 sw/source/core/doc/docnew.cxx|   
11 +
 sw/source/core/text/txtfrm.cxx   |
2 
 sw/source/core/txtnode/SwGrammarContact.cxx  |   
73 ++
 sw/source/core/unocore/unoflatpara.cxx   |
2 
 sw/source/core/unocore/unotextmarkup.cxx |
4 
 12 files changed, 122 insertions(+), 97 deletions(-)

New commits:
commit c7bcf51d3efe30047667fe026cbcd3cb87bdece3
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 12 21:36:52 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 21 15:59:54 2022 +0200

sw: combine IGrammarContact and SwGrammarContact

Change-Id: I4b9ab45ff8e21fa5091894f2cd5e3c7de57df425
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141431
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/IGrammarContact.hxx b/sw/inc/IGrammarContact.hxx
index a2e4cecfeb2e..f2dc8ebe0ee2 100644
--- a/sw/inc/IGrammarContact.hxx
+++ b/sw/inc/IGrammarContact.hxx
@@ -19,29 +19,52 @@
 
 #pragma once
 
+#include 
+#include 
+#include 
+
 struct SwPosition;
 class SwTextNode;
-class SwGrammarMarkUp;
 
-/** Organizer of the contact between SwTextNodes and grammar checker
-*/
-class IGrammarContact
+namespace sw
 {
+/**
+ * This class is responsible for the delayed display of grammar checks when a 
paragraph is edited
+ * It's a client of the paragraph the cursor points to.
+ * If the cursor position changes, updateCursorPosition has to be called
+ * If the grammar checker wants to set a grammar marker at a paragraph, he has 
to request
+ * the grammar list from this class. If the requested paragraph is not edited, 
it returns
+ * the normal grammar list. But if the paragraph is the active one, a proxy 
list will be returned and
+ * all changes are set in this proxy list. If the cursor leaves the paragraph 
the proxy list
+ * will replace the old list. If the grammar checker has completed the 
paragraph ('setChecked')
+ * then a timer is setup which replaces the old list as well.
+ */
+class GrammarContact final : public SvtListener
+{
+Timer m_aTimer;
+std::unique_ptr m_pProxyList;
+bool m_isFinished;
+SwTextNode* m_pTextNode;
+DECL_LINK(TimerRepaint, Timer*, void);
+
 public:
+GrammarContact();
+~GrammarContact() { m_aTimer.Stop(); }
+
 /** Update cursor position reacts to a change of the current input cursor
 As long as the cursor in inside a paragraph, the grammar checking does
 not show new grammar faults. When the cursor leaves the paragraph, 
these
 faults are shown.
 @returns void
 */
-virtual void updateCursorPosition(const SwPosition& rNewPos) = 0;
+void updateCursorPosition(const SwPosition& rNewPos);
 
 /** getGrammarCheck checks if the given text node is blocked by the 
current cursor
 if not, the normal markup list is returned
 if blocked, it will return a markup list "proxy"
 @returns a markup list (grammar) for the given SwTextNode
 */
-virtual SwGrammarMarkUp* getGrammarCheck(SwTextNode& rTextNode, bool 
bCreate) = 0;
+SwGrammarMarkUp* getGrammarCheck(SwTextNode& rTextNode, bool bCreate);
 
 /** finishGrammarCheck() has to be called if a grammar checking has been 
completed
 for a text node. If this text node has not been hidden by the current 
proxy list
@@ -49,27 +72,22 @@ public:
 repaint will be triggered by a timer
 @returns void
 */
-virtual void finishGrammarCheck(SwTextNode& rTextNode) = 0;
+void finishGrammarCheck(SwTextNode& rTextNode);
 
-public:
-virtual ~IGrammarContact() {}
+void CheckBroadcaster();
 };
 
-/** Factory for a grammar contact
-@returns a new created grammar contact object
-*/
-IGrammarContact* createGrammarContact();
-
 /* Helper functions */
 
 /** getGrammarContact() delivers the grammar contact of the document (for a 
given textnode)
 @returns grammar contact
 */
-IGrammarContact* getGrammarContact(const SwTextNode&);
+GrammarContact* getGrammarContact(const SwTextNode&);
 
 /** finishGrammarCheck() calls the same function of the grammar contact of the 
document (for a given textnode)
 @returns void
 */
 void finishGrammarCheck(SwTextNode&);
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 13 commits - basctl/source basegfx/CppunitTest_basegfx.mk basegfx/test chart2/source cui/source download.lst drawinglayer/source ed

2022-10-18 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit e9cf86c73407b1200276fa447aff6bfaf5a95858
Author: Tomaž Vajngerl 
AuthorDate: Tue Oct 18 21:28:29 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Oct 18 21:34:29 2022 +0200

editeng: fix rendering of text when "fit to frame" is enabbled

This changes the nStretchX and nStretchY from sal_uInt16 to double
so the text in text boxes is rendered correctly (text should be
resized to the same size as the textbox).

Change-Id: Ic92d03043af0abe86f1b67ae15522d0176ebbb51

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 88bc04a9efed..c8a66d0470a4 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2266,12 +2266,12 @@ bool EditEngine::HasText( const SvxSearchItem& 
rSearchItem )
 return pImpEditEngine->HasText( rSearchItem );
 }
 
-void EditEngine::SetGlobalCharStretching( sal_uInt16 nX, sal_uInt16 nY )
+void EditEngine::SetGlobalCharStretching(double nX, double nY)
 {
 pImpEditEngine->SetCharStretching( nX, nY );
 }
 
-void EditEngine::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+void EditEngine::GetGlobalCharStretching(double& rX, double& rY) const
 {
 pImpEditEngine->GetCharStretching( rX, rY );
 }
diff --git a/editeng/source/editeng/editobj.cxx 
b/editeng/source/editeng/editobj.cxx
index 6d57c7497c2b..437754d70def 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -71,10 +71,10 @@ void XEditAttribute::SetItem(const SfxPoolItem& rNew)
 }
 
 XParaPortionList::XParaPortionList(
-OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 _nStretchX, sal_uInt16 
_nStretchY)
+OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, double nStretchY)
 : pRefDevPtr(pRefDev)
-, nStretchX(_nStretchX)
-, nStretchY(_nStretchY)
+, mnStretchX(nStretchX)
+, mnStretchY(nStretchY)
 , nPaperWidth(nPW)
 {
 }
diff --git a/editeng/source/editeng/editobj2.hxx 
b/editeng/source/editeng/editobj2.hxx
index 250341fd4283..86a2e379be20 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -94,12 +94,12 @@ class XParaPortionList
 ListType maList;
 
 VclPtr pRefDevPtr;
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double  mnStretchX;
+double  mnStretchY;
 sal_uInt32  nPaperWidth;
 
 public:
-XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, sal_uInt16 
_nStretchX, sal_uInt16 _nStretchY);
+XParaPortionList(OutputDevice* pRefDev, sal_uInt32 nPW, double nStretchX, 
double nStretchY);
 
 void push_back(XParaPortion* p);
 const XParaPortion& operator[](size_t i) const;
@@ -108,8 +108,8 @@ public:
 sal_uInt32  GetPaperWidth() const   { return nPaperWidth; }
 boolRefDevIsVirtual() const {return 
pRefDevPtr->IsVirtual();}
 const MapMode&  GetRefMapMode() const   { return 
pRefDevPtr->GetMapMode(); }
-sal_uInt16  GetStretchX() const { return nStretchX; }
-sal_uInt16  GetStretchY() const { return nStretchY; }
+double  GetStretchX() const { return mnStretchX; }
+double  GetStretchY() const { return mnStretchY; }
 };
 
 class ContentInfo
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index b761e3bc4135..20e116b2ab3f 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -528,8 +528,8 @@ private:
 
 Color   maBackgroundColor;
 
-sal_uInt16  nStretchX;
-sal_uInt16  nStretchY;
+double mnStretchX;
+double mnStretchY;
 
 CharCompressTypenAsianCompressionMode;
 
@@ -1080,8 +1080,8 @@ public:
 SvxCellJustifyMethodGetJustifyMethod( sal_Int32 nPara ) const;
 SvxCellVerJustify   GetVerJustification( sal_Int32 nPara ) const;
 
-voidSetCharStretching( sal_uInt16 nX, sal_uInt16 nY );
-inline void GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const;
+voidSetCharStretching(double nX, double nY);
+inline void GetCharStretching(double& rX, double& rY) const;
 
 sal_Int32   GetBigTextObjectStart() const  
 { return nBigTextObjectStart; }
 
@@ -1282,43 +1282,43 @@ inline ParaPortion* ImpEditEngine::FindParaPortion( 
ContentNode const * pNode )
 return GetParaPortions()[ nPos ];
 }
 
-inline void ImpEditEngine::GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ) 
const
+inline void ImpEditEngine::GetCharStretching(double& rX, double& rY) const
 {
-rX = nStretchX;
-rY = nStretchY;
+rX = mnStretchX;
+rY = mnStretchY;
 }
 
 inline short ImpEditEngine::GetXValue( short nXValue ) const
 {
-if ( !aStatus.DoStretch() || ( nStretchX == 100 ) )
+if ( !aStatus.DoStretch() || ( mnStretchX == 100.0 ) )
 return nXValue;
 
-return 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 0 commits -

2022-10-18 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:


[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 1055 commits - accessibility/inc accessibility/source android/default-document avmedia/source basctl/inc basctl/source basegfx/Cppu

2022-10-17 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit cb4a77073d1448e29ac099c96b53dea47223a937
Author: Tomaž Vajngerl 
AuthorDate: Tue Sep 27 22:21:37 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 17 21:48:11 2022 +0200

Check Textbox Fit To Frame

Change-Id: I4a02658d06b84cd1222713f12adf14a8194b5b93

diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index 2a7aa0128423..e5c3abbef0cf 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -409,7 +409,29 @@ public:
 sal_Int32  GetLen() const  { return nLen; }
 void   SetLen( sal_Int32 nL ) { nLen = nL; }
 
-Size&  GetSize()   { return aOutSz; }
+void setWidth(tools::Long nWidth)
+{
+aOutSz.setWidth(nWidth);
+}
+
+void setHeight(tools::Long nHeight)
+{
+aOutSz.setHeight(nHeight);
+}
+
+void adjustSize(tools::Long nDeltaX, tools::Long nDeltaY)
+{
+if (nDeltaX != 0)
+aOutSz.AdjustWidth(nDeltaX);
+if (nDeltaY != 0)
+aOutSz.AdjustHeight(nDeltaY);
+}
+
+void SetSize(const Size& rSize)
+{
+aOutSz = rSize;
+}
+
 const Size&GetSize() const { return aOutSz; }
 
 void   SetKind(PortionKind n)  { nKind = n; }
@@ -728,7 +750,7 @@ private:
 rtl::Reference pItemPool;
 Link  aModifyHdl;
 
-SvxFont aDefFont;   //faster than ever from the pool!!
+SvxFont maDefFont;   //faster than ever from the pool!!
 sal_uInt16  nDefTab;
 boolbIsVertical:1;
 TextRotationmnRotation;
@@ -755,7 +777,7 @@ public:
 voidSetModifyHdl( const Link& rLink ) { 
aModifyHdl = rLink; }
 
 voidCreateDefFont( bool bUseStyles );
-const SvxFont&  GetDefFont() const { return aDefFont; }
+const SvxFont&  GetDefFont() const { return maDefFont; }
 
 voidSetDefTab( sal_uInt16 nTab ){ nDefTab = nTab ? nTab : 
DEFTAB; }
 sal_uInt16  GetDefTab() const   { return nDefTab; }
diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index 108230a1666d..3dc739281293 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1988,7 +1988,11 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, 
bool bSearchInParent, S
 if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_BKGCOLOR ) == 
SfxItemState::SET ) )
 rFont.SetFillColor( rSet.Get( EE_CHAR_BKGCOLOR ).GetValue() );
 if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontHeight ) == 
SfxItemState::SET ) )
-rFont.SetFontSize( Size( rFont.GetFontSize().Width(), 
static_cast(rSet.Get( nWhich_FontHeight ) 
).GetHeight() ) );
+{
+auto nHeight = static_cast(rSet.Get( 
nWhich_FontHeight ) ).GetHeight();
+printf ("FONTHEIGHT %ld\n", nHeight);
+rFont.SetFontSize(Size(rFont.GetFontSize().Width(), nHeight));
+}
 if ( bSearchInParent || ( rSet.GetItemState( nWhich_Weight ) == 
SfxItemState::SET ) )
 rFont.SetWeight( static_cast(rSet.Get( 
nWhich_Weight )).GetWeight() );
 if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_UNDERLINE ) == 
SfxItemState::SET ) )
@@ -2039,14 +2043,14 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& 
rSet, bool bSearchInParent, S
 void EditDoc::CreateDefFont( bool bUseStyles )
 {
 SfxItemSetFixed aTmpSet( GetItemPool() );
-CreateFont( aDefFont, aTmpSet );
-aDefFont.SetVertical( IsEffectivelyVertical() );
-aDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? 
(IsTopToBottom() ? 2700 : 900) : 0) );
+CreateFont(maDefFont, aTmpSet);
+maDefFont.SetVertical( IsEffectivelyVertical() );
+maDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? 
(IsTopToBottom() ? 2700 : 900) : 0) );
 
 for ( sal_Int32 nNode = 0; nNode < Count(); nNode++ )
 {
 ContentNode* pNode = GetObject( nNode );
-pNode->GetCharAttribs().GetDefFont() = aDefFont;
+pNode->GetCharAttribs().GetDefFont() = maDefFont;
 if ( bUseStyles )
 pNode->CreateDefFont();
 }
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 455587bac4a6..61c509e433fd 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3348,6 +3348,7 @@ sal_uInt32 ImpEditEngine::GetTextHeight() const
 
 sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace )
 {
+printf("ImpEditEngine::CalcTextWidth\n");
 // If still not formatted and not in the process.
 // Will be brought in the formatting for AutoPageSize.
 if ( !IsFormatted() && !IsFormatting() )
@@ -3362,12 +3363,13 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( bool 
bIgnoreExtraSpace )
 {
 nMaxWidth = std::max(nMaxWidth, CalcParaWidth(nPara, 
bIgnoreExtraSpace));
 }
-
+printf("end 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 2 commits - basegfx/test editeng/inc editeng/source include/basegfx svx/source

2022-10-17 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit 286ecbe1bc79134e1e33a8782df89d8c1dd323aa
Author: Tomaž Vajngerl 
AuthorDate: Tue Sep 27 22:21:37 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 17 21:46:55 2022 +0200

Check Textbox Fit To Frame

Change-Id: I4a02658d06b84cd1222713f12adf14a8194b5b93

diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index 25a3dca4b1fc..4aa6ff167b45 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -409,7 +409,29 @@ public:
 sal_Int32  GetLen() const  { return nLen; }
 void   SetLen( sal_Int32 nL ) { nLen = nL; }
 
-Size&  GetSize()   { return aOutSz; }
+void setWidth(tools::Long nWidth)
+{
+aOutSz.setWidth(nWidth);
+}
+
+void setHeight(tools::Long nHeight)
+{
+aOutSz.setHeight(nHeight);
+}
+
+void adjustSize(tools::Long nDeltaX, tools::Long nDeltaY)
+{
+if (nDeltaX != 0)
+aOutSz.AdjustWidth(nDeltaX);
+if (nDeltaY != 0)
+aOutSz.AdjustHeight(nDeltaY);
+}
+
+void SetSize(const Size& rSize)
+{
+aOutSz = rSize;
+}
+
 const Size&GetSize() const { return aOutSz; }
 
 void   SetKind(PortionKind n)  { nKind = n; }
@@ -728,7 +750,7 @@ private:
 rtl::Reference pItemPool;
 Link  aModifyHdl;
 
-SvxFont aDefFont;   //faster than ever from the pool!!
+SvxFont maDefFont;   //faster than ever from the pool!!
 sal_uInt16  nDefTab;
 boolbIsVertical:1;
 TextRotationmnRotation;
@@ -755,7 +777,7 @@ public:
 voidSetModifyHdl( const Link& rLink ) { 
aModifyHdl = rLink; }
 
 voidCreateDefFont( bool bUseStyles );
-const SvxFont&  GetDefFont() const { return aDefFont; }
+const SvxFont&  GetDefFont() const { return maDefFont; }
 
 voidSetDefTab( sal_uInt16 nTab ){ nDefTab = nTab ? nTab : 
DEFTAB; }
 sal_uInt16  GetDefTab() const   { return nDefTab; }
diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index c3777f111783..c8113a601cf7 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1988,7 +1988,11 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, 
bool bSearchInParent, S
 if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_BKGCOLOR ) == 
SfxItemState::SET ) )
 rFont.SetFillColor( rSet.Get( EE_CHAR_BKGCOLOR ).GetValue() );
 if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontHeight ) == 
SfxItemState::SET ) )
-rFont.SetFontSize( Size( rFont.GetFontSize().Width(), 
static_cast(rSet.Get( nWhich_FontHeight ) 
).GetHeight() ) );
+{
+auto nHeight = static_cast(rSet.Get( 
nWhich_FontHeight ) ).GetHeight();
+printf ("FONTHEIGHT %ld\n", nHeight);
+rFont.SetFontSize(Size(rFont.GetFontSize().Width(), nHeight));
+}
 if ( bSearchInParent || ( rSet.GetItemState( nWhich_Weight ) == 
SfxItemState::SET ) )
 rFont.SetWeight( static_cast(rSet.Get( 
nWhich_Weight )).GetWeight() );
 if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_UNDERLINE ) == 
SfxItemState::SET ) )
@@ -2039,14 +2043,14 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& 
rSet, bool bSearchInParent, S
 void EditDoc::CreateDefFont( bool bUseStyles )
 {
 SfxItemSetFixed aTmpSet( GetItemPool() );
-CreateFont( aDefFont, aTmpSet );
-aDefFont.SetVertical( IsEffectivelyVertical() );
-aDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? 
(IsTopToBottom() ? 2700 : 900) : 0) );
+CreateFont(maDefFont, aTmpSet);
+maDefFont.SetVertical( IsEffectivelyVertical() );
+maDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? 
(IsTopToBottom() ? 2700 : 900) : 0) );
 
 for ( sal_Int32 nNode = 0; nNode < Count(); nNode++ )
 {
 ContentNode* pNode = GetObject( nNode );
-pNode->GetCharAttribs().GetDefFont() = aDefFont;
+pNode->GetCharAttribs().GetDefFont() = maDefFont;
 if ( bUseStyles )
 pNode->CreateDefFont();
 }
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index ffa8913b0c75..ddde6b26f9c7 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3347,6 +3347,7 @@ sal_uInt32 ImpEditEngine::GetTextHeight() const
 
 sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace )
 {
+printf("ImpEditEngine::CalcTextWidth\n");
 // If still not formatted and not in the process.
 // Will be brought in the formatting for AutoPageSize.
 if ( !IsFormatted() && !IsFormatting() )
@@ -3361,12 +3362,13 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( bool 
bIgnoreExtraSpace )
 {
 nMaxWidth = std::max(nMaxWidth, CalcParaWidth(nPara, 
bIgnoreExtraSpace));
 }
-
+printf("end 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - basegfx/test include/basegfx

2022-10-17 Thread Tomaž Vajngerl (via logerrit)
 basegfx/test/LengthUnitTest.cxx  |   23 ++-
 include/basegfx/units/LengthUnitBase.hxx |   11 +++
 2 files changed, 29 insertions(+), 5 deletions(-)

New commits:
commit 3f6a8c8d1d7f9bd5d9a8668d7567ba89f7755800
Author: Tomaž Vajngerl 
AuthorDate: Thu Oct 13 10:12:27 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Oct 13 10:19:24 2022 +0200

add division of length units to LengthUnitBase

Reult of division of 2 length units is a ratio (double).

Change-Id: I3d0e605492ca0af93580de138b5bc0c3e7877fa5

diff --git a/basegfx/test/LengthUnitTest.cxx b/basegfx/test/LengthUnitTest.cxx
index 8861a2ade316..11095f3222b5 100644
--- a/basegfx/test/LengthUnitTest.cxx
+++ b/basegfx/test/LengthUnitTest.cxx
@@ -32,11 +32,6 @@ public:
 CPPUNIT_ASSERT_EQUAL(sal_Int64(342), cm3.raw());
 CPPUNIT_ASSERT_DOUBLES_EQUAL(95000.0, cm3.as_cm(), 1e-4);
 
-gfx::Length cm4(1_cm);
-cm4 /= 2;
-CPPUNIT_ASSERT_EQUAL(sal_Int64(18), cm4.raw());
-CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5, cm4.as_cm(), 1e-4);
-
 // (635 * 20) + 3 * (635 * 15) = 41275EMU
 gfx::Length pt = 1_pt + 3_px;
 CPPUNIT_ASSERT_DOUBLES_EQUAL(3.25, pt.as_pt(), 1e-4);
@@ -92,6 +87,23 @@ public:
 CPPUNIT_ASSERT_EQUAL(sal_Int64(3636), bb.raw());
 }
 
+void testDivision()
+{
+gfx::Length cm(1_cm);
+cm /= 2;
+CPPUNIT_ASSERT_EQUAL(sal_Int64(18), cm.raw());
+CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5, cm.as_cm(), 1e-4);
+
+gfx::Length cm4(1_cm);
+cm4 /= 2.0;
+CPPUNIT_ASSERT_EQUAL(sal_Int64(18), cm4.raw());
+CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5, cm4.as_cm(), 1e-4);
+
+// with division of 2 length units you get a ratio
+double aRatio = gfx::Length::hmm(10) / gfx::Length::hmm(20);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5, aRatio, 1e-9);
+}
+
 void testInRange()
 {
 gfx::Range2DL aRange(1_cm, 2_cm, 2_cm, 30_mm);
@@ -159,6 +171,7 @@ public:
 
 CPPUNIT_TEST_SUITE(LengthTest);
 CPPUNIT_TEST(testBasic);
+CPPUNIT_TEST(testDivision);
 CPPUNIT_TEST(testInRange);
 CPPUNIT_TEST(testInTuple);
 CPPUNIT_TEST(testConversionToRectanle);
diff --git a/include/basegfx/units/LengthUnitBase.hxx 
b/include/basegfx/units/LengthUnitBase.hxx
index c1d8a8e8e431..30daccef8015 100644
--- a/include/basegfx/units/LengthUnitBase.hxx
+++ b/include/basegfx/units/LengthUnitBase.hxx
@@ -173,14 +173,25 @@ inline LengthUnitBase operator-(LengthUnitBase lhs, 
const LengthUnitBase inline LengthUnitBase operator*(LengthUnitBase 
lhs, const long rhs)
 {
 return lhs *= rhs;
 }
 
+/// Division of a length unit with a scalar value.
+/// example 1cm / 2 = 0.5cm
 template  inline LengthUnitBase operator/(LengthUnitBase 
lhs, const long rhs)
 {
 return lhs /= rhs;
 }
 
+/// Division of 2 length units, which results in a ratio.
+/// example 1cm / 2cm = 0.5
+template  inline double operator/(LengthUnitBase lhs, const 
LengthUnitBase rhs)
+{
+return lhs.raw() / double(rhs.raw());
+}
+
 } // end namespace gfx


[Libreoffice-commits] core.git: sw/inc sw/source

2022-10-16 Thread Tomaž Vajngerl (via logerrit)
 sw/inc/ndtxt.hxx   |   36 +--
 sw/source/core/doc/doc.cxx |4 
 sw/source/core/layout/layact.cxx   |2 
 sw/source/core/text/txtfrm.cxx |2 
 sw/source/core/txtnode/ndtxt.cxx   |   17 +--
 sw/source/core/txtnode/txtedt.cxx  |  149 -
 sw/source/core/unocore/unoflatpara.cxx |2 
 sw/source/core/unocore/unoobj.cxx  |2 
 8 files changed, 78 insertions(+), 136 deletions(-)

New commits:
commit e051b3a6d59ed925e1cddfa72696c9a740830808
Author: Tomaž Vajngerl 
AuthorDate: Sat Sep 24 22:35:19 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sun Oct 16 21:27:31 2022 +0200

sw: refactor SwParaIdleData - rename, lifecycle, move to header

This renames SwParaIdleData to sw::ParagraphIdleData, moves it to
the header file and changes from a raw pointer initialized at the
SwTextNode construction and deleted at SwTextNode destruction to
a pure member variable (which has the same lifecycle). A it is not
a pointer anymore, there is no need to check if it is nullptr or
not, which simplifies the code.

Change-Id: I74413eef2cfd3666cf75177a6ea080219eee0ac0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140681
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 2a1f9f878cfa..a37661e18547 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -63,7 +63,6 @@ class SwInterHyphInfo;
 class SwWrongList;
 class SwGrammarMarkUp;
 struct SwDocStat;
-struct SwParaIdleData_Impl;
 enum class ExpandMode;
 enum class SwFieldIds : sal_uInt16;
 class SwField;
@@ -81,6 +80,29 @@ namespace com::sun::star {
 
 typedef o3tl::sorted_vector< sal_Int32 > SwSoftPageBreakList;
 
+namespace sw
+{
+
+enum class WrongState { TODO, PENDING, DONE };
+
+struct ParagraphIdleData
+{
+std::unique_ptr pWrong;// for spell checking
+std::unique_ptr pGrammarCheck; // for grammar 
checking /  proof reading
+std::unique_ptr pSmartTags;
+sal_uLong nNumberOfWords  = 0;
+sal_uLong nNumberOfAsianWords  = 0;
+sal_uLong nNumberOfChars  = 0;
+sal_uLong nNumberOfCharsExcludingSpaces = 0;
+bool bWordCountDirty = true;
+WrongState eWrongDirty = WrongState::TODO; ///< online spell checking 
needed/done?
+bool bGrammarCheckDirty = true;
+bool bSmartTagDirty = true;
+bool bAutoComplDirty = true;   ///< auto complete list dirty
+};
+
+} // end namespace sw
+
 /// SwTextNode is a paragraph in the document model.
 class SW_DLLPUBLIC SwTextNode final
 : public SwContentNode
@@ -105,7 +127,7 @@ class SW_DLLPUBLIC SwTextNode final
 
 OUString m_Text;
 
-SwParaIdleData_Impl* m_pParaIdleData_Impl;
+mutable sw::ParagraphIdleData m_aParagraphIdleData;
 
 /** Some of the chars this para are hidden. Paragraph has to be reformatted
on changing the view to print preview. */
@@ -172,10 +194,6 @@ class SW_DLLPUBLIC SwTextNode final
 LanguageType nLang, sal_uInt16 nLangWhichId,
 const vcl::Font *pFont,  sal_uInt16 nFontWhichId );
 
-/// Start: Data collected during idle time
-
-SAL_DLLPRIVATE void InitSwParaStatistics( bool bNew );
-
 inline void TryDeleteSwpHints();
 
 SAL_DLLPRIVATE void impl_FormatToTextAttr(const SfxItemSet& i_rAttrSet);
@@ -186,16 +204,14 @@ class SW_DLLPUBLIC SwTextNode final
 void HandleNonLegacyHint(const SfxHint&);
 
 public:
-enum class WrongState { TODO, PENDING, DONE };
-
 bool IsWordCountDirty() const;
-WrongState GetWrongDirty() const;
+sw::WrongState GetWrongDirty() const;
 bool IsWrongDirty() const;
 bool IsGrammarCheckDirty() const;
 bool IsSmartTagDirty() const;
 bool IsAutoCompleteWordDirty() const;
 void SetWordCountDirty( bool bNew ) const;
-void SetWrongDirty(WrongState eNew) const;
+void SetWrongDirty(sw::WrongState eNew) const;
 void SetGrammarCheckDirty( bool bNew ) const;
 void SetSmartTagDirty( bool bNew ) const;
 void SetAutoCompleteWordDirty( bool bNew ) const;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 62064507114b..dfd11369ade7 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1120,14 +1120,14 @@ static bool lcl_SpellAndGrammarAgain( SwNode* pNd, 
void* pArgs )
 {
 if( pTextNode->GetWrong() &&
 pTextNode->GetWrong()->InvalidateWrong() )
-pTextNode->SetWrongDirty(SwTextNode::WrongState::TODO);
+pTextNode->SetWrongDirty(sw::WrongState::TODO);
 if( pTextNode->GetGrammarCheck() &&
 pTextNode->GetGrammarCheck()->InvalidateWrong() )
 pTextNode->SetGrammarCheckDirty( true );
 }
 else
 {
-pTextNode->SetWrongDirty(SwTextNode::WrongState::TODO);
+pTextNode->SetWrongDirty(sw::WrongState::TODO);
 if( 

[Libreoffice-commits] core.git: sw/source

2022-10-16 Thread Tomaž Vajngerl (via logerrit)
 sw/source/core/inc/layact.hxx|8 +++-
 sw/source/core/layout/layact.cxx |   24 +---
 2 files changed, 20 insertions(+), 12 deletions(-)

New commits:
commit 822e5aba1b40c69591b5fa6cf94819011adc8455
Author: Tomaž Vajngerl 
AuthorDate: Thu Sep 22 15:46:58 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sun Oct 16 21:26:33 2022 +0200

sw: use enum class IdleJobArea instead of a bool (bVisAreaOnly)

It's more clear what the parameter means - either ALL or only
the VISIBLE area.

Change-Id: Ib9769da55e29feecab3aad81363429b333fa9d7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140680
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx
index bea708a4878a..417d75deebbf 100644
--- a/sw/source/core/inc/layact.hxx
+++ b/sw/source/core/inc/layact.hxx
@@ -196,6 +196,12 @@ enum class IdleJobType
 SMART_TAGS
 };
 
+enum class IdleJobArea
+{
+ALL,
+VISIBLE
+};
+
 class SwLayIdle
 {
 SwRootFrame *m_pRoot;
@@ -210,7 +216,7 @@ class SwLayIdle
 #endif
 
 bool DoIdleJob_( const SwContentFrame*, IdleJobType );
-bool DoIdleJob( IdleJobType, bool bVisAreaOnly );
+bool DoIdleJob(IdleJobType eJobType, IdleJobArea eJobArea);
 
 static bool isJobEnabled(IdleJobType eJob, const SwViewShell* pViewShell);
 public:
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 1d88d2f03cfb..fc7f1c1f5314 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -2131,7 +2131,7 @@ bool SwLayIdle::isJobEnabled(IdleJobType eJob, const 
SwViewShell* pViewShell)
 return false;
 }
 
-bool SwLayIdle::DoIdleJob( IdleJobType eJob, bool bVisAreaOnly )
+bool SwLayIdle::DoIdleJob(IdleJobType eJob, IdleJobArea eJobArea)
 {
 // Spellcheck all contents of the pages. Either only the
 // visible ones or all of them.
@@ -2142,7 +2142,7 @@ bool SwLayIdle::DoIdleJob( IdleJobType eJob, bool 
bVisAreaOnly )
 return false;
 
 SwPageFrame *pPage;
-if ( bVisAreaOnly )
+if (eJobArea == IdleJobArea::VISIBLE)
 pPage = m_pImp->GetFirstVisPage(pViewShell->GetOut());
 else
 pPage = static_cast(m_pRoot->Lower());
@@ -2208,9 +2208,11 @@ bool SwLayIdle::DoIdleJob( IdleJobType eJob, bool 
bVisAreaOnly )
 }
 
 pPage = static_cast(pPage->GetNext());
-if ( pPage && bVisAreaOnly &&
- !pPage->getFrameArea().Overlaps( m_pImp->GetShell()->VisArea()))
+if (pPage && eJobArea == IdleJobArea::VISIBLE &&
+!pPage->getFrameArea().Overlaps( m_pImp->GetShell()->VisArea()))
+{
  break;
+}
 }
 return false;
 }
@@ -2257,9 +2259,9 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
 
 // First, spellcheck the visible area. Only if there's nothing
 // to do there, we trigger the IdleFormat.
-if ( !DoIdleJob( IdleJobType::SMART_TAGS, true ) &&
- !DoIdleJob( IdleJobType::ONLINE_SPELLING, true ) &&
- !DoIdleJob( IdleJobType::AUTOCOMPLETE_WORDS, true ) )
+if ( !DoIdleJob(IdleJobType::SMART_TAGS, IdleJobArea::VISIBLE) &&
+ !DoIdleJob(IdleJobType::ONLINE_SPELLING, IdleJobArea::VISIBLE) &&
+ !DoIdleJob(IdleJobType::AUTOCOMPLETE_WORDS, IdleJobArea::VISIBLE) )
 {
 // Format, then register repaint rectangles with the SwViewShell if 
necessary.
 // This requires running artificial actions, so we don't get undesired
@@ -2371,10 +2373,10 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
 
 if (!bInterrupt)
 {
-if ( !DoIdleJob( IdleJobType::WORD_COUNT, false ) )
-if ( !DoIdleJob( IdleJobType::SMART_TAGS, false ) )
-if ( !DoIdleJob( IdleJobType::ONLINE_SPELLING, false ) )
-DoIdleJob( IdleJobType::AUTOCOMPLETE_WORDS, false );
+if (!DoIdleJob(IdleJobType::WORD_COUNT, IdleJobArea::ALL))
+if (!DoIdleJob(IdleJobType::SMART_TAGS, IdleJobArea::ALL))
+if (!DoIdleJob(IdleJobType::ONLINE_SPELLING, 
IdleJobArea::ALL))
+DoIdleJob(IdleJobType::AUTOCOMPLETE_WORDS, 
IdleJobArea::ALL);
 }
 
 bool bInValid = false;


[Libreoffice-commits] core.git: sw/source

2022-10-16 Thread Tomaž Vajngerl (via logerrit)
 sw/source/core/inc/layact.hxx|9 +
 sw/source/core/layout/layact.cxx |   61 +--
 2 files changed, 42 insertions(+), 28 deletions(-)

New commits:
commit 9b7e904f2f115f22827e4ae3b8da51610ad0c609
Author: Tomaž Vajngerl 
AuthorDate: Thu Sep 22 15:20:39 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sun Oct 16 21:26:08 2022 +0200

sw: convert IdleJobType enum to enum class

Change-Id: Ib1843830836b8d0d03d85c82979bae2f26851259
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140679
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx
index 10720173ed7b..bea708a4878a 100644
--- a/sw/source/core/inc/layact.hxx
+++ b/sw/source/core/inc/layact.hxx
@@ -188,6 +188,14 @@ public:
 
 };
 
+enum class IdleJobType
+{
+ONLINE_SPELLING,
+AUTOCOMPLETE_WORDS,
+WORD_COUNT,
+SMART_TAGS
+};
+
 class SwLayIdle
 {
 SwRootFrame *m_pRoot;
@@ -201,7 +209,6 @@ class SwLayIdle
 void ShowIdle( Color eName );
 #endif
 
-enum IdleJobType{ ONLINE_SPELLING, AUTOCOMPLETE_WORDS, WORD_COUNT, 
SMART_TAGS };
 bool DoIdleJob_( const SwContentFrame*, IdleJobType );
 bool DoIdleJob( IdleJobType, bool bVisAreaOnly );
 
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index ab1a8964de2f..1d88d2f03cfb 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1964,13 +1964,13 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
 {
 switch ( eJob )
 {
-case ONLINE_SPELLING :
+case IdleJobType::ONLINE_SPELLING:
 bProcess = pTextNode->IsWrongDirty(); break;
-case AUTOCOMPLETE_WORDS :
+case IdleJobType::AUTOCOMPLETE_WORDS:
 bProcess = pTextNode->IsAutoCompleteWordDirty(); break;
-case WORD_COUNT :
+case IdleJobType::WORD_COUNT:
 bProcess = pTextNode->IsWordCountDirty(); break;
-case SMART_TAGS :
+case IdleJobType::SMART_TAGS:
 bProcess = pTextNode->IsSmartTagDirty(); break;
 }
 if (bProcess)
@@ -2025,7 +2025,7 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
 
 switch ( eJob )
 {
-case ONLINE_SPELLING :
+case IdleJobType::ONLINE_SPELLING:
 {
 SwRect aRepaint( 
const_cast(pTextFrame)->AutoSpell_(*pTextNode, nPos) );
 // PENDING should stop idle spell checking
@@ -2036,14 +2036,14 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
 return true;
 break;
 }
-case AUTOCOMPLETE_WORDS :
+case IdleJobType::AUTOCOMPLETE_WORDS:
 
const_cast(pTextFrame)->CollectAutoCmplWrds(*pTextNode, nPos);
 // note: bPageValid remains true here even if the cursor
 // position is skipped, so no PENDING state needed currently
 if (Application::AnyInput(VCL_INPUT_ANY & 
VclInputFlags(~VclInputFlags::TIMER)))
 return true;
 break;
-case WORD_COUNT :
+case IdleJobType::WORD_COUNT:
 {
 const sal_Int32 nEnd = pTextNode->GetText().getLength();
 SwDocStat aStat;
@@ -2052,7 +2052,7 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
 return true;
 break;
 }
-case SMART_TAGS :
+case IdleJobType::SMART_TAGS:
 {
 try {
 const SwRect aRepaint( 
const_cast(pTextFrame)->SmartTagScan(*pTextNode) );
@@ -2101,32 +2101,31 @@ bool SwLayIdle::isJobEnabled(IdleJobType eJob, const 
SwViewShell* pViewShell)
 {
 switch (eJob)
 {
-case ONLINE_SPELLING:
+case IdleJobType::ONLINE_SPELLING:
 {
 const SwViewOption* pViewOptions = pViewShell->GetViewOptions();
 return pViewOptions->IsOnlineSpell();
 }
 
-case AUTOCOMPLETE_WORDS:
+case IdleJobType::AUTOCOMPLETE_WORDS:
 {
 if (!SwViewOption::IsAutoCompleteWords() || 
SwDoc::GetAutoCompleteWords().IsLockWordLstLocked())
 return false;
 return true;
 }
 
-case WORD_COUNT:
+case IdleJobType::WORD_COUNT:
 {
 return pViewShell->getIDocumentStatistics().GetDocStat().bModified;
 }
 
-case SMART_TAGS:
+case IdleJobType::SMART_TAGS:
 {
 const SwDoc* pDoc = pViewShell->GetDoc();
 if (!pDoc->GetDocShell()->IsHelpDocument() || pDoc->isXForms() || 
!SwSmartTagMgr::Get().IsSmartTagsEnabled())
 return false;
 return true;
 }

[Libreoffice-commits] core.git: sw/source

2022-10-16 Thread Tomaž Vajngerl (via logerrit)
 sw/source/core/inc/layact.hxx|1 
 sw/source/core/layout/layact.cxx |   71 +++
 2 files changed, 43 insertions(+), 29 deletions(-)

New commits:
commit 01396925b76011ffccb6eea40956a22d58de6f17
Author: Tomaž Vajngerl 
AuthorDate: Thu Sep 22 14:50:39 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sun Oct 16 21:25:26 2022 +0200

sw: move the check to determine if job is enabled to own method

Change-Id: Idf681b59f127a6aa1c6496ad7db39f3dd367b99c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140678
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx
index 6e8a109fbded..10720173ed7b 100644
--- a/sw/source/core/inc/layact.hxx
+++ b/sw/source/core/inc/layact.hxx
@@ -205,6 +205,7 @@ class SwLayIdle
 bool DoIdleJob_( const SwContentFrame*, IdleJobType );
 bool DoIdleJob( IdleJobType, bool bVisAreaOnly );
 
+static bool isJobEnabled(IdleJobType eJob, const SwViewShell* pViewShell);
 public:
 SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pImp );
 ~SwLayIdle();
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 54793d2f4bb9..ab1a8964de2f 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -2097,37 +2097,50 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
 return false;
 }
 
+bool SwLayIdle::isJobEnabled(IdleJobType eJob, const SwViewShell* pViewShell)
+{
+switch (eJob)
+{
+case ONLINE_SPELLING:
+{
+const SwViewOption* pViewOptions = pViewShell->GetViewOptions();
+return pViewOptions->IsOnlineSpell();
+}
+
+case AUTOCOMPLETE_WORDS:
+{
+if (!SwViewOption::IsAutoCompleteWords() || 
SwDoc::GetAutoCompleteWords().IsLockWordLstLocked())
+return false;
+return true;
+}
+
+case WORD_COUNT:
+{
+return pViewShell->getIDocumentStatistics().GetDocStat().bModified;
+}
+
+case SMART_TAGS:
+{
+const SwDoc* pDoc = pViewShell->GetDoc();
+if (!pDoc->GetDocShell()->IsHelpDocument() || pDoc->isXForms() || 
!SwSmartTagMgr::Get().IsSmartTagsEnabled())
+return false;
+return true;
+}
+default: OSL_FAIL("Unknown idle job type");
+}
+
+return false;
+}
+
 bool SwLayIdle::DoIdleJob( IdleJobType eJob, bool bVisAreaOnly )
 {
 // Spellcheck all contents of the pages. Either only the
 // visible ones or all of them.
 const SwViewShell* pViewShell = m_pImp->GetShell();
-const SwViewOption* pViewOptions = pViewShell->GetViewOptions();
-const SwDoc* pDoc = pViewShell->GetDoc();
 
-switch ( eJob )
-{
-case ONLINE_SPELLING :
-if( !pViewOptions->IsOnlineSpell() )
-return false;
-break;
-case AUTOCOMPLETE_WORDS :
-if( !SwViewOption::IsAutoCompleteWords() ||
- SwDoc::GetAutoCompleteWords().IsLockWordLstLocked())
-return false;
-break;
-case WORD_COUNT :
-if ( !pViewShell->getIDocumentStatistics().GetDocStat().bModified )
-return false;
-break;
-case SMART_TAGS :
-if ( pDoc->GetDocShell()->IsHelpDocument() ||
- pDoc->isXForms() ||
-!SwSmartTagMgr::Get().IsSmartTagsEnabled() )
-return false;
-break;
-default: OSL_FAIL( "Unknown idle job type" );
-}
+// Check if job ius enabled and can run
+if (!isJobEnabled(eJob, pViewShell))
+return false;
 
 SwPageFrame *pPage;
 if ( bVisAreaOnly )
@@ -2141,15 +2154,15 @@ bool SwLayIdle::DoIdleJob( IdleJobType eJob, bool 
bVisAreaOnly )
 while ( pPage )
 {
 m_bPageValid = true;
-const SwContentFrame *pCnt = pPage->ContainsContent();
-while( pCnt && pPage->IsAnLower( pCnt ) )
+const SwContentFrame* pContentFrame = pPage->ContainsContent();
+while (pContentFrame && pPage->IsAnLower(pContentFrame))
 {
-if ( DoIdleJob_( pCnt, eJob ) )
+if (DoIdleJob_(pContentFrame, eJob))
 {
 SAL_INFO("sw.idle", "DoIdleJob " << eJob << " interrupted on 
page " << pPage->GetPhyPageNum());
 return true;
 }
-pCnt = pCnt->GetNextContentFrame();
+pContentFrame = pContentFrame->GetNextContentFrame();
 }
 if ( pPage->GetSortedObjs() )
 {


[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - editeng/inc editeng/source svx/source

2022-09-27 Thread Tomaž Vajngerl (via logerrit)
 editeng/inc/editdoc.hxx |   28 ++-
 editeng/source/editeng/editdoc.cxx  |   14 +++--
 editeng/source/editeng/impedit2.cxx |   36 +--
 editeng/source/editeng/impedit3.cxx |   86 
 editeng/source/items/svxfont.cxx|   10 ++--
 svx/source/svdraw/svdotext.cxx  |3 +
 6 files changed, 117 insertions(+), 60 deletions(-)

New commits:
commit 422b199a0a2250b11cb81c521b8a62c21243cc8a
Author: Tomaž Vajngerl 
AuthorDate: Tue Sep 27 22:21:37 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Sep 27 22:21:37 2022 +0200

Check Textbox Fit To Frame

Change-Id: I4a02658d06b84cd1222713f12adf14a8194b5b93

diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index 25a3dca4b1fc..4aa6ff167b45 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -409,7 +409,29 @@ public:
 sal_Int32  GetLen() const  { return nLen; }
 void   SetLen( sal_Int32 nL ) { nLen = nL; }
 
-Size&  GetSize()   { return aOutSz; }
+void setWidth(tools::Long nWidth)
+{
+aOutSz.setWidth(nWidth);
+}
+
+void setHeight(tools::Long nHeight)
+{
+aOutSz.setHeight(nHeight);
+}
+
+void adjustSize(tools::Long nDeltaX, tools::Long nDeltaY)
+{
+if (nDeltaX != 0)
+aOutSz.AdjustWidth(nDeltaX);
+if (nDeltaY != 0)
+aOutSz.AdjustHeight(nDeltaY);
+}
+
+void SetSize(const Size& rSize)
+{
+aOutSz = rSize;
+}
+
 const Size&GetSize() const { return aOutSz; }
 
 void   SetKind(PortionKind n)  { nKind = n; }
@@ -728,7 +750,7 @@ private:
 rtl::Reference pItemPool;
 Link  aModifyHdl;
 
-SvxFont aDefFont;   //faster than ever from the pool!!
+SvxFont maDefFont;   //faster than ever from the pool!!
 sal_uInt16  nDefTab;
 boolbIsVertical:1;
 TextRotationmnRotation;
@@ -755,7 +777,7 @@ public:
 voidSetModifyHdl( const Link& rLink ) { 
aModifyHdl = rLink; }
 
 voidCreateDefFont( bool bUseStyles );
-const SvxFont&  GetDefFont() const { return aDefFont; }
+const SvxFont&  GetDefFont() const { return maDefFont; }
 
 voidSetDefTab( sal_uInt16 nTab ){ nDefTab = nTab ? nTab : 
DEFTAB; }
 sal_uInt16  GetDefTab() const   { return nDefTab; }
diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index c3777f111783..c8113a601cf7 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1988,7 +1988,11 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, 
bool bSearchInParent, S
 if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_BKGCOLOR ) == 
SfxItemState::SET ) )
 rFont.SetFillColor( rSet.Get( EE_CHAR_BKGCOLOR ).GetValue() );
 if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontHeight ) == 
SfxItemState::SET ) )
-rFont.SetFontSize( Size( rFont.GetFontSize().Width(), 
static_cast(rSet.Get( nWhich_FontHeight ) 
).GetHeight() ) );
+{
+auto nHeight = static_cast(rSet.Get( 
nWhich_FontHeight ) ).GetHeight();
+printf ("FONTHEIGHT %ld\n", nHeight);
+rFont.SetFontSize(Size(rFont.GetFontSize().Width(), nHeight));
+}
 if ( bSearchInParent || ( rSet.GetItemState( nWhich_Weight ) == 
SfxItemState::SET ) )
 rFont.SetWeight( static_cast(rSet.Get( 
nWhich_Weight )).GetWeight() );
 if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_UNDERLINE ) == 
SfxItemState::SET ) )
@@ -2039,14 +2043,14 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& 
rSet, bool bSearchInParent, S
 void EditDoc::CreateDefFont( bool bUseStyles )
 {
 SfxItemSetFixed aTmpSet( GetItemPool() );
-CreateFont( aDefFont, aTmpSet );
-aDefFont.SetVertical( IsEffectivelyVertical() );
-aDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? 
(IsTopToBottom() ? 2700 : 900) : 0) );
+CreateFont(maDefFont, aTmpSet);
+maDefFont.SetVertical( IsEffectivelyVertical() );
+maDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? 
(IsTopToBottom() ? 2700 : 900) : 0) );
 
 for ( sal_Int32 nNode = 0; nNode < Count(); nNode++ )
 {
 ContentNode* pNode = GetObject( nNode );
-pNode->GetCharAttribs().GetDefFont() = aDefFont;
+pNode->GetCharAttribs().GetDefFont() = maDefFont;
 if ( bUseStyles )
 pNode->CreateDefFont();
 }
diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index ffa8913b0c75..ddde6b26f9c7 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3347,6 +3347,7 @@ sal_uInt32 ImpEditEngine::GetTextHeight() const
 
 sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace )
 {
+printf("ImpEditEngine::CalcTextWidth\n");
 // If still not 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 2 commits - filter/source include/svx sd/source svx/source

2022-09-16 Thread Tomaž Vajngerl (via logerrit)
 filter/source/svg/svgfilter.cxx   |   10 +-
 include/svx/svdpage.hxx   |   78 +---
 include/svx/svdpagv.hxx   |   10 +-
 sd/source/core/drawdoc.cxx|   10 +-
 sd/source/core/drawdoc2.cxx   |   38 ++--
 sd/source/core/drawdoc3.cxx   |   79 +++-
 sd/source/core/sdpage.cxx |   76 +++-
 sd/source/filter/grf/sdgrffilter.cxx  |8 -
 sd/source/filter/html/htmlex.cxx  |   19 ++--
 sd/source/ui/func/fuexpand.cxx|   10 --
 sd/source/ui/func/fupage.cxx  |   27 +++--
 sd/source/ui/func/fusumry.cxx |   10 --
 sd/source/ui/sidebar/DocumentHelper.cxx   |   10 +-
 sd/source/ui/unoidl/unomodel.cxx  |   20 
 sd/source/ui/unoidl/unopage.cxx   |   21 +---
 sd/source/ui/view/DocumentRenderer.cxx|   37 +++
 sd/source/ui/view/drviews3.cxx|   25 ++---
 sd/source/ui/view/drviews4.cxx|3 
 sd/source/ui/view/drviews7.cxx|   16 +--
 sd/source/ui/view/drviews8.cxx|7 -
 sd/source/ui/view/drviews9.cxx|7 -
 sd/source/ui/view/drviewsa.cxx|3 
 sd/source/ui/view/outlview.cxx|   10 --
 sd/source/ui/view/sdview4.cxx |4 
 sd/source/ui/view/viewshe2.cxx|3 
 svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx |   14 +--
 svx/source/svdraw/svdedtv1.cxx|5 -
 svx/source/svdraw/svdpage.cxx |   84 ++
 svx/source/svdraw/svdpagv.cxx |   26 +++--
 svx/source/svdraw/svdsnpv.cxx |8 -
 svx/source/unodraw/UnoGraphicExporter.cxx |6 -
 31 files changed, 333 insertions(+), 351 deletions(-)

New commits:
commit 4e93875b4a8e0043e41f6bce42b97f3c000b19e9
Author: Tomaž Vajngerl 
AuthorDate: Fri Sep 16 13:15:03 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Fri Sep 16 16:36:56 2022 +0200

svx: change SdrPage left,right,upper,lower border to use gfx::Length

Change-Id: I7cde7bccfe17cab27eb643d851509b68e128842d

diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 60bafd2fa1bb..abf50cf476a0 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -321,12 +321,12 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< 
PropertyValue >& rDescripto
 // in comparison. Use a common scaling factor for hor/ver to not 
get
 // asynchronous border distances, though. All in all this will 
adapt borders
 // nicely and is based on office-defaults for 
standard-page-border-sizes.
-const Size aPageSize = 
gfx::length::toSizeHmm(pTargetSdrPage->getSize());
+const gfx::Size2DL aPageSize = pTargetSdrPage->getSize();
 const double fBorderRelation((
-static_cast< double >(pTargetSdrPage->GetLeftBorder()) / 
aPageSize.Width() +
-static_cast< double >(pTargetSdrPage->GetRightBorder()) / 
aPageSize.Width() +
-static_cast< double >(pTargetSdrPage->GetUpperBorder()) / 
aPageSize.Height() +
-static_cast< double >(pTargetSdrPage->GetLowerBorder()) / 
aPageSize.Height()) / 4.0);
+pTargetSdrPage->getLeftBorder().as_emu() / 
aPageSize.getWidth().as_emu() +
+pTargetSdrPage->getRightBorder().as_emu() / 
aPageSize.getWidth().as_emu() +
+pTargetSdrPage->getUpperBorder().as_emu() / 
aPageSize.getHeight().as_emu() +
+pTargetSdrPage->getLowerBorder().as_emu() / 
aPageSize.getHeight().as_emu()) / 4.0);
 const tools::Long nAllBorder(basegfx::fround((aGraphicSize.Width() 
+ aGraphicSize.Height()) * fBorderRelation * 0.5));
 
 // Adapt PageSize and Border stuff. To get all MasterPages and 
PresObjs
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index ccb7d581695b..0f101b3e6c63 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -353,6 +353,46 @@ public:
 void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
+class Border
+{
+private:
+gfx::Length maLeft;
+gfx::Length maRight;
+gfx::Length maUpper;
+gfx::Length maLower;
+public:
+Border()
+: maLeft(0_emu)
+, maRight(0_emu)
+, maUpper(0_emu)
+, maLower(0_emu)
+{}
+
+gfx::Length const& getLeft() const { return maLeft; }
+gfx::Length const& getRight() const { return maRight; }
+gfx::Length const& getUpper() const { return maUpper; }
+gfx::Length const& getLower() const { return 

[Libreoffice-commits] core.git: chart2/source

2022-09-15 Thread Tomaž Vajngerl (via logerrit)
 chart2/source/model/main/DataTable.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit e46f9cc4b506c325cbe1060777bbc81fd1630f49
Author: Tomaž Vajngerl 
AuthorDate: Thu Sep 15 10:45:34 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Sep 15 19:27:05 2022 +0200

chart2: Set the data table fill style to default to NONE

Change-Id: I57e463bf110fd3818ec586bbab1db75ff1101ff6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139972
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/chart2/source/model/main/DataTable.cxx 
b/chart2/source/model/main/DataTable.cxx
index d21febb14e47..d7d3bf2069c1 100644
--- a/chart2/source/model/main/DataTable.cxx
+++ b/chart2/source/model/main/DataTable.cxx
@@ -18,6 +18,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -75,6 +76,9 @@ private:
 ::chart::PropertyHelper::setPropertyValue(
 aMap, ::chart::LinePropertiesHelper::PROP_LINE_WIDTH, 
uno::Any(sal_Int32(1)));
 
+::chart::PropertyHelper::setPropertyValueDefault(
+aMap, ::chart::FillProperties::PROP_FILL_STYLE, 
drawing::FillStyle_NONE);
+
 float fDefaultCharHeight = 10.0;
 ::chart::PropertyHelper::setPropertyValue(
 aMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, 
fDefaultCharHeight);


[Libreoffice-commits] core.git: chart2/source offapi/com oox/inc xmloff/source

2022-09-15 Thread Tomaž Vajngerl (via logerrit)
 chart2/source/controller/dialogs/tp_DataTable.hxx|1 
 chart2/source/controller/inc/DataTableItemConverter.hxx  |1 
 chart2/source/controller/inc/dlg_InsertDataTable.hxx |5 +++
 chart2/source/controller/inc/res_DataTableProperties.hxx |1 
 chart2/source/controller/main/ChartController_Insert.cxx |4 +-
 chart2/source/inc/ObjectIdentifier.hxx   |1 
 chart2/source/model/main/DataTable.cxx   |1 
 chart2/source/view/inc/DataTableView.hxx |   25 +++
 chart2/source/view/main/DataTableView.cxx|9 -
 offapi/com/sun/star/chart2/XDataTable.idl|4 ++
 oox/inc/drawingml/chart/datatablecontext.hxx |3 -
 oox/inc/drawingml/chart/datatableconverter.hxx   |4 ++
 xmloff/source/chart/SchXMLDataTableContext.cxx   |4 +-
 xmloff/source/chart/SchXMLDataTableContext.hxx   |1 
 xmloff/source/chart/SchXMLExport.cxx |2 -
 15 files changed, 60 insertions(+), 6 deletions(-)

New commits:
commit 23c01f82682469e25fa2a8407c55100e89ab86de
Author: Tomaž Vajngerl 
AuthorDate: Wed Sep 14 23:55:20 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Sep 15 12:38:22 2022 +0200

Add documentation for data table added classes and functions

Change-Id: Idc9756bf5b468d8ed0d11e6a75703d96350e1273
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139960
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/chart2/source/controller/dialogs/tp_DataTable.hxx 
b/chart2/source/controller/dialogs/tp_DataTable.hxx
index a4ef6d6cf436..00ab64cf89ce 100644
--- a/chart2/source/controller/dialogs/tp_DataTable.hxx
+++ b/chart2/source/controller/dialogs/tp_DataTable.hxx
@@ -14,6 +14,7 @@
 
 namespace chart
 {
+/** Tab page for the data table properties */
 class DataTableTabPage : public SfxTabPage
 {
 private:
diff --git a/chart2/source/controller/inc/DataTableItemConverter.hxx 
b/chart2/source/controller/inc/DataTableItemConverter.hxx
index 5dbfaf60bba9..68c5790ba345 100644
--- a/chart2/source/controller/inc/DataTableItemConverter.hxx
+++ b/chart2/source/controller/inc/DataTableItemConverter.hxx
@@ -30,6 +30,7 @@ class SdrModel;
 
 namespace chart::wrapper
 {
+/** Convert data table properties to and from ItemSet and UNO PropertySet */
 class DataTableItemConverter final : public ItemConverter
 {
 public:
diff --git a/chart2/source/controller/inc/dlg_InsertDataTable.hxx 
b/chart2/source/controller/inc/dlg_InsertDataTable.hxx
index 346f7b651c24..cd77099864c4 100644
--- a/chart2/source/controller/inc/dlg_InsertDataTable.hxx
+++ b/chart2/source/controller/inc/dlg_InsertDataTable.hxx
@@ -14,6 +14,7 @@
 
 namespace chart
 {
+/** The data table properties (data) used by the dialog */
 struct DataTableDialogData
 {
 bool mbShow = true;
@@ -23,6 +24,7 @@ struct DataTableDialogData
 bool mbKeys = false;
 };
 
+/** The dialog to change the data table specific properties */
 class InsertDataTableDialog final : public weld::GenericDialogController
 {
 private:
@@ -38,7 +40,10 @@ private:
 public:
 InsertDataTableDialog(weld::Window* pParent);
 
+/** Set the initial state of the data table properties */
 void init(DataTableDialogData const& rData);
+
+/** Get the state of the data table properties from the dialog */
 DataTableDialogData& getDataTableDialogData();
 };
 
diff --git a/chart2/source/controller/inc/res_DataTableProperties.hxx 
b/chart2/source/controller/inc/res_DataTableProperties.hxx
index 299934cb0211..4b2aaa4f2ef7 100644
--- a/chart2/source/controller/inc/res_DataTableProperties.hxx
+++ b/chart2/source/controller/inc/res_DataTableProperties.hxx
@@ -14,6 +14,7 @@
 
 namespace chart
 {
+/** The shared UI elements for the data table properties */
 class DataTablePropertiesResources final
 {
 private:
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx 
b/chart2/source/controller/main/ChartController_Insert.cxx
index 78005072a009..c75ac20457e5 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -235,6 +235,7 @@ void 
ChartController::executeDispatch_OpenInsertDataTableDialog()
 }
 }
 
+/** Create and insert a data table to the chart */
 void ChartController::executeDispatch_InsertDataTable()
 {
 auto aUndoDescription = 
ActionDescriptionProvider::createDescription(ActionDescriptionProvider::ActionType::Insert,
 SchResId(STR_DATA_TABLE));
@@ -254,16 +255,17 @@ void ChartController::executeDispatch_InsertDataTable()
 }
 }
 
+/** Delete a data table from the chart */
 void ChartController::executeDispatch_DeleteDataTable()
 {
 auto aUndoDescription = 
ActionDescriptionProvider::createDescription(ActionDescriptionProvider::ActionType::Delete,
 SchResId(STR_DATA_TABLE));
 UndoGuard aUndoGuard(aUndoDescription, m_xUndoManager);
 
-
 rtl::Reference xDiagram = 

[Libreoffice-commits] core.git: xmloff/source

2022-09-15 Thread Tomaž Vajngerl (via logerrit)
 xmloff/source/chart/SchXMLDataTableContext.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 47fe4927f01d7461f3a8f152895a75c98eae3e71
Author: Tomaž Vajngerl 
AuthorDate: Wed Sep 14 23:53:52 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Sep 15 10:16:22 2022 +0200

remove accidental printf

Change-Id: I9deb3ec3dad5174dfb49cf0df3004746f3e47ea6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139959
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/xmloff/source/chart/SchXMLDataTableContext.cxx 
b/xmloff/source/chart/SchXMLDataTableContext.cxx
index 4271221ed71f..a9a26d2e1d3d 100644
--- a/xmloff/source/chart/SchXMLDataTableContext.cxx
+++ b/xmloff/source/chart/SchXMLDataTableContext.cxx
@@ -42,7 +42,6 @@ 
SchXMLDataTableContext::SchXMLDataTableContext(SchXMLImportHelper& rImpHelper, S
 void SchXMLDataTableContext::startFastElement(
 sal_Int32 /*nElement*/, const 
uno::Reference& xAttrList)
 {
-printf("SchXMLDataTableContext::startFastElement\n");
 auto xChartDocument = mrImportHelper.GetChartDocument();
 if (!xChartDocument.is())
 return;


[Libreoffice-commits] core.git: chart2/qa

2022-09-15 Thread Tomaž Vajngerl (via logerrit)
 chart2/qa/extras/chart2export.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 916692b861a969b93b01deb857cc0770e1e8c224
Author: Tomaž Vajngerl 
AuthorDate: Wed Sep 14 19:49:45 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Sep 15 10:16:02 2022 +0200

chart2: reenable chart data table test

Change-Id: Ic40dfeb742e97b90332dd711cfb582b6f102c8df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139958
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index a1ea57b47eb7..fc6ffc4d4dbf 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -618,8 +618,6 @@ void Chart2ExportTest::testScatterXAxisCategories()
 
 void Chart2ExportTest::testChartDataTable()
 {
-/*  Disable test temporarily until OOXML filter is updated
-
 load(u"/chart2/qa/extras/data/docx/", u"testChartDataTable.docx");
 
 xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open 
XML Text");
@@ -627,7 +625,6 @@ void Chart2ExportTest::testChartDataTable()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:dTable/c:showHorzBorder", "val", "1");
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:dTable/c:showVertBorder", "val", "1");
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:dTable/c:showOutline", "val", "1");
-*/
 }
 
 void Chart2ExportTest::testChartExternalData()


[Libreoffice-commits] core.git: basegfx/CppunitTest_basegfx.mk basegfx/source basegfx/test canvas/source cppcanvas/source drawinglayer/source include/basegfx include/vcl sd/source slideshow/source sli

2022-09-11 Thread Tomaž Vajngerl (via logerrit)
 basegfx/CppunitTest_basegfx.mk |1 
 basegfx/source/tools/canvastools.cxx   |6 
 basegfx/test/B2DPointTest.cxx  |   14 +
 basegfx/test/B2DSizeTest.cxx   |  108 
++
 canvas/source/tools/canvascustomspritehelper.cxx   |   10 
 canvas/source/vcl/spritecanvashelper.cxx   |2 
 cppcanvas/source/mtfrenderer/implrenderer.cxx  |   24 +-
 cppcanvas/source/mtfrenderer/textaction.cxx|   48 ++--
 cppcanvas/source/mtfrenderer/textlineshelper.cxx   |2 
 cppcanvas/source/mtfrenderer/transparencygroupaction.cxx   |   14 -
 drawinglayer/source/tools/emfphelperdata.cxx   |8 
 include/basegfx/point/b2dpoint.hxx |6 
 include/basegfx/tuple/Size2D.hxx   |2 
 include/basegfx/utils/canvastools.hxx  |3 
 include/basegfx/vector/b2dsize.hxx |   69 +-
 include/vcl/canvastools.hxx|4 
 sd/source/ui/view/Outliner.cxx |4 
 slideshow/source/engine/animatedsprite.cxx |   16 -
 slideshow/source/engine/animationfactory.cxx   |   24 +-
 slideshow/source/engine/pointersymbol.cxx  |2 
 slideshow/source/engine/rehearsetimingsactivity.cxx|4 
 slideshow/source/engine/shapeattributelayer.cxx|   12 -
 slideshow/source/engine/shapes/drawshape.cxx   |   20 -
 slideshow/source/engine/shapes/viewshape.cxx   |   21 +
 slideshow/source/engine/slide/slideimpl.cxx|8 
 slideshow/source/engine/slideshowimpl.cxx  |2 
 slideshow/source/engine/slideview.cxx  |   14 -
 slideshow/source/engine/tools.cxx  |   18 -
 slideshow/source/engine/transitions/clippingfunctor.cxx|   12 -
 slideshow/source/engine/transitions/combtransition.cxx |9 
 slideshow/source/engine/transitions/shapetransitionfactory.cxx |4 
 slideshow/source/engine/transitions/slidechangebase.cxx|6 
 slideshow/source/engine/transitions/slidetransitionfactory.cxx |8 
 slideshow/source/engine/waitsymbol.cxx |2 
 slideshow/source/inc/animatedsprite.hxx|1 
 slideshow/source/inc/viewlayer.hxx |2 
 slideshow/test/testview.cxx|3 
 svx/source/sdr/overlay/overlaytools.cxx|4 
 svx/source/svdraw/svdpdf.cxx   |5 
 sw/source/core/docnode/ndnotxt.cxx |4 
 sw/source/uibase/docvw/HeaderFooterWin.cxx |2 
 vcl/qa/cppunit/PDFiumLibraryTest.cxx   |4 
 vcl/qa/cppunit/VectorGraphicSearchTest.cxx |4 
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |2 
 vcl/source/filter/ipdf/pdfread.cxx |   16 -
 vcl/source/filter/jpeg/JpegWriter.cxx  |2 
 vcl/source/filter/jpeg/jpegc.cxx   |8 
 vcl/source/graphic/VectorGraphicSearch.cxx |6 
 vcl/source/helper/canvastools.cxx  |   11 -
 49 files changed, 387 insertions(+), 194 deletions(-)

New commits:
commit c747486335c089baf440b8f040d3ffdc14aa5049
Author: Tomaž Vajngerl 
AuthorDate: Thu Sep 8 11:12:27 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sun Sep 11 17:16:59 2022 +0200

basegfx: replace typedef with a class B2DSize based on Size2D

Change-Id: Id8b3c2bcf0bf4be5aba2812b0edda479bc20c6a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139683
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/basegfx/CppunitTest_basegfx.mk b/basegfx/CppunitTest_basegfx.mk
index 88f4966262f2..219025e8e3e6 100644
--- a/basegfx/CppunitTest_basegfx.mk
+++ b/basegfx/CppunitTest_basegfx.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,basegfx,\
 basegfx/test/B2DPolygonToolsTest \
 basegfx/test/B2DPolyPolygonTest \
 basegfx/test/B2DPolyPolygonCutterTest \
+basegfx/test/B2DSizeTest \
 basegfx/test/B1DRangeTest \
 basegfx/test/B2XRangeTest \
 basegfx/test/B2IBoxTest \
diff --git a/basegfx/source/tools/canvastools.cxx 
b/basegfx/source/tools/canvastools.cxx
index 11ebe70dec28..d388356199a2 100644
--- a/basegfx/source/tools/canvastools.cxx
+++ b/basegfx/source/tools/canvastools.cxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -373,10 +374,9 @@ namespace basegfx::unotools
 return output;
 }
 
-  

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 382 commits - accessibility/inc accessibility/source android/source basctl/source basegfx/CppunitTest_basegfx.mk basegfx/source bas

2022-09-10 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit 7e8a09ee156a3c03f8d924c2d2c3fad0d5686540
Author: Tomaž Vajngerl 
AuthorDate: Fri Sep 2 08:39:38 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sat Sep 10 09:04:46 2022 +0200

svx: change SdrPage size to use gfx::Length

Change-Id: I9c9367b668302ced1b2b255a23e875951d7109bf

diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 306555489df5..3874307900d0 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -215,12 +215,13 @@ DlgEditor::DlgEditor (
 aMarkIdle.SetInvokeHandler( LINK( this, DlgEditor, MarkTimeout ) );
 
 rWindow.SetMapMode( MapMode( MapUnit::Map100thMM ) );
-pDlgEdPage->SetSize( rWindow.PixelToLogic( Size(DLGED_PAGE_WIDTH_MIN, 
DLGED_PAGE_HEIGHT_MIN) ) );
+Size aPageSize = rWindow.PixelToLogic(Size(DLGED_PAGE_WIDTH_MIN, 
DLGED_PAGE_HEIGHT_MIN));
+pDlgEdPage->setSize({ gfx::Length::hmm(aPageSize.Width()), 
gfx::Length::hmm(aPageSize.Height()) });
 
 pDlgEdView->ShowSdrPage(pDlgEdView->GetModel()->GetPage(0));
 pDlgEdView->SetLayerVisible( "HiddenLayer", false );
 pDlgEdView->SetMoveSnapOnlyTopLeft(true);
-pDlgEdView->SetWorkArea( tools::Rectangle( Point( 0, 0 ), 
pDlgEdPage->GetSize() ) );
+
pDlgEdView->SetWorkArea(gfx::length::toRectangleHmm(pDlgEdPage->getRectangle()));
 
 Size aGridSize( 100, 100 );  // 100TH_MM
 pDlgEdView->SetGridCoarse( aGridSize );
@@ -266,7 +267,7 @@ void DlgEditor::InitScrollBars()
 return;
 
 Size aOutSize = rWindow.GetOutDev()->GetOutputSize();
-Size aPgSize  = pDlgEdPage->GetSize();
+Size aPgSize = gfx::length::toSizeHmm(pDlgEdPage->getSize());
 
 pHScroll->SetRange( Range( 0, aPgSize.Width()  ));
 pVScroll->SetRange( Range( 0, aPgSize.Height() ));
@@ -1216,11 +1217,11 @@ bool DlgEditor::AdjustPageSize()
 
 if ( pDlgEdPage )
 {
-Size aPageSize = pDlgEdPage->GetSize();
+Size aPageSize = gfx::length::toSizeHmm(pDlgEdPage->getSize());
 if ( nNewPageWidth != aPageSize.Width() || nNewPageHeight != 
aPageSize.Height() )
 {
 Size aNewPageSize( nNewPageWidth, nNewPageHeight );
-pDlgEdPage->SetSize( aNewPageSize );
+pDlgEdPage->setSize({ 
gfx::Length::hmm(aNewPageSize.Width()), gfx::Length::hmm(aNewPageSize.Height()) 
});
 pDlgEdView->SetWorkArea( tools::Rectangle( Point( 0, 0 ), 
aNewPageSize ) );
 bAdjustedPageSize = true;
 }
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 3e06307941da..9396553aaeb3 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -418,7 +418,7 @@ void DlgEdObj::PositionAndSizeChange( const 
beans::PropertyChangeEvent& evt )
 DBG_ASSERT( pDlgEdForm, "DlgEdObj::PositionAndSizeChange: no form!" );
 DlgEdPage& rPage = pDlgEdForm->GetDlgEditor().GetPage();
 {
-Size aPageSize = rPage.GetSize();
+Size aPageSize = gfx::length::toSizeHmm(rPage.getSize());
 sal_Int32 nPageWidthIn = aPageSize.Width();
 sal_Int32 nPageHeightIn = aPageSize.Height();
 sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight;
@@ -1297,7 +1297,7 @@ void DlgEdForm::PositionAndSizeChange( const 
beans::PropertyChangeEvent& evt )
 
 sal_Int32 nPageXIn = 0;
 sal_Int32 nPageYIn = 0;
-Size aPageSize = rPage.GetSize();
+Size aPageSize = gfx::length::toSizeHmm(rPage.getSize());
 sal_Int32 nPageWidthIn = aPageSize.Width();
 sal_Int32 nPageHeightIn = aPageSize.Height();
 sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight;
@@ -1347,7 +1347,7 @@ void DlgEdForm::PositionAndSizeChange( const 
beans::PropertyChangeEvent& evt )
 if ( bAdjustedPageSize )
 {
 rEditor.InitScrollBars();
-aPageSize = rPage.GetSize();
+aPageSize = gfx::length::toSizeHmm(rPage.getSize());
 nPageWidthIn = aPageSize.Width();
 nPageHeightIn = aPageSize.Height();
 if ( TransformSdrToControlCoordinates( nPageXIn, nPageYIn, 
nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) )
diff --git a/basctl/source/dlged/dlgedview.cxx 
b/basctl/source/dlged/dlgedview.cxx
index 81271d38f8bd..bf6a52be6ae7 100644
--- a/basctl/source/dlged/dlgedview.cxx
+++ b/basctl/source/dlged/dlgedview.cxx
@@ -90,7 +90,7 @@ void DlgEdView::MakeVisible( const tools::Rectangle& rRect, 
vcl::Window& rWin )
 nScrollY -= nDeltaY;
 
 // don't scroll beyond the page size
-Size aPageSize = rDlgEditor.GetPage().GetSize();
+Size aPageSize = gfx::length::toSizeHmm(rDlgEditor.GetPage().getSize());
 sal_Int32 nPageWidth  = aPageSize.Width();
 sal_Int32 nPageHeight = aPageSize.Height();
 
diff --git a/basegfx/test/LengthUnitTest.cxx b/basegfx/test/LengthUnitTest.cxx
index 421e98934c90..8861a2ade316 100644
--- 

[Libreoffice-commits] core.git: include/basegfx

2022-09-10 Thread Tomaž Vajngerl (via logerrit)
 include/basegfx/tuple/Size2D.hxx  |  115 ++
 include/basegfx/tuple/Tuple2D.hxx |2 
 2 files changed, 117 insertions(+)

New commits:
commit ac7c09450bfc50269c0244fdb6eb55f2829d7dbf
Author: Tomaž Vajngerl 
AuthorDate: Tue Sep 6 19:39:00 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sat Sep 10 08:46:23 2022 +0200

basegfx: add Size2D template class - subclass Tuple2D

Also improve Tuple2D - add operators

Change-Id: I9b23fb2f716ab99a4d4349a48f4ccc2334a9f865
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139682
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/basegfx/tuple/Size2D.hxx b/include/basegfx/tuple/Size2D.hxx
new file mode 100644
index ..87bd95330bb8
--- /dev/null
+++ b/include/basegfx/tuple/Size2D.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include 
+
+namespace basegfx
+{
+template  class Size2D : protected Tuple2D
+{
+public:
+Size2D(TYPE width, TYPE height)
+: Tuple2D(width, height)
+{
+}
+
+Size2D(Tuple2D const& rTuple)
+: Tuple2D(rTuple.getX(), rTuple.getY())
+{
+}
+
+TYPE getWidth() const { return Tuple2D::getX(); }
+
+TYPE getHeight() const { return Tuple2D::getY(); }
+
+void setWidth(TYPE const& rWidth) { Tuple2D::setX(rWidth); }
+
+void setHeight(TYPE const& rHeight) { Tuple2D::setY(rHeight); }
+
+bool operator==(Size2D const& rSize) const { return 
Tuple2D::operator==(rSize); }
+
+bool operator!=(Size2D const& rSize) const { return 
Tuple2D::operator!=(rSize); }
+
+Size2D& operator-=(Size2D const& rSize)
+{
+Tuple2D::operator-=(rSize);
+return *this;
+}
+
+Size2D& operator+=(Size2D const& rSize)
+{
+Tuple2D::operator+=(rSize);
+return *this;
+}
+
+Size2D& operator/=(Size2D const& rSize)
+{
+Tuple2D::operator/=(rSize);
+return *this;
+}
+
+Size2D& operator*=(Size2D const& rSize)
+{
+Tuple2D::operator*=(rSize);
+return *this;
+}
+
+Size2D& operator*=(TYPE value)
+{
+Tuple2D::operator*=(value);
+return *this;
+}
+
+Size2D& operator/=(TYPE value)
+{
+Tuple2D::operator/=(value);
+return *this;
+}
+
+Size2D operator-(void) const { return Tuple2D::operator-(); }
+};
+
+template 
+inline Size2D operator-(const Size2D& rSizeA, const Size2D& 
rSizeB)
+{
+Size2D aNew(rSizeA);
+aNew -= rSizeB;
+return aNew;
+}
+
+template 
+inline Size2D operator+(const Size2D& rSizeA, const Size2D& 
rSizeB)
+{
+Size2D aNew(rSizeA);
+aNew += rSizeB;
+return aNew;
+}
+
+template 
+inline Size2D operator*(const Size2D& rSizeA, const Size2D& 
rSizeB)
+{
+Size2D aNew(rSizeA);
+aNew *= rSizeB;
+return aNew;
+}
+
+template 
+inline Size2D operator/(const Size2D& rSizeA, const Size2D& 
rSizeB)
+{
+Size2D aNew(rSizeA);
+aNew /= rSizeB;
+return aNew;
+}
+
+} // end of namespace gfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/Tuple2D.hxx 
b/include/basegfx/tuple/Tuple2D.hxx
index 8bc53fe9b88d..b4d1dbe2f508 100644
--- a/include/basegfx/tuple/Tuple2D.hxx
+++ b/include/basegfx/tuple/Tuple2D.hxx
@@ -147,6 +147,8 @@ public:
 return *this;
 }
 
+Tuple2D operator-(void) const { return Tuple2D(-mfX, -mfY); }
+
 bool operator==(const Tuple2D& rTup) const { return mfX == rTup.mfX 
&& mfY == rTup.mfY; }
 
 bool operator!=(const Tuple2D& rTup) const { return !(*this == 
rTup); }


[Libreoffice-commits] core.git: basegfx/source include/basegfx

2022-09-10 Thread Tomaž Vajngerl (via logerrit)
 basegfx/source/point/b2dpoint.cxx|7 -
 basegfx/source/vector/b2dvector.cxx  |7 -
 include/basegfx/point/b2dpoint.hxx   |9 +-
 include/basegfx/tuple/Tuple2D.hxx|   48 +--
 include/basegfx/tuple/b2dtuple.hxx   |   32 ++-
 include/basegfx/vector/b2dvector.hxx |   11 +---
 6 files changed, 59 insertions(+), 55 deletions(-)

New commits:
commit c2d3f4be406b3bef8e89b17b781cb7e827a0fe3d
Author: Tomaž Vajngerl 
AuthorDate: Tue Sep 6 19:37:20 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sat Sep 10 08:45:51 2022 +0200

basegfx: simplify Tuple2D, B2DPoint, B2DVector, B2DTuple

Change-Id: I97e41fc62288ec4ee5805747fd3a3a6e019cfb57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139681
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/basegfx/source/point/b2dpoint.cxx 
b/basegfx/source/point/b2dpoint.cxx
index 0dc18b513db1..02e6711ac44c 100644
--- a/basegfx/source/point/b2dpoint.cxx
+++ b/basegfx/source/point/b2dpoint.cxx
@@ -23,13 +23,6 @@
 
 namespace basegfx
 {
-B2DPoint& B2DPoint::operator=( const ::basegfx::B2DTuple& rPoint )
-{
-mfX = rPoint.getX();
-mfY = rPoint.getY();
-return *this;
-}
-
 B2DPoint& B2DPoint::operator*=( const ::basegfx::B2DHomMatrix& rMat )
 {
 double fTempX(
diff --git a/basegfx/source/vector/b2dvector.cxx 
b/basegfx/source/vector/b2dvector.cxx
index 1ad51a9b5a4c..d0fcebb62eac 100644
--- a/basegfx/source/vector/b2dvector.cxx
+++ b/basegfx/source/vector/b2dvector.cxx
@@ -51,13 +51,6 @@ namespace basegfx
 return *this;
 }
 
-B2DVector& B2DVector::operator=( const B2DTuple& rVec )
-{
-mfX = rVec.getX();
-mfY = rVec.getY();
-return *this;
-}
-
 double B2DVector::getLength() const
 {
 if(fTools::equalZero(mfX))
diff --git a/include/basegfx/point/b2dpoint.hxx 
b/include/basegfx/point/b2dpoint.hxx
index d2f77aa493a3..3bd6af90af9c 100644
--- a/include/basegfx/point/b2dpoint.hxx
+++ b/include/basegfx/point/b2dpoint.hxx
@@ -73,7 +73,7 @@ namespace basegfx
 /** constructor with tuple to allow copy-constructing
 from B2DTuple-based classes
 */
-B2DPoint(const ::basegfx::B2DTuple& rTuple)
+B2DPoint(Tuple2D const& rTuple)
 :   B2DTuple(rTuple)
 {}
 
@@ -98,7 +98,12 @@ namespace basegfx
 /** assignment operator to allow assigning the results
 of B2DTuple calculations
 */
-BASEGFX_DLLPUBLIC B2DPoint& operator=( const ::basegfx::B2DTuple& 
rPoint );
+BASEGFX_DLLPUBLIC B2DPoint& operator=(Tuple2D& rPoint)
+{
+mfX = rPoint.getX();
+mfY = rPoint.getY();
+return *this;
+}
 
 /** Transform point by given transformation matrix.
 
diff --git a/include/basegfx/tuple/Tuple2D.hxx 
b/include/basegfx/tuple/Tuple2D.hxx
index 44d546df6a30..8bc53fe9b88d 100644
--- a/include/basegfx/tuple/Tuple2D.hxx
+++ b/include/basegfx/tuple/Tuple2D.hxx
@@ -105,53 +105,85 @@ public:
 
 // operator overrides
 
-Tuple2D& operator+=(const Tuple2D& rTup)
+Tuple2D& operator+=(const Tuple2D& rTup)
 {
 mfX += rTup.mfX;
 mfY += rTup.mfY;
 return *this;
 }
 
-Tuple2D& operator-=(const Tuple2D& rTup)
+Tuple2D& operator-=(const Tuple2D& rTup)
 {
 mfX -= rTup.mfX;
 mfY -= rTup.mfY;
 return *this;
 }
 
-Tuple2D& operator/=(const Tuple2D& rTup)
+Tuple2D& operator/=(const Tuple2D& rTup)
 {
 mfX /= rTup.mfX;
 mfY /= rTup.mfY;
 return *this;
 }
 
-Tuple2D& operator*=(const Tuple2D& rTup)
+Tuple2D& operator*=(const Tuple2D& rTup)
 {
 mfX *= rTup.mfX;
 mfY *= rTup.mfY;
 return *this;
 }
 
-Tuple2D& operator*=(TYPE t)
+Tuple2D& operator*=(TYPE t)
 {
 mfX *= t;
 mfY *= t;
 return *this;
 }
 
-Tuple2D& operator/=(TYPE t)
+Tuple2D& operator/=(TYPE t)
 {
 mfX /= t;
 mfY /= t;
 return *this;
 }
 
-bool operator==(const Tuple2D& rTup) const { return mfX == rTup.mfX && mfY 
== rTup.mfY; }
+bool operator==(const Tuple2D& rTup) const { return mfX == rTup.mfX 
&& mfY == rTup.mfY; }
 
-bool operator!=(const Tuple2D& rTup) const { return !(*this == rTup); }
+bool operator!=(const Tuple2D& rTup) const { return !(*this == 
rTup); }
 };
 
+template 
+inline Tuple2D operator-(const Tuple2D& rTupA, const 
Tuple2D& rTupB)
+{
+Tuple2D aNew(rTupA);
+aNew -= rTupB;
+return aNew;
+}
+
+template 
+inline Tuple2D operator+(const Tuple2D& rTupA, const 
Tuple2D& rTupB)
+{
+Tuple2D aNew(rTupA);
+aNew += rTupB;
+return aNew;
+}
+
+template 
+inline Tuple2D operator*(const Tuple2D& rTupA, const 
Tuple2D& rTupB)
+{
+Tuple2D aNew(rTupA);
+aNew *= rTupB;
+return aNew;
+}
+
+template 

[Libreoffice-commits] core.git: svx/source

2022-09-06 Thread Tomaž Vajngerl (via logerrit)
 svx/source/svdraw/svdotext.cxx |  135 ++---
 1 file changed, 61 insertions(+), 74 deletions(-)

New commits:
commit b218e34b9b92e5359b1c272d52f12259133876c1
Author: Tomaž Vajngerl 
AuthorDate: Wed Aug 31 23:01:39 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Sep 6 21:35:25 2022 +0200

svx: set vars to initial values in constructor init for SdrTextObj

Change-Id: Id3fb342a4273b617ac2975bff3dd79159ab8df75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139531
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 2b5fa5023345..24223aaee738 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -69,46 +69,43 @@ std::unique_ptr 
SdrTextObj::CreateObjectSpecificViewC
 }
 
 SdrTextObj::SdrTextObj(SdrModel& rSdrModel)
-:   SdrAttrObj(rSdrModel),
-mpEditingOutliner(nullptr),
-meTextKind(SdrObjKind::Text)
+: SdrAttrObj(rSdrModel)
+, mpEditingOutliner(nullptr)
+, meTextKind(SdrObjKind::Text)
+, maTextEditOffset(Point(0, 0))
+, mbTextFrame(false)
+, mbNoShear(false)
+, mbTextSizeDirty(false)
+, mbInEditMode(false)
+, mbDisableAutoWidthOnDragging(false)
+, mbTextAnimationAllowed(true)
+, mbInDownScale(false)
 {
-mbTextSizeDirty = false;
-mbTextFrame = false;
-mbNoShear = false;
-mbDisableAutoWidthOnDragging = false;
-
-mbInEditMode = false;
-mbTextAnimationAllowed = true;
-maTextEditOffset = Point(0, 0);
-
 // #i25616#
 mbSupportTextIndentingOnLineWidthChange = true;
-mbInDownScale = false;
 }
 
 SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrTextObj const & rSource)
-:   SdrAttrObj(rSdrModel, rSource),
-mpEditingOutliner(nullptr)
+: SdrAttrObj(rSdrModel, rSource)
+, mpEditingOutliner(nullptr)
+, meTextKind(rSource.meTextKind)
+, maTextEditOffset(Point(0, 0))
+, mbTextFrame(rSource.mbTextFrame)
+, mbNoShear(rSource.mbNoShear)
+, mbTextSizeDirty(rSource.mbTextSizeDirty)
+, mbInEditMode(false)
+, mbDisableAutoWidthOnDragging(rSource.mbDisableAutoWidthOnDragging)
+, mbTextAnimationAllowed(true)
+, mbInDownScale(false)
 {
-mbInEditMode = false;
-mbTextAnimationAllowed = true;
-maTextEditOffset = Point(0, 0);
-
 // #i25616#
 mbSupportTextIndentingOnLineWidthChange = true;
-mbInDownScale = false;
 
 maRect = rSource.maRect;
 maGeo = rSource.maGeo;
-meTextKind = rSource.meTextKind;
-mbTextFrame = rSource.mbTextFrame;
 maTextSize = rSource.maTextSize;
-mbTextSizeDirty = rSource.mbTextSizeDirty;
 
 // Not all of the necessary parameters were copied yet.
-mbNoShear = rSource.mbNoShear;
-mbDisableAutoWidthOnDragging = rSource.mbDisableAutoWidthOnDragging;
 SdrText* pText = getActiveText();
 
 if( pText && rSource.HasText() )
@@ -136,70 +133,60 @@ SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrTextObj 
const & rSource)
 ImpSetTextStyleSheetListeners();
 }
 
-SdrTextObj::SdrTextObj(
-SdrModel& rSdrModel,
-const tools::Rectangle& rNewRect)
-:   SdrAttrObj(rSdrModel),
-maRect(rNewRect),
-mpEditingOutliner(nullptr),
-meTextKind(SdrObjKind::Text)
+SdrTextObj::SdrTextObj(SdrModel& rSdrModel, const tools::Rectangle& rNewRect)
+: SdrAttrObj(rSdrModel)
+, maRect(rNewRect)
+, mpEditingOutliner(nullptr)
+, meTextKind(SdrObjKind::Text)
+, maTextEditOffset(Point(0, 0))
+, mbTextFrame(false)
+, mbNoShear(false)
+, mbTextSizeDirty(false)
+, mbInEditMode(false)
+, mbDisableAutoWidthOnDragging(false)
+, mbTextAnimationAllowed(true)
+, mbInDownScale(false)
 {
-mbTextSizeDirty = false;
-mbTextFrame = false;
-mbNoShear = false;
-mbDisableAutoWidthOnDragging = false;
 ImpJustifyRect(maRect);
 
-mbInEditMode = false;
-mbTextAnimationAllowed = true;
-mbInDownScale = false;
-maTextEditOffset = Point(0, 0);
-
 // #i25616#
 mbSupportTextIndentingOnLineWidthChange = true;
 }
 
-SdrTextObj::SdrTextObj(
-SdrModel& rSdrModel,
-SdrObjKind eNewTextKind)
-:   SdrAttrObj(rSdrModel),
-mpEditingOutliner(nullptr),
-meTextKind(eNewTextKind)
+SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrObjKind eNewTextKind)
+: SdrAttrObj(rSdrModel)
+, mpEditingOutliner(nullptr)
+, meTextKind(eNewTextKind)
+, maTextEditOffset(Point(0, 0))
+, mbTextFrame(true)
+, mbNoShear(true)
+, mbTextSizeDirty(false)
+, mbInEditMode(false)
+, mbDisableAutoWidthOnDragging(false)
+, mbTextAnimationAllowed(true)
+, mbInDownScale(false)
 {
-mbTextSizeDirty = false;
-mbTextFrame = true;
-mbNoShear = true;
-mbDisableAutoWidthOnDragging = false;
-
-mbInEditMode = false;
-mbTextAnimationAllowed = true;
-mbInDownScale = false;
-maTextEditOffset = Point(0, 0);
-
 // #i25616#
 

[Libreoffice-commits] core.git: 2 commits - include/svx svx/source

2022-09-06 Thread Tomaž Vajngerl (via logerrit)
 include/svx/svdotext.hxx|   12 ++--
 svx/source/table/tablemodel.cxx |  105 ++--
 2 files changed, 55 insertions(+), 62 deletions(-)

New commits:
commit 7f8c7b96cc7f9752122a615524000665583ebb52
Author: Tomaž Vajngerl 
AuthorDate: Wed Aug 31 22:57:16 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Sep 6 21:35:05 2022 +0200

svx: fix description of SdrTextObj

bTextFrame is now mbTextFrame and the type is changed to bool,
so no more sal_True and sal_False.

Change-Id: I55572df1b717444bdcc9ae875856bc9f9bb2674f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139530
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 2df27cb77b5c..edb061ca0802 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -131,7 +131,7 @@ private:
 friend class TextChainFlow;
 friend class EditingTextChainFlow;
 
-// CustomShapeproperties need to access the "bTextFrame" member:
+// CustomShapeproperties need to access the "mbTextFrame" member:
 friend class sdr::properties::CustomShapeProperties;
 
 protected:
@@ -163,8 +163,8 @@ private:
 
 protected:
 // The "aRect" is also the rect of RectObj and CircObj.
-// When bTextFrame=sal_True the text will be formatted into this rect
-// When bTextFrame=sal_False the text will be centered around its middle
+// When mbTextFrame=true the text will be formatted into this rect
+// When mbTextFrame=false the text will be centered around its middle
 tools::Rectangle maRect;
 
 // The GeoStat contains the rotation and shear angles
@@ -185,7 +185,7 @@ protected:
 // SdrObjKind::Text regular text frame
 // SdrObjKind::TitleTextTitleText for presentations
 // SdrObjKind::OutlineText  OutlineText for presentations
-// eTextKind only has meaning when bTextFrame=sal_True, since otherwise
+// eTextKind only has meaning when mbTextFrame=true, since otherwise
 // we're dealing with a labeled graphical object
 SdrObjKind meTextKind;
 
@@ -211,9 +211,9 @@ protected:
 
 // For labeled graphical objects bTextFrame is FALSE. The block of text
 // will then be centered horizontally and vertically on aRect.
-// For bTextFalse=sal_True the text will be formatted into aRect.
+// For mbTextFrame=true the text will be formatted into aRect.
 // The actual text frame is realized by an SdrRectObj with
-// bTextFrame=sal_True.
+// mbTextFrame=true.
 bool mbTextFrame : 1;
 bool mbNoShear : 1; // disable shearing (->graphic+Ole+TextFrame)
 bool mbTextSizeDirty : 1;
commit e71b7c917eab6357350f86e05936d25d4192f42e
Author: Tomaž Vajngerl 
AuthorDate: Wed Aug 31 22:51:34 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Sep 6 21:34:54 2022 +0200

svx: remove "using namespace *" in tablemodel.cxx

UNO types are clearer when written from com::sun::star as root
namespace.

Change-Id: I9e063a904ecbdf471c9ca295a2f0c5bd727b9711
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139529
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx
index 86a5e76a5ec8..0e0cb45179c7 100644
--- a/svx/source/table/tablemodel.cxx
+++ b/svx/source/table/tablemodel.cxx
@@ -44,14 +44,7 @@
 #include 
 #include 
 
-using namespace ::osl;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::table;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::util;
-
+using namespace css;
 
 namespace sdr::table {
 
@@ -199,7 +192,7 @@ sal_Int32 TableModel::getBottom()
 }
 
 
-Reference< XTable > TableModel::getTable()
+uno::Reference TableModel::getTable()
 {
 return this;
 }
@@ -278,20 +271,20 @@ void TableModel::UndoRemoveColumns( sal_Int32 nIndex, 
ColumnVector& aCols, CellV
 // XTable
 
 
-Reference< XCellCursor > SAL_CALL TableModel::createCursor()
+uno::Reference SAL_CALL TableModel::createCursor()
 {
 ::SolarMutexGuard aGuard;
-return createCursorByRange( Reference< XCellRange >( this ) );
+return createCursorByRange( uno::Reference< XCellRange >( this ) );
 }
 
 
-Reference< XCellCursor > SAL_CALL TableModel::createCursorByRange( const 
Reference< XCellRange >& rRange )
+uno::Reference SAL_CALL 
TableModel::createCursorByRange( const uno::Reference< XCellRange >& rRange )
 {
 ::SolarMutexGuard aGuard;
 
 ICellRange* pRange = dynamic_cast< ICellRange* >( rRange.get() );
 if( (pRange == nullptr) || (pRange->getTable().get() != this) )
-throw IllegalArgumentException();
+throw lang::IllegalArgumentException();
 
 TableModelRef xModel( this );
 return new CellCursor( xModel, pRange->getLeft(), pRange->getTop(), 
pRange->getRight(), 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 3 commits - basctl/source basegfx/source basegfx/test chart2/source cui/source filter/source include/basegfx include/svx reportdesi

2022-09-06 Thread Tomaž Vajngerl (via logerrit)
 basctl/source/dlged/dlged.cxx  |   11 -
 basctl/source/dlged/dlgedobj.cxx   |6 
 basctl/source/dlged/dlgedview.cxx  |2 
 basegfx/source/point/b2dpoint.cxx  |7 
 basegfx/source/vector/b2dvector.cxx|7 
 basegfx/test/LengthUnitTest.cxx|   33 +++
 chart2/source/controller/drawinglayer/ViewElementListProvider.cxx  |2 
 chart2/source/controller/main/DrawCommandDispatch.cxx  |2 
 chart2/source/view/main/ChartView.cxx  |2 
 cui/source/tabpages/tpline.cxx |4 
 filter/source/msfilter/svdfppt.cxx |   18 -
 filter/source/svg/svgfilter.cxx|2 
 include/basegfx/point/b2dpoint.hxx |9 
 include/basegfx/tuple/Size2D.hxx   |  108 
++
 include/basegfx/tuple/Tuple2D.hxx  |   48 +++-
 include/basegfx/tuple/b2dtuple.hxx |   32 --
 include/basegfx/units/Length.hxx   |   26 ++
 include/basegfx/vector/b2dvector.hxx   |   11 -
 include/svx/svdpage.hxx|   36 ++-
 reportdesign/source/ui/report/ReportSection.cxx|   13 -
 reportdesign/source/ui/report/SectionView.cxx  |2 
 sc/source/core/data/drawpage.cxx   |4 
 sc/source/core/data/drwlayer.cxx   |4 
 sc/source/core/data/postit.cxx |2 
 sc/source/filter/rtf/eeimpars.cxx  |2 
 sc/source/ui/app/client.cxx|2 
 sc/source/ui/drawfunc/fuins1.cxx   |4 
 sc/source/ui/view/drawview.cxx |4 
 sc/source/ui/view/viewfun7.cxx |2 
 sd/inc/sdpage.hxx  |3 
 sd/source/core/CustomAnimationEffect.cxx   |4 
 sd/source/core/drawdoc.cxx |8 
 sd/source/core/drawdoc2.cxx|   28 +-
 sd/source/core/drawdoc3.cxx|   28 +-
 sd/source/core/sdpage.cxx  |   62 ++---
 sd/source/filter/grf/sdgrffilter.cxx   |2 
 sd/source/filter/html/htmlex.cxx   |7 
 sd/source/filter/pdf/sdpdffilter.cxx   |2 
 sd/source/ui/annotations/annotationmanager.cxx |2 
 sd/source/ui/app/sdmod2.cxx|2 
 sd/source/ui/app/sdxfer.cxx|4 
 sd/source/ui/dlg/copydlg.cxx   |2 
 sd/source/ui/dlg/headerfooterdlg.cxx   |2 
 sd/source/ui/docshell/docshel2.cxx |4 
 sd/source/ui/func/fuexpand.cxx |4 
 sd/source/ui/func/fuinsert.cxx |2 
 sd/source/ui/func/fuinsfil.cxx |2 
 sd/source/ui/func/fupage.cxx   |6 
 sd/source/ui/func/fusumry.cxx  |4 
 sd/source/ui/func/fuzoom.cxx   |2 
 sd/source/ui/func/undopage.cxx |4 
 sd/source/ui/presenter/SlideRenderer.cxx   |2 
 sd/source/ui/sidebar/DocumentHelper.cxx|5 
 sd/source/ui/sidebar/MasterPageContainer.cxx   |2 
 sd/source/ui/slideshow/slideshowviewimpl.cxx   |2 
 sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx|2 
 sd/source/ui/slidesorter/view/SlideSorterView.cxx  |2 
 sd/source/ui/table/tablefunction.cxx   |2 
 sd/source/ui/tools/PreviewRenderer.cxx |6 
 sd/source/ui/unoidl/unomodel.cxx   |   22 +-
 sd/source/ui/unoidl/unopage.cxx|   32 +-
 sd/source/ui/view/DocumentRenderer.cxx |   12 -
 sd/source/ui/view/drviews2.cxx |2 
 sd/source/ui/view/drviews3.cxx |4 
 sd/source/ui/view/drviews5.cxx |2 
 

[Libreoffice-commits] core.git: Branch 'private/tvajngerl/staging' - 432 commits - accessibility/source avmedia/Library_avmediagst.mk avmedia/source basctl/source basegfx/CppunitTest_basegfx.mk basegf

2022-08-31 Thread Tomaž Vajngerl (via logerrit)
Rebased ref, commits from common ancestor:
commit d2818f4da2267a6b7823fda314ac7484a90dc24b
Author: Tomaž Vajngerl 
AuthorDate: Thu Nov 12 10:01:20 2020 +0100
Commit: Tomaž Vajngerl 
CommitDate: Wed Aug 31 23:09:11 2022 +0200

basegfx: added Length class as the base unit for length

Change-Id: I1d4790b60dd784e8b2e2e438274f3ebd6db4b60c

diff --git a/basegfx/CppunitTest_basegfx.mk b/basegfx/CppunitTest_basegfx.mk
index 88f4966262f2..98d3a5d41926 100644
--- a/basegfx/CppunitTest_basegfx.mk
+++ b/basegfx/CppunitTest_basegfx.mk
@@ -45,6 +45,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,basegfx,\
 basegfx/test/clipstate \
 basegfx/test/genericclipper \
 basegfx/test/VectorTest \
+basegfx/test/LengthUnitTest \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/basegfx/test/LengthUnitTest.cxx b/basegfx/test/LengthUnitTest.cxx
new file mode 100644
index ..421e98934c90
--- /dev/null
+++ b/basegfx/test/LengthUnitTest.cxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include 
+
+#include 
+#include 
+
+class LengthTest : public CppUnit::TestFixture
+{
+public:
+void testBasic()
+{
+gfx::Length cm = 1_cm + 5_cm - 2_cm;
+CPPUNIT_ASSERT_DOUBLES_EQUAL(4.0, cm.as_cm(), 1e-4);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(0.04, cm.as_m(), 1e-4);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(40.0, cm.as_mm(), 1e-4);
+CPPUNIT_ASSERT_EQUAL(sal_Int64(144), cm.raw());
+
+gfx::Length cm2 = 5_cm * 2;
+CPPUNIT_ASSERT_EQUAL(sal_Int64(360), cm2.raw());
+CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, cm2.as_cm(), 1e-4);
+
+// 1 km - 50 m = 950 m = 95000 cm
+gfx::Length cm3 = 10_cm - 5000_cm;
+CPPUNIT_ASSERT_EQUAL(sal_Int64(342), cm3.raw());
+CPPUNIT_ASSERT_DOUBLES_EQUAL(95000.0, cm3.as_cm(), 1e-4);
+
+gfx::Length cm4(1_cm);
+cm4 /= 2;
+CPPUNIT_ASSERT_EQUAL(sal_Int64(18), cm4.raw());
+CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5, cm4.as_cm(), 1e-4);
+
+// (635 * 20) + 3 * (635 * 15) = 41275EMU
+gfx::Length pt = 1_pt + 3_px;
+CPPUNIT_ASSERT_DOUBLES_EQUAL(3.25, pt.as_pt(), 1e-4);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(65.0, pt.as_twip(), 1e-4);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0451, pt.as_in(), 1e-4);
+CPPUNIT_ASSERT_EQUAL(sal_Int64(41275), pt.raw());
+
+gfx::Length inch = 1_in; // 1440 * 635
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1440.0, inch.as_twip(), 1e-4);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(96.0, inch.as_px(), 1e-4);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, inch.as_in(), 1e-4);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(914400.0, inch.as_emu(), 1e-4);
+CPPUNIT_ASSERT_EQUAL(sal_Int64(914400), inch.raw());
+
+// Conversion
+sal_Int64 asNumber(17_pt);
+asNumber += sal_Int64(1_pt);
+gfx::Length asLength = gfx::Length::emu(asNumber);
+CPPUNIT_ASSERT_EQUAL(sal_Int64(18 * 635 * 20), asLength.raw());
+
+gfx::Length maximum = gfx::Length::emu(SAL_MAX_INT64);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(256204778801.5, maximum.as_m(), 1e-1);
+// 256204778 km
+CPPUNIT_ASSERT_EQUAL(sal_Int64(SAL_MAX_INT64), maximum.raw());
+
+gfx::Length minimum = gfx::Length::emu(SAL_MIN_INT64);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(-256204778801.5, minimum.as_m(), 1e-1);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(double(SAL_MIN_INT64), minimum.as_emu(), 
1e-1);
+CPPUNIT_ASSERT_EQUAL(sal_Int64(SAL_MIN_INT64), minimum.raw());
+
+// 27 emu + 33 emu + 360 emu = 420
+gfx::Length emus = 27_emu + 33_emu + 1_hmm;
+CPPUNIT_ASSERT_EQUAL(sal_Int64(420), emus.raw());
+
+//  Creation from number
+int number = 10;
+auto asCm = gfx::Length::cm(number);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, asCm.as_cm(), 1e-4);
+CPPUNIT_ASSERT_EQUAL(sal_Int64(360), asCm.raw());
+
+auto asMm = gfx::Length::mm(number);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, asMm.as_mm(), 1e-4);
+CPPUNIT_ASSERT_EQUAL(sal_Int64(36), asMm.raw());
+
+auto asInch = gfx::Length::in(number);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, asInch.as_in(), 1e-4);
+CPPUNIT_ASSERT_EQUAL(sal_Int64(9144000), asInch.raw());
+
+auto aa = gfx::Length::hmm(10.1);
+CPPUNIT_ASSERT_EQUAL(sal_Int64(3600), aa.raw());
+
+auto bb = gfx::Length::hmm(10.1);
+CPPUNIT_ASSERT_EQUAL(sal_Int64(3636), bb.raw());
+}
+
+void testInRange()
+{
+gfx::Range2DL aRange(1_cm, 2_cm, 2_cm, 30_mm);
+CPPUNIT_ASSERT_EQUAL(1_cm, aRange.getMinX());
+CPPUNIT_ASSERT_EQUAL(2_cm, aRange.getMaxX());
+  

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - chart2/source

2022-08-30 Thread Tomaž Vajngerl (via logerrit)
 chart2/source/view/charttypes/VSeriesPlotter.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 41cfd75f7b693a3a5b663c65b969e8299229aaea
Author: Tomaž Vajngerl 
AuthorDate: Mon Aug 29 11:23:00 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Tue Aug 30 11:12:42 2022 +0200

chart2: fix backporting issue - not adding symbols into the vector

Change-Id: I8439ec7b54a7aa3860c2e16f32c777cce1f96a6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138966
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 3dafa94fd99d..5206635b574d 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2928,6 +2928,7 @@ std::vector 
VSeriesPlotter::createSymbolsForSeries(
 if (xShape.is())
 {
 aEntry.aSymbol.set(xSymbolGroup, uno::UNO_QUERY);
+aResult.push_back(aEntry);
 }
 }
 catch (const uno::Exception &)


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - chart2/qa chart2/source

2022-08-26 Thread Tomaž Vajngerl (via logerrit)
 chart2/qa/extras/chart2import2.cxx 
 |   16 ++
 
chart2/qa/extras/data/xlsx/DataTable-MultipleLegendEntriesForOneDataSeries.xlsx 
|binary
 chart2/source/view/charttypes/VSeriesPlotter.cxx   
 |   79 --
 chart2/source/view/main/DataTableView.cxx  
 |   30 ++-
 4 files changed, 38 insertions(+), 87 deletions(-)

New commits:
commit ae60b32042f0702c98d4d34a36d8f6192deb
Author: Tomaž Vajngerl 
AuthorDate: Mon Aug 22 16:46:41 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 26 12:33:52 2022 +0200

chart2: always use the series for the keys (symbols) in data table

In special case the legend keys are not series, but can be each
value of a series. This can't be done for the data table where so
this has been disabled.

This caused a crash when positioning the symbols, as in some cases
we got 0 symbols (due to another bug that didn't put the symbols
into the collection) or more symbols that there were series (and
the symbols couldn't be positioned correctly). With this change
we now get the correct number of symbols for the data table.

Also added the test document and test to open the document, to
make sure we don't crash anymore.

Change-Id: Idbebdd5295595a823b5420958e803b13258df035
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138697
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit e5583150a3953f08782865e0f90d41f5c35cc6c5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138806
Tested-by: Jenkins CollaboraOffice 

diff --git a/chart2/qa/extras/chart2import2.cxx 
b/chart2/qa/extras/chart2import2.cxx
index 95ee2428b47d..596531990e36 100644
--- a/chart2/qa/extras/chart2import2.cxx
+++ b/chart2/qa/extras/chart2import2.cxx
@@ -76,6 +76,7 @@ public:
 void testTdf121281();
 void testTdf139658();
 void testTdf146066();
+void testChartDataTableWithMultipleLegendEntriesForOneDataSeries();
 
 CPPUNIT_TEST_SUITE(Chart2ImportTest2);
 
@@ -116,6 +117,7 @@ public:
 CPPUNIT_TEST(testTdf121281);
 CPPUNIT_TEST(testTdf139658);
 CPPUNIT_TEST(testTdf146066);
+CPPUNIT_TEST(testChartDataTableWithMultipleLegendEntriesForOneDataSeries);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -922,6 +924,20 @@ void Chart2ImportTest2::testTdf146066()
 CPPUNIT_ASSERT_EQUAL(OUString("35"), xLabel7->getString());
 }
 
+void 
Chart2ImportTest2::testChartDataTableWithMultipleLegendEntriesForOneDataSeries()
+{
+load(u"/chart2/qa/extras/data/xlsx/", 
u"DataTable-MultipleLegendEntriesForOneDataSeries.xlsx");
+// Loading this file caused a crash in the data table code
+
+Reference xChartDoc(getChartDocFromSheet(0, 
mxComponent),
+   UNO_QUERY_THROW);
+Reference xDrawPageSupplier(xChartDoc, 
UNO_QUERY_THROW);
+Reference xDrawPage(xDrawPageSupplier->getDrawPage(), 
UNO_SET_THROW);
+Reference xShapes(xDrawPage->getByIndex(0), 
UNO_QUERY_THROW);
+Reference xDataTableShape = getShapeByName(xShapes, 
"CID/D=0:DataTable=");
+CPPUNIT_ASSERT(xDataTableShape.is());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git 
a/chart2/qa/extras/data/xlsx/DataTable-MultipleLegendEntriesForOneDataSeries.xlsx
 
b/chart2/qa/extras/data/xlsx/DataTable-MultipleLegendEntriesForOneDataSeries.xlsx
new file mode 100644
index ..b077fd2e0315
Binary files /dev/null and 
b/chart2/qa/extras/data/xlsx/DataTable-MultipleLegendEntriesForOneDataSeries.xlsx
 differ
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 0cd15188e84f..3dafa94fd99d 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2538,11 +2538,6 @@ std::vector 
VSeriesPlotter::createSymbols(const awt::Size& rEn
 if (!pSeries)
 continue;
 
-if 
(!pSeries->getPropertiesOfSeries()->getPropertyValue("ShowLegendEntry").get())
-{
-continue;
-}
-
 std::vector aSeriesSymbols = 
createSymbolsForSeries(rEntryKeyAspectRatio, *pSeries, xTarget, xShapeFactory, 
xContext);
 
 //add series entries to the result now
@@ -2924,77 +2919,15 @@ std::vector 
VSeriesPlotter::createSymbolsForSeries(
 try
 {
 ViewLegendSymbol aEntry;
-bool bVaryColorsByPoint = rSeries.isVaryColorsByPoint();
-bool bIsPie = 
m_xChartTypeModel->getChartType().equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE);
-try
-{
-if (bIsPie)
-{
-bool bDonut = false;
-if ((m_xChartTypeModelProps->getPropertyValue("UseRings") >>= 
bDonut) && bDonut)
- 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - chart2/source

2022-08-25 Thread Tomaž Vajngerl (via logerrit)
 chart2/source/view/main/DataTableView.cxx |   47 ++
 1 file changed, 35 insertions(+), 12 deletions(-)

New commits:
commit c0157b2df2005e76ed55369033758964a0f154e2
Author: Tomaž Vajngerl 
AuthorDate: Thu Aug 18 00:09:25 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Aug 25 13:09:54 2022 +0200

chart2: improve keys (symbols) rendering in a data table

- better symbol positioning taking symbol height and cell height
  into account.
- symbol height depends on font size (as with the legend)
- take symbol aspect ratio into account
- remove hardcoded values

Change-Id: I3537d82538035cd31b928d4bb6fc5572914fcd13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138463
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 9923f2416b63abc09bf8cd83796d1d681e9de225)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138795
Tested-by: Jenkins CollaboraOffice 

diff --git a/chart2/source/view/main/DataTableView.cxx 
b/chart2/source/view/main/DataTableView.cxx
index 080b04cf919f..636690cb4e48 100644
--- a/chart2/source/view/main/DataTableView.cxx
+++ b/chart2/source/view/main/DataTableView.cxx
@@ -340,21 +340,40 @@ void DataTableView::createShapes(basegfx::B2DVector 
const& rStart, basegfx::B2DV
 // ROW HEADER
 // Prepare keys (symbols)
 sal_Int32 nMaxSymbolWidth = 0;
+constexpr const sal_Int32 constSymbolMargin = 100; // 1mm
 if (bKeys)
 {
 uno::Reference xFactory(m_xChartModel, 
uno::UNO_QUERY);
+
+uno::Reference 
xDataTableProperties(m_xDataTableModel);
+float fFontHeight = 0.0;
+xDataTableProperties->getPropertyValue("CharHeight") >>= fFontHeight;
+fFontHeight = o3tl::convert(fFontHeight, o3tl::Length::pt, 
o3tl::Length::mm100);
+
+sal_Int32 nSymbolHeight = sal_Int32(fFontHeight * 0.6);
+sal_Int32 nSymbolWidth = nSymbolHeight;
+
 for (VSeriesPlotter* pSeriesPlotter : m_pSeriesPlotterList)
 {
 if (pSeriesPlotter)
 {
-sal_Int32 nSymbolWidth = 300;
-if (pSeriesPlotter->getLegendSymbolStyle() == 
LegendSymbolStyle::Line)
-nSymbolWidth = 600;
-
-nMaxSymbolWidth = std::max(nSymbolWidth, nMaxSymbolWidth);
+awt::Size aCurrentRatio = 
pSeriesPlotter->getPreferredLegendKeyAspectRatio();
+sal_Int32 nCurrentWidth = aCurrentRatio.Width;
+if (aCurrentRatio.Height > 0)
+nCurrentWidth = nSymbolHeight * aCurrentRatio.Width / 
aCurrentRatio.Height;
+nSymbolWidth = std::max(nSymbolWidth, nCurrentWidth);
+}
+}
+nMaxSymbolWidth = nSymbolWidth;
 
+for (VSeriesPlotter* pSeriesPlotter : m_pSeriesPlotterList)
+{
+if (pSeriesPlotter)
+{
+awt::Size aSize(nSymbolWidth, nSymbolHeight);
 std::vector aNewEntries = 
pSeriesPlotter->createSymbols(
-{ nSymbolWidth, 300 }, m_xTarget, xFactory, 
m_xComponentContext);
+aSize, m_xTarget, xFactory, m_xComponentContext);
+
 aSymbols.insert(aSymbols.end(), aNewEntries.begin(), 
aNewEntries.end());
 }
 }
@@ -384,8 +403,8 @@ void DataTableView::createShapes(basegfx::B2DVector const& 
rStart, basegfx::B2DV

uno::makeAny(style::ParagraphAdjust_LEFT));
 if (bKeys)
 {
-xCellPropertySet->setPropertyValue("ParaLeftMargin",
-   
uno::makeAny(nMaxSymbolWidth + sal_Int32(200)));
+xCellPropertySet->setPropertyValue(
+"ParaLeftMargin", uno::makeAny(nMaxSymbolWidth + 
sal_Int32(2 * constSymbolMargin)));
 }
 }
 nRow++;
@@ -436,8 +455,8 @@ void DataTableView::createShapes(basegfx::B2DVector const& 
rStart, basegfx::B2DV
 
 xBroadcaster->unlockBroadcasts();
 
-pTableObject->DistributeColumns(0, nColumnCount - 1, true, true);
-pTableObject->DistributeRows(0, nRowCount - 1, true, true);
+pTableObject->DistributeColumns(0, nColumnCount, true, true);
+pTableObject->DistributeRows(0, nRowCount, true, true);
 
 xBroadcaster->lockBroadcasts();
 
@@ -467,8 +486,12 @@ void DataTableView::createShapes(basegfx::B2DVector const& 
rStart, basegfx::B2DV
 xPropertySet->getPropertyValue("Height") >>= nHeight;
 if (i > 0)
 {
-aSymbols[nSymbolIndex].aSymbol->setPosition(
-{ nTableX + 100, nTableY + nTotalHeight + 100 });
+auto& rSymbol = aSymbols[nSymbolIndex].aSymbol;
+sal_Int32 nSymbolHeight = rSymbol->getSize().Height;
+sal_Int32 nSymbolY
+= basegfx::fround(double(nHeight) / 2.0 - 
double(nSymbolHeight) / 2.0);
+

<    2   3   4   5   6   7   8   9   10   11   >