[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - include/svx svx/source

2022-01-04 Thread Armin Le Grand (Allotropia) (via logerrit)
 include/svx/framelinkarray.hxx   |3 
 svx/source/dialog/framelinkarray.cxx |  290 ---
 2 files changed, 235 insertions(+), 58 deletions(-)

New commits:
commit 446ade2ac0023a322cd464911c62df440b6663af
Author: Armin Le Grand (Allotropia) 
AuthorDate: Wed Dec 29 18:01:05 2021 +0100
Commit: Thorsten Behrens 
CommitDate: Tue Jan 4 14:46:18 2022 +0100

tdf#126269 Add clipping to diagonal border lines

See task for in-deep discussion. Needed to do some
re-arrangements to add clipping to diagonal border
lines. It is necessary to only clip visible geometry
but not touch vectors that get added to be able to
solve all that dynamic border line style start/end
overlapping.

Change-Id: I656a5cd63a011140ee1281873e44ab5e60606b67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127713
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127757
Reviewed-by: Thorsten Behrens 

diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx
index 7cdfd90d794b..47faf2acc311 100644
--- a/include/svx/framelinkarray.hxx
+++ b/include/svx/framelinkarray.hxx
@@ -293,6 +293,9 @@ public:
 Returns total output range of merged ranges, if bExpandMerged is true. 
*/
 basegfx::B2DRange GetCellRange( size_t nCol, size_t nRow, bool 
bExpandMerged ) const;
 
+// return output range of given row/col range in logical coordinates
+basegfx::B2DRange GetB2DRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, 
sal_Int32 nLastCol, sal_Int32 nLastRow ) const;
+
 // mirroring
 
 /** Mirrors the entire array horizontally. */
diff --git a/svx/source/dialog/framelinkarray.cxx 
b/svx/source/dialog/framelinkarray.cxx
index 7419b1bb27fe..16f6c09e8d91 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -28,6 +28,13 @@
 #include 
 #include 
 #include 
+#include 
+
+//#define OPTICAL_CHECK_CLIPRANGE_FOR_MERGED_CELL
+#ifdef OPTICAL_CHECK_CLIPRANGE_FOR_MERGED_CELL
+#include 
+#include 
+#endif
 
 namespace svx::frame {
 
@@ -43,6 +50,9 @@ private:
 Style   maTLBR;
 Style   maBLTR;
 
+basegfx::B2DHomMatrix HelperCreateB2DHomMatrixFromB2DRange(
+const basegfx::B2DRange& rRange ) const;
+
 public:
 tools::LongmnAddLeft;
 tools::LongmnAddRight;
@@ -78,55 +88,90 @@ public:
 
 voidMirrorSelfX();
 
-basegfx::B2DHomMatrix CreateCoordinateSystem(const Array& rArray, size_t 
nCol, size_t nRow, bool bExpandMerged) const;
+basegfx::B2DHomMatrix CreateCoordinateSystemSingleCell(
+const Array& rArray, size_t nCol, size_t nRow ) const;
+basegfx::B2DHomMatrix CreateCoordinateSystemMergedCell(
+const Array& rArray, size_t nColLeft, size_t nRowTop, size_t 
nColRight, size_t nRowBottom ) const;
 };
 
 }
 
 typedef std::vector< Cell > CellVec;
 
-basegfx::B2DHomMatrix Cell::CreateCoordinateSystem(const Array& rArray, size_t 
nCol, size_t nRow, bool bExpandMerged) const
+basegfx::B2DHomMatrix Cell::HelperCreateB2DHomMatrixFromB2DRange(
+const basegfx::B2DRange& rRange ) const
 {
-basegfx::B2DHomMatrix aRetval;
-const basegfx::B2DRange aRange(rArray.GetCellRange(nCol, nRow, 
bExpandMerged));
+if( rRange.isEmpty() )
+return basegfx::B2DHomMatrix();
+
+basegfx::B2DPoint aOrigin(rRange.getMinimum());
+basegfx::B2DVector aX(rRange.getWidth(), 0.0);
+basegfx::B2DVector aY(0.0, rRange.getHeight());
 
-if(!aRange.isEmpty())
+if (IsRotated() && SvxRotateMode::SVX_ROTATE_MODE_STANDARD != meRotMode )
 {
-basegfx::B2DPoint aOrigin(aRange.getMinimum());
-basegfx::B2DVector aX(aRange.getWidth(), 0.0);
-basegfx::B2DVector aY(0.0, aRange.getHeight());
+// when rotated, adapt values. Get Skew (cos/sin == 1/tan)
+const double fSkew(aY.getY() * (cos(mfOrientation) / 
sin(mfOrientation)));
 
-if (IsRotated() && SvxRotateMode::SVX_ROTATE_MODE_STANDARD != 
meRotMode)
+switch (meRotMode)
 {
-// when rotated, adapt values. Get Skew (cos/sin == 1/tan)
-const double fSkew(aY.getY() * (cos(mfOrientation) / 
sin(mfOrientation)));
-
-switch (meRotMode)
-{
-case SvxRotateMode::SVX_ROTATE_MODE_TOP:
-// shear Y-Axis
-aY.setX(-fSkew);
-break;
-case SvxRotateMode::SVX_ROTATE_MODE_CENTER:
-// shear origin half, Y full
-aOrigin.setX(aOrigin.getX() + (fSkew * 0.5));
-aY.setX(-fSkew);
-break;
-case SvxRotateMode::SVX_ROTATE_MODE_BOTTOM:
-// shear origin full, Y full
-aOrigin.setX(aOrigin.getX() + fSkew);
-aY.setX(-fSkew);
-break;
-default: // 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - include/svx svx/source

2021-12-10 Thread Noel Grandin (via logerrit)
 include/svx/sdr/contact/viewcontact.hxx |5 +
 svx/source/sdr/contact/viewcontact.cxx  |   14 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 585bf5f2b223a1449dd8f6b65c5f0c0c00160af7
Author: Noel Grandin 
AuthorDate: Wed Dec 8 11:14:47 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri Dec 10 12:09:03 2021 +0100

tdf#146108 Calc slow to change cell focus..

in a document with a big background image

Revert "tdf#136058: remove some caching"
This reverts commit 57c40329a2b469813a1f357de355a37c8e3077ae.

And add some comments for future would-be optimisers.

Change-Id: Ie8686edc38dcdbe7d9e78599c1a259aab68278a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126527
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126574

diff --git a/include/svx/sdr/contact/viewcontact.hxx 
b/include/svx/sdr/contact/viewcontact.hxx
index c7119fcd93e2..eee3ea6f11cb 100644
--- a/include/svx/sdr/contact/viewcontact.hxx
+++ b/include/svx/sdr/contact/viewcontact.hxx
@@ -46,6 +46,11 @@ private:
 // Registering and de-registering is done in the VOC 
constructors/destructors.
 std::vector maViewObjectContactVector;
 
+// Primitive2DContainer of the ViewContact. This contains all necessary 
information
+// for the graphical visualisation and needs to be supported by all VCs 
which
+// can be visualized.
+drawinglayer::primitive2d::Primitive2DContainer 
mxViewIndependentPrimitive2DSequence;
+
 // A new ViewObjectContact was created and shall be remembered.
 void AddViewObjectContact(ViewObjectContact& rVOContact);
 
diff --git a/svx/source/sdr/contact/viewcontact.cxx 
b/svx/source/sdr/contact/viewcontact.cxx
index 4a2914af0e2b..2644632a9a27 100644
--- a/svx/source/sdr/contact/viewcontact.cxx
+++ b/svx/source/sdr/contact/viewcontact.cxx
@@ -101,7 +101,9 @@ void 
ViewContact::RemoveViewObjectContact(ViewObjectContact& rVOContact)
 maViewObjectContactVector.begin(), maViewObjectContactVector.end(), 
);
 
 if (aFindResult != maViewObjectContactVector.end())
+{
 maViewObjectContactVector.erase(aFindResult);
+}
 }
 
 // Test if this ViewContact has ViewObjectContacts at all. This can
@@ -226,6 +228,9 @@ ViewContact::createViewIndependentPrimitive2DSequence() 
const
 drawinglayer::primitive2d::Primitive2DContainer
 ViewContact::getViewIndependentPrimitive2DContainer() const
 {
+/* Local up-to-date checks. Create new list and compare.
+We cannot just always use the new data because the old data has cached 
bitmaps in it e.g. see the document in tdf#146108.
+*/
 drawinglayer::primitive2d::Primitive2DContainer xNew(
 createViewIndependentPrimitive2DSequence());
 
@@ -235,7 +240,14 @@ ViewContact::getViewIndependentPrimitive2DContainer() const
 xNew = embedToObjectSpecificInformation(std::move(xNew));
 }
 
-return xNew;
+if (mxViewIndependentPrimitive2DSequence != xNew)
+{
+// has changed, copy content
+const_cast(this)->mxViewIndependentPrimitive2DSequence = 
std::move(xNew);
+}
+
+// return current Primitive2DContainer
+return mxViewIndependentPrimitive2DSequence;
 }
 
 // add Gluepoints (if available)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - include/svx svx/source sw/qa sw/source

2021-12-03 Thread László Németh (via logerrit)
 include/svx/sidebar/InspectorTextPanel.hxx|2 
 svx/source/sidebar/inspector/InspectorTextPanel.cxx   |   13 +-
 sw/qa/uitest/styleInspector/styleInspector.py |   43 +++---
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |  111 +++---
 sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx |1 
 5 files changed, 132 insertions(+), 38 deletions(-)

New commits:
commit e58635129487d2fc0ab1cc9e2a9e3e302bcb9538
Author: László Németh 
AuthorDate: Mon Nov 29 15:58:14 2021 +0100
Commit: László Németh 
CommitDate: Fri Dec 3 17:23:20 2021 +0100

tdf#30709 sw Style Inspector: show section and parent metadata

Show text:section RDF metadata under the node "Sections"
in the Style Inspector. Also show parent metadata of nested
annotated text ranges (and sections) at the cursor
position, not only metadata of the innermost.

Show metadata fields (text:meta-field) and annotated text
ranges (text:meta) under the new category "Fields" instead
of at "Character Direct Formatting".

Put section and other metadata in front of the other style
settings text. Hide their empty categories "Sections",
"Bookmarks" and "Fields", if there is no associated RDF
metadata.

Follow-up of commit db7ef0a9ed21b0271345249b97a7a10d60d259e6
"tdf#30709 sw Style Inspector: show bookmark data".

Change-Id: Ibfd2c5dfb1597afaa8038b497977505914bed76d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126065
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 47e65fc0baf8f671733fbf9b5ce8d735328cfb44)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126098

diff --git a/include/svx/sidebar/InspectorTextPanel.hxx 
b/include/svx/sidebar/InspectorTextPanel.hxx
index ce4eecf8ad64..f6ef0234ade1 100644
--- a/include/svx/sidebar/InspectorTextPanel.hxx
+++ b/include/svx/sidebar/InspectorTextPanel.hxx
@@ -50,7 +50,7 @@ public:
 
 InspectorTextPanel(weld::Widget* pParent);
 
-void updateEntries(const std::vector& rStore);
+void updateEntries(const std::vector& rStore, const sal_Int32 
nParIdx);
 
 private:
 std::unique_ptr mpListBoxStyles;
diff --git a/svx/source/sidebar/inspector/InspectorTextPanel.cxx 
b/svx/source/sidebar/inspector/InspectorTextPanel.cxx
index bdd87eef538d..69ed0f071015 100644
--- a/svx/source/sidebar/inspector/InspectorTextPanel.cxx
+++ b/svx/source/sidebar/inspector/InspectorTextPanel.cxx
@@ -132,7 +132,7 @@ static void FillBox_Impl(weld::TreeView& rListBoxStyles, 
const TreeNode& rCurren
 FillBox_Impl(rListBoxStyles, rChildNode, pResult.get());
 }
 
-void InspectorTextPanel::updateEntries(const std::vector& rStore)
+void InspectorTextPanel::updateEntries(const std::vector& rStore, 
const sal_Int32 nParIdx)
 {
 mpListBoxStyles->freeze();
 mpListBoxStyles->clear();
@@ -149,12 +149,21 @@ void InspectorTextPanel::updateEntries(const 
std::vector& rStore)
 return false;
 });
 
+// Collapse "Default Paragraph Style"
+
 std::unique_ptr pEntry = mpListBoxStyles->make_iterator();
 if (!mpListBoxStyles->get_iter_first(*pEntry))
 return;
+// skip the optional metadata items before "Default Paragraph Style"
+for (sal_Int32 i = 0; i < nParIdx; ++i)
+{
+if (!mpListBoxStyles->iter_next_sibling(*pEntry))
+return;
+}
 if (!mpListBoxStyles->iter_next(*pEntry))
 return;
-mpListBoxStyles->collapse_row(*pEntry); // Collapse "Default Paragraph 
Style"
+
+mpListBoxStyles->collapse_row(*pEntry);
 }
 
 InspectorTextPanel::~InspectorTextPanel() {}
diff --git a/sw/qa/uitest/styleInspector/styleInspector.py 
b/sw/qa/uitest/styleInspector/styleInspector.py
index f95ca9b0cfae..7cfabce07dcc 100644
--- a/sw/qa/uitest/styleInspector/styleInspector.py
+++ b/sw/qa/uitest/styleInspector/styleInspector.py
@@ -171,10 +171,10 @@ class styleNavigator(UITestCase):
 self.xUITest.executeCommand(".uno:GoRight")
 
 # The cursor is on text with annotated text range
-xDirFormatting = xListBox.getChild('3')
-self.assertEqual(2, len(xDirFormatting.getChildren()))
+xDirFormatting = xListBox.getChild('0')
+self.assertEqual("Fields\t", 
get_state_as_dict(xListBox.getChild('0'))['Text'])
+self.assertEqual(1, len(xDirFormatting.getChildren()))
 self.assertEqual("Metadata Reference\t", 
get_state_as_dict(xDirFormatting.getChild('0'))['Text'])
-self.assertEqual("Nested Text Content\tAnnotated text range", 
get_state_as_dict(xDirFormatting.getChild('1'))['Text'])
 
 xMetadata = xDirFormatting.getChild('0')
 self.assertEqual(4, len(xMetadata.getChildren()))
@@ -183,8 +183,12 @@ class styleNavigator(UITestCase):
 
self.assertEqual("http://www.w3.org/2000/01/rdf-schema#comment\tComment...;, 
get_state_as_dict(xMetadata.getChild('2'))['Text'])
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - include/svx svx/source

2021-12-03 Thread Michael Stahl (via logerrit)
 include/svx/svdundo.hxx   |   19 
 svx/source/svdraw/svdpage.cxx |   12 --
 svx/source/svdraw/svdundo.cxx |   48 ++
 3 files changed, 68 insertions(+), 11 deletions(-)

New commits:
commit 5a57ef3293bb2581a83487d1fd5534ed3b414217
Author: Michael Stahl 
AuthorDate: Tue Nov 30 20:27:24 2021 +0100
Commit: Michael Stahl 
CommitDate: Fri Dec 3 16:57:29 2021 +0100

tdf#145928 svx: fix undo of sorting shapes

The problem is that in sw there are these obnoxious virtual SdrObjects
that are created and destroyed by the layout.

0  SdrObject::~SdrObject()
3  SwVirtFlyDrawObj::~SwVirtFlyDrawObj()
5  SwFlyFrame::FinitDrawObj()
12 SwFrame::DestroyFrame(SwFrame*)
13 SwFrameFormat::DelFrames()
14 SwUndoFlyBase::DelFly(SwDoc*)
15 SwUndoDelLayFormat::SwUndoDelLayFormat(SwFrameFormat*)
16 SwHistoryTextFlyCnt::SwHistoryTextFlyCnt(SwFrameFormat*)

This misdesign means that SdrUndoObj::pObj may point to a deleted
object.

Commit 9bc6160e0acbc78be998129ea55ed7e4529959fa may create SdrUnoObj
when saving the document, so that is now an additional way to introduce
the problem.

Try to work around it by not using a SdrUndoObj subclass in this case,
but create a new SdrUndoAction subclass that uses SdrPage::sort() and
stores no pointers.

There is still the problem that changes in the layout or view settings
like "Hide tracked changes" could cause different virtual SdrObjects to
exist between when the Undo was recorded and when it is activated, in
which case nothing is done.

But that really requires a larger refactoring such as having a SdrPage
for the model that never contains virtual SdrObjects, and another
SdrPage for the view that does contain virtual SdrObjects to fix.

Change-Id: I4cf5d4eb8bb24a51730c55ff34a043b8a88fdb52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126153
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 25a368c30acb54e0819d2b2b890a3fd1530d8a76)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126136

diff --git a/include/svx/svdundo.hxx b/include/svx/svdundo.hxx
index 67ca464b5b4c..5bb4e26c1a43 100644
--- a/include/svx/svdundo.hxx
+++ b/include/svx/svdundo.hxx
@@ -377,6 +377,24 @@ public:
 virtual OUString GetComment() const override;
 };
 
+class SdrUndoSort final : public SdrUndoAction
+{
+private:
+::std::vector m_OldSortOrder;
+::std::vector m_NewSortOrder;
+sal_uInt16 const m_nPage;
+
+void Do(::std::vector & rSortOrder);
+
+public:
+SdrUndoSort(SdrPage & rPage,
+::std::vector const& rSortOrder);
+
+virtual void Undo() override;
+virtual void Redo() override;
+
+virtual OUString GetComment() const override;
+};
 
 // #i11702#
 
@@ -732,6 +750,7 @@ public:
 virtual std::unique_ptr CreateUndoNewPage(SdrPage& rPage);
 virtual std::unique_ptr CreateUndoCopyPage(SdrPage& rPage);
 virtual std::unique_ptr CreateUndoSetPageNum(SdrPage& 
rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1);
+virtual std::unique_ptr CreateUndoSort(SdrPage& rPage, 
::std::vector const& rSortOrder);
 
 // Master page
 virtual std::unique_ptr 
CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage);
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 1ebfe6cad4ac..473b06d1f394 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -718,25 +718,15 @@ void SdrObjList::sort( std::vector& sortOrder)
 bool const isUndo(rModel.IsUndoEnabled());
 if (isUndo)
 {
-rModel.BegUndo(SvxResId(STR_SortShapes));
+
rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoSort(*getSdrPageFromSdrObjList(),
 sortOrder));
 }
 
 for (size_t i = 0; i < aNewSortOrder.size(); ++i)
 {
 aNewList[i] = maList[ aNewSortOrder[i] ];
-if (isUndo && i != sal::static_int_cast(aNewSortOrder[i]))
-{
-rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoObjectOrdNum(
-*aNewList[i], aNewSortOrder[i], i));
-}
 aNewList[i]->SetOrdNum(i);
 }
 
-if (isUndo)
-{
-rModel.EndUndo();
-}
-
 std::swap(aNewList, maList);
 }
 
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 116c5e479a13..d26a27339541 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 
@@ -970,6 +971,48 @@ OUString SdrUndoObjOrdNum::GetComment() const
 return ImpGetDescriptionStr(STR_UndoObjOrdNum);
 }
 
+SdrUndoSort::SdrUndoSort(SdrPage & rPage,
+::std::vector const& rSortOrder)
+: SdrUndoAction(rPage.getSdrModelFromSdrPage())
+, m_OldSortOrder(rSortOrder.size())
+, m_NewSortOrder(rSortOrder)
+, m_nPage(rPage.GetPageNum())
+{
+