summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/ww8graf.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2022-02-08 08:06:52 +0200
committerJustin Luth <jluth@mail.com>2022-02-09 08:19:24 +0100
commit19a5e50955ecc8da7ff5dbdfb9f47352d851ee1d (patch)
treeb29b09682b55de63d0c4e6477f3e01f0958b7269 /sw/source/filter/ww8/ww8graf.cxx
parent69f62aea8bfaa6d80cf9f54bd01e9af6fca0f9bb (diff)
related tdf#79186 filter: value is more than just LayoutInCell
nGroupShapeBooleanProperties contains 16 shape properties and 16 flags to indicate whether they are to be used or not. Up till now, only fLayoutInCell has been used by LO, but it handles far more than that, so lets change the code (now that we have the documentation for it) to make it clear that this could be useful for further compatibility fixes. There is no need to determine whether the setting has been provided or not - since a zero default indicates everything in this bit-set should be ignored. The naming and the if clause in ww8graf.cxx suggests that reverse engineering didn't really grasp how this worked, so I took the liberty of removing all of that awkwardness, and verified that at least several associated document from the OOo Apache bugtracker still worked. =============================================================== https://docs.microsoft.com/en-us/openspecs/office_file_formats /ms-odraw/a0ae6aa5-16e4-4550-87a2-b8ca180c7fd7 fLayoutInCell (1 bit): A bit that specifies whether this shape is displayed inside a table cell. If fUsefLayoutInCell equals 0x0, this value MUST be ignored. The default value for this property is 0x1. Change-Id: I82f80123a7419a83737b796f253406576732b6c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129657 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/source/filter/ww8/ww8graf.cxx')
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx30
1 files changed, 9 insertions, 21 deletions
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 113016dc036b..3cb0aebf6bc8 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2402,7 +2402,7 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS
if (m_nInTable &&
(eHoriRel == text::RelOrientation::FRAME || eHoriRel == text::RelOrientation::CHAR) &&
rFSPA.nwr == 3 &&
- !IsObjectLayoutInTableCell(rRecord.nLayoutInTableCell))
+ !IsObjectLayoutInTableCell(rRecord.nGroupShapeBooleanProperties))
{
eHoriRel = text::RelOrientation::PAGE_PRINT_AREA;
}
@@ -2452,7 +2452,7 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS
}
// #i84783#
-bool SwWW8ImplReader::IsObjectLayoutInTableCell( const sal_uInt32 nLayoutInTableCell ) const
+bool SwWW8ImplReader::IsObjectLayoutInTableCell(const sal_uInt32 nGroupShapeBooleanProperties) const
{
bool bIsObjectLayoutInTableCell = false;
@@ -2474,7 +2474,7 @@ bool SwWW8ImplReader::IsObjectLayoutInTableCell( const sal_uInt32 nLayoutInTable
case 0x0000: // version 8 aka Microsoft Word 97
{
bIsObjectLayoutInTableCell = false;
- OSL_ENSURE( nLayoutInTableCell == 0xFFFFFFFF,
+ OSL_ENSURE(nGroupShapeBooleanProperties == 0,
"no explicit object attribute layout in table cell expected." );
}
break;
@@ -2485,23 +2485,11 @@ bool SwWW8ImplReader::IsObjectLayoutInTableCell( const sal_uInt32 nLayoutInTable
case 0xC000: // version 14 aka Microsoft Word 2010
case 0xE000: // version 15 aka Microsoft Word 2013
{
- // #i98037#
- // adjustment of conditions needed after deeper analysis of
- // certain test cases.
- if ( nLayoutInTableCell == 0xFFFFFFFF || // no explicit attribute value given
- nLayoutInTableCell == 0x80008000 ||
- ( nLayoutInTableCell & 0x02000000 &&
- !(nLayoutInTableCell & 0x80000000 ) ) )
- {
- bIsObjectLayoutInTableCell = true;
- }
- else
- {
- // Documented in [MS-ODRAW], 2.3.4.44 "Group Shape Boolean Properties".
- bool fUsefLayoutInCell = (nLayoutInTableCell & 0x80000000) >> 31;
- bool fLayoutInCell = (nLayoutInTableCell & 0x8000) >> 15;
- bIsObjectLayoutInTableCell = fUsefLayoutInCell && fLayoutInCell;
- }
+ // Documented in [MS-ODRAW], 2.3.4.44 "Group Shape Boolean Properties".
+ bool fUsefLayoutInCell = (nGroupShapeBooleanProperties & 0x80000000) >> 31;
+ bool fLayoutInCell = (nGroupShapeBooleanProperties & 0x8000) >> 15;
+ // If unspecified, defaults to true
+ bIsObjectLayoutInTableCell = !fUsefLayoutInCell || fLayoutInCell;
}
break;
default:
@@ -2696,7 +2684,7 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( tools::Long nGrafAnchorCp )
return nullptr;
}
const bool bLayoutInTableCell =
- m_nInTable && IsObjectLayoutInTableCell( pRecord->nLayoutInTableCell );
+ m_nInTable && IsObjectLayoutInTableCell(pRecord->nGroupShapeBooleanProperties);
// #i18732# - Switch on 'follow text flow', if object is laid out
// inside table cell