sw/qa/extras/uiwriter/data/tdf157533.fodt |  438 ++++++++++++++++++++++++++++++
 sw/qa/extras/uiwriter/uiwriter6.cxx       |   56 +++
 sw/source/core/frmedt/feshview.cxx        |   20 +
 3 files changed, 511 insertions(+), 3 deletions(-)

New commits:
commit 3e0650fb166cac116a43f6ce5d03bd69830e37b8
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Wed Jun 5 01:39:48 2024 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Wed Jun 5 10:04:58 2024 +0200

    tdf#157533 sw: fix cursor position deselecting formula in table
    
    Fix lost cursor by deselecting formula object anchored as
    character as single content of table cells. In this case, the
    cursor was positioned inside the frame of the formula,
    disappeared in a flash.
    
    Fix also bad cursor position by deselecting formula object
    anchored as character at beginning of text lines in table
    content.
    
    Follow-up to commit 014e5f559a9acf319af24c721dbe6b0bc3bc5882
    "tdf#161360 sw: fix cursor position deselecting image in table".
    
    Change-Id: Ia1a96359f473071c4cead580322aa9c1af1d3f24
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168416
    Reviewed-by: László Németh <nem...@numbertext.org>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/data/tdf157533.fodt 
b/sw/qa/extras/uiwriter/data/tdf157533.fodt
new file mode 100644
index 000000000000..a35061acc4bf
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf157533.fodt
@@ -0,0 +1,438 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:creation-date>2023-09-30T17:41:02.606000000</meta:creation-date><dc:date>2023-09-30T23:03:25.641000000</dc:date><meta:editing-duration>PT7M1S</meta:editing-duration><meta:editing-cycles>2</meta:editing-cycles><meta:generator>LibreOfficeDev/24.8.0.0.alpha1$Linux_X86_64
 
LibreOffice_project/57c56b7b826c02868e48120432363fcb8f9e394a</meta:generator><meta:document-statistic
 meta:table-count="2" meta:image-count="0" meta:object-count="7" 
meta:page-count="1" meta:paragraph-count="9" meta:word-count="92" 
meta:character-count="523" 
meta:non-whitespace-character-count="435"/></office:meta>
+ <office:settings>
+  <config:config-item-set config:name="ooo:view-settings">
+   <config:config-item config:name="ViewAreaTop" 
config:type="long">0</config:config-item>
+   <config:config-item config:name="ViewAreaLeft" 
config:type="long">0</config:config-item>
+   <config:config-item config:name="ViewAreaWidth" 
config:type="long">39266</config:config-item>
+   <config:config-item config:name="ViewAreaHeight" 
config:type="long">22809</config:config-item>
+   <config:config-item config:name="ShowRedlineChanges" 
config:type="boolean">true</config:config-item>
+   <config:config-item config:name="InBrowseMode" 
config:type="boolean">false</config:config-item>
+   <config:config-item-map-indexed config:name="Views">
+    <config:config-item-map-entry>
+     <config:config-item config:name="ViewId" 
config:type="string">view2</config:config-item>
+     <config:config-item config:name="ViewLeft" 
config:type="long">11132</config:config-item>
+     <config:config-item config:name="ViewTop" 
config:type="long">2501</config:config-item>
+     <config:config-item config:name="VisibleLeft" 
config:type="long">0</config:config-item>
+     <config:config-item config:name="VisibleTop" 
config:type="long">0</config:config-item>
+     <config:config-item config:name="VisibleRight" 
config:type="long">39264</config:config-item>
+     <config:config-item config:name="VisibleBottom" 
config:type="long">22807</config:config-item>
+     <config:config-item config:name="ZoomType" 
config:type="short">0</config:config-item>
+     <config:config-item config:name="ViewLayoutColumns" 
config:type="short">1</config:config-item>
+     <config:config-item config:name="ViewLayoutBookMode" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="ZoomFactor" 
config:type="short">100</config:config-item>
+     <config:config-item config:name="IsSelectedFrame" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="KeepRatio" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="AnchoredTextOverflowLegacy" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="LegacySingleLineFontwork" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="ConnectorUseSnapRect" 
config:type="boolean">false</config:config-item>
+     <config:config-item config:name="IgnoreBreakAfterMultilineField" 
config:type="boolean">false</config:config-item>
+    </config:config-item-map-entry>
+   </config:config-item-map-indexed>
+  </config:config-item-set>
+ </office:settings>
+ <office:scripts>
+  <office:script script:language="ooo:Basic">
+   <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:xlink="http://www.w3.org/1999/xlink"/>
+  </office:script>
+ </office:scripts>
+ <office:font-face-decls>
+  <style:font-face style:name="Liberation Sans" 
svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" 
style:font-pitch="variable"/>
+  <style:font-face style:name="Liberation Serif" 
svg:font-family="&apos;Liberation Serif&apos;" 
style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Lucida Sans" svg:font-family="&apos;Lucida 
Sans&apos;" style:font-family-generic="swiss"/>
+  <style:font-face style:name="Lucida Sans1" svg:font-family="&apos;Lucida 
Sans&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" 
draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" 
draw:start-line-spacing-vertical="0.283cm" 
draw:end-line-spacing-horizontal="0.283cm" 
draw:end-line-spacing-vertical="0.283cm" style:writing-mode="lr-tb" 
style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" loext:tab-stop-distance="0cm" 
style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="fr" fo:country="FR" style:letter-kerning="true"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" 
loext:hyphenation-keep-type="column" style:text-autospace="ideograph-alpha" 
style:punctuation-wrap="hanging" style:line-break="strict" 
style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="fr" fo:country="FR" style:letter-kerning="true" 
fo:hyphenate="false" fo:hyphenation-remain-char-count="2" 
fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" 
loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="5" 
loext:hyphenation-zone="no-limit"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+  <style:style style:name="Heading" style:family="paragraph" 
style:parent-style-name="Standard" style:next-style-name="Text_20_body" 
style:class="text">
+   <style:paragraph-properties fo:margin-top="0.423cm" 
fo:margin-bottom="0.212cm" style:contextual-spacing="false" 
fo:keep-with-next="always"/>
+   <style:text-properties style:font-name="Liberation Sans" 
fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" 
style:font-pitch="variable" fo:font-size="14pt"/>
+  </style:style>
+  <style:style style:name="Text_20_body" style:display-name="Text body" 
style:family="paragraph" style:parent-style-name="Standard" style:class="text">
+   <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.247cm" 
style:contextual-spacing="false" fo:line-height="115%"/>
+  </style:style>
+  <style:style style:name="List" style:family="paragraph" 
style:parent-style-name="Text_20_body" style:class="list">
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Caption" style:family="paragraph" 
style:parent-style-name="Standard" style:class="extra">
+   <style:paragraph-properties fo:margin-top="0.212cm" 
fo:margin-bottom="0.212cm" style:contextual-spacing="false" 
text:number-lines="false" text:line-number="0"/>
+   <style:text-properties fo:font-size="12pt" fo:font-style="italic"/>
+  </style:style>
+  <style:style style:name="Index" style:family="paragraph" 
style:parent-style-name="Standard" style:class="index">
+   <style:paragraph-properties text:number-lines="false" text:line-number="0"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Table_20_Contents" style:display-name="Table 
Contents" style:family="paragraph" style:parent-style-name="Standard" 
style:class="extra">
+   <style:paragraph-properties fo:orphans="0" fo:widows="0" 
text:number-lines="false" text:line-number="0"/>
+  </style:style>
+  <style:style style:name="OLE" style:family="graphic">
+   <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" 
svg:y="0cm" style:wrap="dynamic" style:number-wrapped-paragraphs="no-limit" 
style:wrap-contour="false" style:vertical-pos="top" 
style:vertical-rel="paragraph" style:horizontal-pos="center" 
style:horizontal-rel="paragraph" fo:background-color="transparent" 
draw:fill="none" draw:fill-color="#729fcf"/>
+  </style:style>
+  <style:style style:name="Formula" style:family="graphic">
+   <style:graphic-properties text:anchor-type="as-char" svg:y="0cm" 
fo:margin-left="0cm" fo:margin-right="0cm" style:vertical-pos="middle" 
style:vertical-rel="text" fo:background-color="transparent" draw:fill="none" 
draw:fill-color="#729fcf"/>
+  </style:style>
+  <text:notes-configuration text:note-class="footnote" style:num-format="1" 
text:start-value="0" text:footnotes-position="page" 
text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" style:num-format="i" 
text:start-value="0"/>
+  <text:linenumbering-configuration text:number-lines="false" 
text:offset="0.499cm" style:num-format="1" text:number-position="left" 
text:increment="5"/>
+  <style:style style:name="Default_20_Style.1" style:display-name="Default 
Style.1" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-top="0.51pt solid #000000" fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.2" style:display-name="Default 
Style.2" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.3" style:display-name="Default 
Style.3" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.4" style:display-name="Default 
Style.4" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-right="0.51pt solid #000000" fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.5" style:display-name="Default 
Style.5" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.6" style:display-name="Default 
Style.6" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.7" style:display-name="Default 
Style.7" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.8" style:display-name="Default 
Style.8" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.9" style:display-name="Default 
Style.9" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.10" style:display-name="Default 
Style.10" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-right="0.51pt solid #000000" fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.11" style:display-name="Default 
Style.11" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-top="0.51pt solid #000000" fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.12" style:display-name="Default 
Style.12" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-right="0.51pt solid #000000" fo:border-top="0.51pt solid #000000" 
fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.13" style:display-name="Default 
Style.13" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.14" style:display-name="Default 
Style.14" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-right="0.51pt solid #000000" fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.15" style:display-name="Default 
Style.15" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-top="0.51pt solid #000000" fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="Default_20_Style.16" style:display-name="Default 
Style.16" style:family="table-cell">
+   <style:table-cell-properties fo:border-left="0.51pt solid #000000" 
fo:border-bottom="0.51pt solid #000000"/>
+   <style:text-properties/>
+  </style:style>
+  <table:table-template table:name="Default Style" 
table:first-row-end-column="row" table:first-row-start-column="row" 
table:last-row-end-column="row" table:last-row-start-column="row">
+   <table:first-row table:style-name="Default_20_Style.1"/>
+   <table:last-row table:style-name="Default_20_Style.2"/>
+   <table:first-column table:style-name="Default_20_Style.3"/>
+   <table:last-column table:style-name="Default_20_Style.4"/>
+   <table:body table:style-name="Default_20_Style.9"/>
+   <table:even-rows table:style-name="Default_20_Style.5"/>
+   <table:odd-rows table:style-name="Default_20_Style.6"/>
+   <table:even-columns table:style-name="Default_20_Style.7"/>
+   <table:odd-columns table:style-name="Default_20_Style.8"/>
+   <table:background table:style-name="Default_20_Style.10"/>
+   <loext:first-row-even-column table:style-name="Default_20_Style.15"/>
+   <loext:last-row-even-column table:style-name="Default_20_Style.16"/>
+   <loext:first-row-end-column table:style-name="Default_20_Style.12"/>
+   <loext:first-row-start-column table:style-name="Default_20_Style.11"/>
+   <loext:last-row-end-column table:style-name="Default_20_Style.14"/>
+   <loext:last-row-start-column table:style-name="Default_20_Style.13"/>
+  </table:table-template>
+ </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="Tableau1" style:family="table">
+   <style:table-properties style:width="17cm" table:align="margins"/>
+  </style:style>
+  <style:style style:name="Tableau1.A" style:family="table-column">
+   <style:table-column-properties style:column-width="8.5cm" 
style:rel-column-width="32767*"/>
+  </style:style>
+  <style:style style:name="Tableau1.B" style:family="table-column">
+   <style:table-column-properties style:column-width="8.5cm" 
style:rel-column-width="32768*"/>
+  </style:style>
+  <style:style style:name="Tableau1.A1" style:family="table-cell">
+   <style:table-cell-properties style:writing-mode="page"/>
+  </style:style>
+  <style:style style:name="Tableau2" style:family="table">
+   <style:table-properties style:width="17cm" table:align="margins" 
style:may-break-between-rows="true" table:border-model="collapsing"/>
+  </style:style>
+  <style:style style:name="Tableau2.A" style:family="table-column">
+   <style:table-column-properties style:column-width="8.5cm" 
style:rel-column-width="32767*"/>
+  </style:style>
+  <style:style style:name="Tableau2.B" style:family="table-column">
+   <style:table-column-properties style:column-width="8.5cm" 
style:rel-column-width="32768*"/>
+  </style:style>
+  <style:style style:name="Tableau2.1" style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:style>
+  <style:style style:name="Tableau2.A1" style:family="table-cell">
+   <style:table-cell-properties fo:background-color="transparent" 
fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" 
fo:border-right="none" fo:border-top="0.5pt solid #000000" 
fo:border-bottom="0.5pt solid #000000" style:writing-mode="page">
+    <style:background-image/>
+   </style:table-cell-properties>
+  </style:style>
+  <style:style style:name="Tableau2.B1" style:family="table-cell">
+   <style:table-cell-properties fo:background-color="transparent" 
fo:padding="0.097cm" fo:border="0.5pt solid #000000" style:writing-mode="page">
+    <style:background-image/>
+   </style:table-cell-properties>
+  </style:style>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Standard">
+   <style:text-properties officeooo:rsid="00261c06"/>
+  </style:style>
+  <style:style style:name="P2" style:family="paragraph" 
style:parent-style-name="Standard">
+   <style:text-properties officeooo:rsid="0024f3f5" 
officeooo:paragraph-rsid="0024f3f5"/>
+  </style:style>
+  <style:style style:name="P3" style:family="paragraph" 
style:parent-style-name="Standard">
+   <style:text-properties officeooo:paragraph-rsid="0024f3f5"/>
+  </style:style>
+  <style:style style:name="T1" style:family="text">
+   <style:text-properties officeooo:rsid="0024f3f5"/>
+  </style:style>
+  <style:style style:name="T2" style:family="text">
+   <style:text-properties officeooo:rsid="00261c06"/>
+  </style:style>
+  <style:style style:name="T3" style:family="text">
+   <style:text-properties officeooo:rsid="002149ef"/>
+  </style:style>
+  <style:style style:name="fr1" style:family="graphic" 
style:parent-style-name="Formula">
+   <style:graphic-properties style:vertical-pos="from-top" 
style:horizontal-pos="from-left" style:horizontal-rel="paragraph-content" 
draw:ole-draw-aspect="1"/>
+  </style:style>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="21.001cm" 
fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" 
fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" 
fo:margin-right="2cm" style:writing-mode="lr-tb" 
style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" 
style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" 
style:layout-grid-mode="none" style:layout-grid-ruby-below="false" 
style:layout-grid-print="false" style:layout-grid-display="false" 
style:footnote-max-height="0cm" loext:margin-gutter="0cm">
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+  <style:style style:name="dp1" style:family="drawing-page">
+   <style:drawing-page-properties draw:background-size="full"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1" 
draw:style-name="dp1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text>
+   <text:sequence-decls>
+    <text:sequence-decl text:display-outline-level="0" 
text:name="Illustration"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+   </text:sequence-decls>
+   <text:p text:style-name="P1">Deselecting the first formula of the line does 
not cause any undesired behaviour, but the cursor is not placed correctly after 
deselecting the two following formulas. In all cases, keyboard input works as 
intended.</text:p>
+   <table:table table:name="Tableau1" table:style-name="Tableau1">
+    <table:table-column table:style-name="Tableau1.A"/>
+    <table:table-column table:style-name="Tableau1.B"/>
+    <table:table-row>
+     <table:table-cell table:style-name="Tableau1.A1" 
office:value-type="string">
+      <text:p text:style-name="Standard"/>
+     </table:table-cell>
+     <table:table-cell table:style-name="Tableau1.A1" 
office:value-type="string">
+      <text:p text:style-name="Standard"/>
+     </table:table-cell>
+    </table:table-row>
+    <table:table-row>
+     <table:table-cell table:style-name="Tableau1.A1" 
office:value-type="string">
+      <text:p text:style-name="P2">Table with No Style:</text:p>
+     </table:table-cell>
+     <table:table-cell table:style-name="Tableau1.A1" 
office:value-type="string">
+      <text:p text:style-name="Standard"/>
+     </table:table-cell>
+    </table:table-row>
+    <table:table-row>
+     <table:table-cell table:style-name="Tableau1.A1" 
office:value-type="string">
+      <text:p text:style-name="P2">First Cell</text:p>
+     </table:table-cell>
+     <table:table-cell table:style-name="Tableau1.A1" 
office:value-type="string">
+      <text:p text:style-name="P3"><text:span text:style-name="T1">Deselecting 
the formula equal to 6 takes me back to the </text:span><text:span 
text:style-name="T2">end of the </text:span><text:span 
text:style-name="T1">first cell </text:span><text:span text:style-name="T2">of 
the table</text:span><text:span text:style-name="T1">, deselecting the one 
equal to </text:span><text:span text:style-name="T2">7</text:span><text:span 
text:style-name="T1"> puts the cursor just before </text:span><text:span 
text:style-name="T2">the</text:span><text:span text:style-name="T1"> formula. 
</text:span><text:span text:style-name="T2">Keyboard input works as 
intented.</text:span></text:p>
+      <text:p text:style-name="P3"><draw:frame draw:style-name="fr1" 
draw:name="Objet2" text:anchor-type="as-char" svg:y="-0.386cm" 
svg:width="1.54cm" svg:height="0.51cm" draw:z-index="3"><draw:object>
+         <math xmlns="http://www.w3.org/1998/Math/MathML"; display="block">
+          <semantics>
+           <mrow>
+            <mi>E</mi>
+            <mrow>
+             <mrow>
+              <mo fence="true" form="prefix" stretchy="false">(</mo>
+              <mrow>
+               <mi>X</mi>
+              </mrow>
+              <mo fence="true" form="postfix" stretchy="false">)</mo>
+             </mrow>
+             <mo stretchy="false">=</mo>
+             <mn>6</mn>
+            </mrow>
+           </mrow>
+           <annotation encoding="StarMath 5.0">E( X ) = 6</annotation>
+          </semantics>
+         </math>
+        </draw:object><draw:image>
+         
<office:binary-data>VkNMTVRGAQAxAAAAAAAAAAEAGwAAAAAAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAQQGAAD9
+          
AQAAMgAAAJYAAQACAAAACQCLAAEAAgAAAP//gQABABAAAAAAAAAAAAAAAAMGAAD8AQAAlQAB
+          
AAQAAAAAAAAAlgABAAIAAAAJAIsAAQACAAAAHwCKAAEASAAAAAUAQgAAABAATGliZXJhdGlv
+          
biBTZXJpZgAAAAAAAKcBAAAAAAAAAAAFAAAAAAACAP8DAAAAAAAAAAEA/wMAAAAAAAAAAAAA
+          
AIgAAQACAAAAAQCHAAEABQAAAP////8AhgABAAQAAAAAAAAAcgACABcAAAAVAAAAfQEAAAEA
+          
RQIBAAAAAAEAAQBFAIwAAQAAAAAAiwABAAIAAAAfAIoAAQBCAAAABQA8AAAACgBPcGVuU3lt
+          
Ym9sAAAAAAAApwEAAP//AAAAAAUAAAAAAAAA/wMAAAAAAAAAAQD/AwAAAAAAAAAAAAAAiAAB
+          
AAIAAAABAIcAAQAFAAAA/////wCGAAEABAAAAAAAAAByAAIAGgAAAD4BAAB9AQAAAQAAACgA
+          
kAAAAAAAAQABACgAjAABAAAAAACLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQAExpYmVyYXRp
+          
b24gU2VyaWYAAAAAAACnAQAAAAAAAAAABQAAAAAAAgD/AwAAAAAAAAABAP8DAAAAAAAAAAAA
+          
AACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAXAAAAEQIAAH0BAAAB
+          
AFgCAQAAAAABAAEAWACMAAEAAAAAAIsAAQACAAAAHwCKAAEAQgAAAAUAPAAAAAoAT3BlblN5
+          
bWJvbAAAAAAAAKcBAAD//wAAAAAFAAAAAAAAAP8DAAAAAAAAAAEA/wMAAAAAAAAAAAAAAIgA
+          
AQACAAAAAQCHAAEABQAAAP////8AhgABAAQAAAAAAAAAcgACABoAAAA6AwAAfQEAAAEAAAAp
+          
AJAAAAAAAAEAAQApAIwAAQAAAAAAiwABAAIAAAAfAIoAAQBCAAAABQA8AAAACgBPcGVuU3lt
+          
Ym9sAAAAAAAApwEAAP//AAAAAAUAAAAAAAAA/wMAAAAAAAAAAQD/AwAAAAAAAAAAAAAAiAAB
+          
AAIAAAABAIcAAQAFAAAA/////wCGAAEABAAAAAAAAAByAAIAGgAAAM4DAAB9AQAAAQAAAD0A
+          
UAEAAAAAAQABAD0AjAABAAAAAACLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQAExpYmVyYXRp
+          
b24gU2VyaWYAAAAAAACnAQAAAAAAAAAABQAAAAAAAAD/AwAAAAAAAAABAP8DAAAAAAAAAAAA
+          
AACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAXAAAAIAUAAH0BAAAB
+          
ADbUAAAAAAABAAEANgCMAAEAAAAAAJUAAQAEAAAAAAAAAJYAAQACAAAACQCMAAEAAAAAAA==
+         </office:binary-data>
+        </draw:image>
+       </draw:frame><text:s/><text:span text:style-name="T1">and the second 
formula</text:span><text:span text:style-name="T3"> </text:span>
+       </text:p>
+     </table:table-cell>
+    </table:table-row>
+   </table:table>
+   <text:p text:style-name="Standard"/>
+   <text:p text:style-name="Standard">Table with Default Style: <text:span 
text:style-name="T1">bug described in the report.</text:span></text:p>
+   <table:table table:name="Tableau2" table:style-name="Tableau2" 
table:template-name="Default Style">
+    <table:table-column table:style-name="Tableau2.A"/>
+    <table:table-column table:style-name="Tableau2.B"/>
+    <table:table-row table:style-name="Tableau2.1">
+     <table:table-cell table:style-name="Tableau2.A1" 
office:value-type="string">
+      <text:p text:style-name="Standard"><draw:frame draw:style-name="fr1" 
draw:name="Objet11" text:anchor-type="as-char" svg:y="-0.386cm" 
svg:width="1.538cm" svg:height="0.51cm" draw:z-index="6"><draw:object>
+         <math xmlns="http://www.w3.org/1998/Math/MathML"; display="block">
+          <semantics>
+           <mrow>
+            <mi>E</mi>
+            <mrow>
+             <mrow>
+              <mo fence="true" form="prefix" stretchy="false">(</mo>
+              <mrow>
+               <mi>X</mi>
+              </mrow>
+              <mo fence="true" form="postfix" stretchy="false">)</mo>
+             </mrow>
+             <mo stretchy="false">=</mo>
+             <mn>8</mn>
+            </mrow>
+           </mrow>
+           <annotation encoding="StarMath 5.0">E( X ) = 8</annotation>
+          </semantics>
+         </math>
+        </draw:object><draw:image>
+         
<office:binary-data>VkNMTVRGAQAxAAAAAAAAAAEAGwAAAAAAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAQIGAAD9
+          
AQAAMgAAAJYAAQACAAAACQCLAAEAAgAAAP//gQABABAAAAAAAAAAAAAAAAEGAAD8AQAAlQAB
+          
AAQAAAAAAAAAlgABAAIAAAAJAIsAAQACAAAAHwCKAAEASAAAAAUAQgAAABAATGliZXJhdGlv
+          
biBTZXJpZgAAAAAAAKcBAAAAAAAAAAAFAAAAAAACAP8DAAAAAAAAAAEA/wMAAAAAAAAAAAAA
+          
AIgAAQACAAAAAQCHAAEABQAAAP////8AhgABAAQAAAAAAAAAcgACABcAAAAVAAAAfQEAAAEA
+          
RQIBAAAAAAEAAQBFAIwAAQAAAAAAiwABAAIAAAAfAIoAAQBCAAAABQA8AAAACgBPcGVuU3lt
+          
Ym9sAAAAAAAApwEAAP//AAAAAAUAAAAAAAAA/wMAAAAAAAAAAQD/AwAAAAAAAAAAAAAAiAAB
+          
AAIAAAABAIcAAQAFAAAA/////wCGAAEABAAAAAAAAAByAAIAGgAAAD4BAAB9AQAAAQAAACgA
+          
kAAAAAAAAQABACgAjAABAAAAAACLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQAExpYmVyYXRp
+          
b24gU2VyaWYAAAAAAACnAQAAAAAAAAAABQAAAAAAAgD/AwAAAAAAAAABAP8DAAAAAAAAAAAA
+          
AACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAXAAAAEQIAAH0BAAAB
+          
AFgCAQAAAAABAAEAWACMAAEAAAAAAIsAAQACAAAAHwCKAAEAQgAAAAUAPAAAAAoAT3BlblN5
+          
bWJvbAAAAAAAAKcBAAD//wAAAAAFAAAAAAAAAP8DAAAAAAAAAAEA/wMAAAAAAAAAAAAAAIgA
+          
AQACAAAAAQCHAAEABQAAAP////8AhgABAAQAAAAAAAAAcgACABoAAAA6AwAAfQEAAAEAAAAp
+          
AJAAAAAAAAEAAQApAIwAAQAAAAAAiwABAAIAAAAfAIoAAQBCAAAABQA8AAAACgBPcGVuU3lt
+          
Ym9sAAAAAAAApwEAAP//AAAAAAUAAAAAAAAA/wMAAAAAAAAAAQD/AwAAAAAAAAAAAAAAiAAB
+          
AAIAAAABAIcAAQAFAAAA/////wCGAAEABAAAAAAAAAByAAIAGgAAAM4DAAB9AQAAAQAAAD0A
+          
UAEAAAAAAQABAD0AjAABAAAAAACLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQAExpYmVyYXRp
+          
b24gU2VyaWYAAAAAAACnAQAAAAAAAAAABQAAAAAAAAD/AwAAAAAAAAABAP8DAAAAAAAAAAAA
+          
AACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAXAAAAIAUAAH0BAAAB
+          
ADjUAAAAAAABAAEAOACMAAEAAAAAAJUAAQAEAAAAAAAAAJYAAQACAAAACQCMAAEAAAAAAA==
+         </office:binary-data>
+        </draw:image>
+       </draw:frame></text:p>
+     </table:table-cell>
+     <table:table-cell table:style-name="Tableau2.B1" 
office:value-type="string">
+      <text:p text:style-name="Standard"><draw:frame draw:style-name="fr1" 
draw:name="Objet10" text:anchor-type="as-char" svg:y="-0.386cm" 
svg:width="1.54cm" svg:height="0.51cm" draw:z-index="4"><draw:object>
+         <math xmlns="http://www.w3.org/1998/Math/MathML"; display="block">
+          <semantics>
+           <mrow>
+            <mi>E</mi>
+            <mrow>
+             <mrow>
+              <mo fence="true" form="prefix" stretchy="false">(</mo>
+              <mrow>
+               <mi>X</mi>
+              </mrow>
+              <mo fence="true" form="postfix" stretchy="false">)</mo>
+             </mrow>
+             <mo stretchy="false">=</mo>
+             <mn>9</mn>
+            </mrow>
+           </mrow>
+           <annotation encoding="StarMath 5.0">E( X ) = 9</annotation>
+          </semantics>
+         </math>
+        </draw:object><draw:image>
+         
<office:binary-data>VkNMTVRGAQAxAAAAAAAAAAEAGwAAAAAAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAQMGAAD9
+          
AQAAMgAAAJYAAQACAAAACQCLAAEAAgAAAP//gQABABAAAAAAAAAAAAAAAAIGAAD8AQAAlQAB
+          
AAQAAAAAAAAAlgABAAIAAAAJAIsAAQACAAAAHwCKAAEASAAAAAUAQgAAABAATGliZXJhdGlv
+          
biBTZXJpZgAAAAAAAKcBAAAAAAAAAAAFAAAAAAACAP8DAAAAAAAAAAEA/wMAAAAAAAAAAAAA
+          
AIgAAQACAAAAAQCHAAEABQAAAP////8AhgABAAQAAAAAAAAAcgACABcAAAAVAAAAfQEAAAEA
+          
RQIBAAAAAAEAAQBFAIwAAQAAAAAAiwABAAIAAAAfAIoAAQBCAAAABQA8AAAACgBPcGVuU3lt
+          
Ym9sAAAAAAAApwEAAP//AAAAAAUAAAAAAAAA/wMAAAAAAAAAAQD/AwAAAAAAAAAAAAAAiAAB
+          
AAIAAAABAIcAAQAFAAAA/////wCGAAEABAAAAAAAAAByAAIAGgAAAD4BAAB9AQAAAQAAACgA
+          
kAAAAAAAAQABACgAjAABAAAAAACLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQAExpYmVyYXRp
+          
b24gU2VyaWYAAAAAAACnAQAAAAAAAAAABQAAAAAAAgD/AwAAAAAAAAABAP8DAAAAAAAAAAAA
+          
AACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAXAAAAEQIAAH0BAAAB
+          
AFgCAQAAAAABAAEAWACMAAEAAAAAAIsAAQACAAAAHwCKAAEAQgAAAAUAPAAAAAoAT3BlblN5
+          
bWJvbAAAAAAAAKcBAAD//wAAAAAFAAAAAAAAAP8DAAAAAAAAAAEA/wMAAAAAAAAAAAAAAIgA
+          
AQACAAAAAQCHAAEABQAAAP////8AhgABAAQAAAAAAAAAcgACABoAAAA6AwAAfQEAAAEAAAAp
+          
AJAAAAAAAAEAAQApAIwAAQAAAAAAiwABAAIAAAAfAIoAAQBCAAAABQA8AAAACgBPcGVuU3lt
+          
Ym9sAAAAAAAApwEAAP//AAAAAAUAAAAAAAAA/wMAAAAAAAAAAQD/AwAAAAAAAAAAAAAAiAAB
+          
AAIAAAABAIcAAQAFAAAA/////wCGAAEABAAAAAAAAAByAAIAGgAAAM4DAAB9AQAAAQAAAD0A
+          
UAEAAAAAAQABAD0AjAABAAAAAACLAAEAAgAAAB8AigABAEgAAAAFAEIAAAAQAExpYmVyYXRp
+          
b24gU2VyaWYAAAAAAACnAQAAAAAAAAAABQAAAAAAAAD/AwAAAAAAAAABAP8DAAAAAAAAAAAA
+          
AACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAHIAAgAXAAAANgUAAH0BAAAB
+          
ADnUAAAAAAABAAEAOQCMAAEAAAAAAJUAAQAEAAAAAAAAAJYAAQACAAAACQCMAAEAAAAAAA==
+         </office:binary-data>
+        </draw:image>
+       </draw:frame></text:p>
+     </table:table-cell>
+    </table:table-row>
+   </table:table>
+   <text:p text:style-name="Standard"/>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index a9dc5530dab6..9cbe0a0311ec 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -41,6 +41,7 @@
 
 #include <com/sun/star/text/XTextTable.hpp>
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
 #include <o3tl/cppunittraitshelper.hxx>
 #include <swdtflvr.hxx>
 #include <comphelper/propertysequence.hxx>
@@ -1745,6 +1746,61 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf161360)
     CPPUNIT_ASSERT_EQUAL(SelectionType::Text, eType2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157533)
+{
+    // load a table with objects positioned at beginning of text lines
+    createSwDoc("tdf157533.fodt");
+    SwDoc* pDoc = getSwDoc();
+    CPPUNIT_ASSERT(pDoc);
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    CPPUNIT_ASSERT(pWrtShell);
+    auto pShell = pDoc->GetDocShell()->GetFEShell();
+    CPPUNIT_ASSERT(pShell);
+
+    auto xModel = mxComponent.queryThrow<frame::XModel>();
+    uno::Reference<drawing::XShape> xShape(getShapeByName(u"Objet2"));
+    uno::Reference<view::XSelectionSupplier> 
xCtrl(xModel->getCurrentController(), uno::UNO_QUERY);
+    xCtrl->select(uno::Any(xShape));
+
+    dispatchCommand(mxComponent, ".uno:Escape", {});
+
+    // Then make sure that the cursor in the table:
+    SelectionType eType2 = pWrtShell->GetSelectionType();
+    // This was false (only SelectionType::Text)
+    bool bCursorInTable = eType2 == (SelectionType::Text | 
SelectionType::Table);
+    CPPUNIT_ASSERT(bCursorInTable);
+
+    SwTextNode* pTextNode = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode();
+    // This was false (not in the same paragraph and cell)
+    CPPUNIT_ASSERT(pTextNode->GetText().indexOf("and the second formula") > 
-1);
+
+    uno::Reference<drawing::XShape> xShape2(getShapeByName(u"Objet11"));
+    xCtrl->select(uno::Any(xShape2));
+
+    dispatchCommand(mxComponent, ".uno:Escape", {});
+
+    SwTextNode* pTextNode2 = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode();
+    // This was false (lost text cursor inside the frame of the formula)
+    CPPUNIT_ASSERT(pTextNode2->GetTableBox());
+    SwTableNode* pTableNode = 
pWrtShell->GetCursor()->GetPointNode().FindTableNode();
+    SwTable& rTable = pTableNode->GetTable();
+    // cursor in the same cell
+    bool bSameBox = pTextNode2->GetTableBox() == rTable.GetTableBox("A1");
+    CPPUNIT_ASSERT(bSameBox);
+
+    uno::Reference<drawing::XShape> xShape3(getShapeByName(u"Objet10"));
+    xCtrl->select(uno::Any(xShape3));
+
+    dispatchCommand(mxComponent, ".uno:Escape", {});
+
+    SwTextNode* pTextNode3 = 
pWrtShell->GetCursor()->GetPointNode().GetTextNode();
+    // This was false (lost text cursor inside the frame of the formula)
+    CPPUNIT_ASSERT(pTextNode3->GetTableBox());
+    // cursor in the same cell
+    bSameBox = pTextNode3->GetTableBox() == rTable.GetTableBox("B1");
+    CPPUNIT_ASSERT(bSameBox);
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115132)
 {
     createSwDoc();
diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index 9a8d7304b4cc..6b441f39a844 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -212,15 +212,29 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 
nFlag, SdrObject *pObj )
                     if ( SW_LEAVE_FRAME & nFlag )
                     {
                         const SwContact* pContact = GetUserCall(pOldObj);
-                        if ( pContact && pContact->ObjAnchoredAsChar() )
+                        if ( pContact && pContact->ObjAnchoredAsChar() &&
+                                pOldSelFly->GetAnchorFrame() &&
+                                pOldSelFly->GetAnchorFrame()->GetUpper() )
                         {
                             const SwNode * pOldNd = 
pContact->GetAnchorNode().FindTableNode();
                             // the original image was in a table, but the 
cursor is not in that
                             if ( pOldNd && pOldNd != 
GetCursor()->GetPointNode().FindTableNode() )
                             {
+                                const SwRect& rCellFrame =
+                                    
pOldSelFly->GetAnchorFrame()->GetUpper()->getFrameArea();
+                                Point aPtCellTopRight( rCellFrame.Pos() );
+                                aPtCellTopRight.setX( aPtCellTopRight.X() + 
rCellFrame.Width() );
                                 if ( SwWrtShell* pWrtShell = 
dynamic_cast<SwWrtShell*>(this) )
-                                    // put the text cursor in the same row
-                                    pWrtShell->SelectTableRowCol( aPt );
+                                    // put the text cursor in the same cell
+                                    pWrtShell->SelectTableRowCol( 
aPtCellTopRight );
+                            }
+                            // same table, but not in the same cell
+                            else if ( pContact->GetAnchorNode().GetTableBox() 
!=
+                                            
GetCursor()->GetPointNode().GetTextNode()->GetTableBox() )
+                            {
+                                aPt.setX( aPt.getX() + 2 + 
pOldSelFly->getFrameArea().Width() );
+                                // put the text cursor after the object
+                                SetCursor( aPt, true );
                             }
                         }
                     }

Reply via email to