diff options
-rw-r--r-- | sw/inc/IDocumentSettingAccess.hxx | 1 | ||||
-rw-r--r-- | sw/qa/uibase/uno/uno.cxx | 24 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentSettingManager.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentSettingManager.hxx | 1 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexp.cxx | 1 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uno/SwXDocumentSettings.cxx | 18 |
7 files changed, 65 insertions, 0 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 0dd9467bdf13..264860b854c4 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -99,6 +99,7 @@ enum class DocumentSettingId // tdf#119908 new paragraph justification JUSTIFY_LINES_WITH_SHRINKING, APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH, + DO_NOT_MIRROR_RTL_DRAW_OBJS, // COMPATIBILITY FLAGS END BROWSE_MODE, HTML_MODE, diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx index d38d0bbfc967..3e6d9c93d51c 100644 --- a/sw/qa/uibase/uno/uno.cxx +++ b/sw/qa/uibase/uno/uno.cxx @@ -560,6 +560,30 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testAllowTextAfterFloatingTableBreak) CPPUNIT_ASSERT(bAllowTextAfterFloatingTableBreak); } +CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testDoNotMirrorRtlDrawObjs) +{ + // Given an empty document: + createSwDoc(); + + // When checking the state of the DoNotMirrorRtlDrawObjs compat flag: + uno::Reference<lang::XMultiServiceFactory> xDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xSettings( + xDocument->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); + bool bDoNotMirrorRtlDrawObjs{}; + // Without the accompanying fix in place, this test would have failed with: + // An uncaught exception of type com.sun.star.beans.UnknownPropertyException + // i.e. the compat flag was not recognized. + xSettings->getPropertyValue("DoNotMirrorRtlDrawObjs") >>= bDoNotMirrorRtlDrawObjs; + // Then make sure it's false by default: + CPPUNIT_ASSERT(!bDoNotMirrorRtlDrawObjs); + + // And when setting DoNotMirrorRtlDrawObjs=true: + xSettings->setPropertyValue("DoNotMirrorRtlDrawObjs", uno::Any(true)); + // Then make sure it gets enabled: + xSettings->getPropertyValue("DoNotMirrorRtlDrawObjs") >>= bDoNotMirrorRtlDrawObjs; + CPPUNIT_ASSERT(bDoNotMirrorRtlDrawObjs); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 4e093c9230bf..55b625932efb 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -257,6 +257,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const return mbDoNotBreakWrappedTables; case DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK: return mbAllowTextAfterFloatingTableBreak; + case DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS: + return mbDoNotMirrorRtlDrawObjs; case DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING: return mbJustifyLinesWithShrinking; case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return mbNoNumberingShowFollowBy; @@ -451,6 +453,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo mbApplyTextAttrToEmptyLineAtEndOfParagraph = value; break; + case DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS: + mbDoNotMirrorRtlDrawObjs = value; + break; + case DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES: mbDoNotBreakWrappedTables = value; break; @@ -1098,12 +1104,16 @@ void sw::DocumentSettingManager::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mnImagePreferredDPI")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(mnImagePreferredDPI).getStr())); + (void)xmlTextWriterEndElement(pWriter); (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbApplyTextAttrToEmptyLineAtEndOfParagraph")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(mbApplyTextAttrToEmptyLineAtEndOfParagraph).getStr())); (void)xmlTextWriterEndElement(pWriter); + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbDoNotMirrorRtlDrawObjs")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), + BAD_CAST(OString::boolean(mbDoNotMirrorRtlDrawObjs).getStr())); (void)xmlTextWriterEndElement(pWriter); (void)xmlTextWriterEndElement(pWriter); diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index 57411f66cbb4..6cfda277ade1 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -179,6 +179,7 @@ class DocumentSettingManager final : bool mbAllowTextAfterFloatingTableBreak = false; bool mbJustifyLinesWithShrinking = false; bool mbApplyTextAttrToEmptyLineAtEndOfParagraph = true; + bool mbDoNotMirrorRtlDrawObjs = false; // If this is on as_char flys wrapping will be handled the same like in Word bool mbNoNumberingShowFollowBy; bool mbDropCapPunctuation; // tdf#150200, tdf#150438 diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 9137749820ba..29fd11a8b722 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -396,6 +396,7 @@ void SwXMLExport::GetConfigurationSettings( Sequence < PropertyValue >& rProps) static const std::initializer_list<std::u16string_view> vOmitFalseValues = { u"DoNotBreakWrappedTables", u"AllowTextAfterFloatingTableBreak", + u"DoNotMirrorRtlDrawObjs", }; SvXMLUnitConverter::convertPropertySet( rProps, xProps, &vOmitFalseValues ); diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index febdff27872b..f3da95047943 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1301,6 +1301,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC bool bDoNotBreakWrappedTables = false; bool bAllowTextAfterFloatingTableBreak = false; bool bDropCapPunctuation = false; + bool bDoNotMirrorRtlDrawObjs = false; const PropertyValue* currentDatabaseDataSource = nullptr; const PropertyValue* currentDatabaseCommand = nullptr; @@ -1412,6 +1413,10 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC } else if ( rValue.Name == "DropCapPunctuation" ) bDropCapPunctuation = true; + else if (rValue.Name == "DoNotMirrorRtlDrawObjs") + { + rValue.Value >>= bDoNotMirrorRtlDrawObjs; + } } catch( Exception& ) { @@ -1584,6 +1589,11 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC xProps->setPropertyValue("ApplyTextAttrToEmptyLineAtEndOfParagraph", Any(false)); } + if (bDoNotMirrorRtlDrawObjs) + { + xProps->setPropertyValue("DoNotMirrorRtlDrawObjs", Any(true)); + } + if (bDoNotBreakWrappedTables) { xProps->setPropertyValue("DoNotBreakWrappedTables", Any(true)); diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 6e65905ca4ff..d4d5e223e602 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -160,6 +160,7 @@ enum SwDocumentSettingsPropertyHandles HANDLE_DROP_CAP_PUNCTUATION, HANDLE_USE_VARIABLE_WIDTH_NBSP, HANDLE_APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH, + HANDLE_DO_NOT_MIRROR_RTL_DRAW_OBJS, }; } @@ -266,6 +267,7 @@ static rtl::Reference<MasterPropertySetInfo> lcl_createSettingsInfo() { OUString("DropCapPunctuation"), HANDLE_DROP_CAP_PUNCTUATION, cppu::UnoType<bool>::get(), 0 }, { OUString("UseVariableWidthNBSP"), HANDLE_USE_VARIABLE_WIDTH_NBSP, cppu::UnoType<bool>::get(), 0 }, { OUString("ApplyTextAttrToEmptyLineAtEndOfParagraph"), HANDLE_APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH, cppu::UnoType<bool>::get(), 0 }, + { OUString("DoNotMirrorRtlDrawObjs"), HANDLE_DO_NOT_MIRROR_RTL_DRAW_OBJS, cppu::UnoType<bool>::get(), 0 }, /* * As OS said, we don't have a view when we need to set this, so I have to @@ -1086,6 +1088,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } } break; + case HANDLE_DO_NOT_MIRROR_RTL_DRAW_OBJS: + { + bool bTmp; + if (rValue >>= bTmp) + { + mpDoc->getIDocumentSettingAccess().set( + DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS, bTmp); + } + } + break; case HANDLE_DO_NOT_BREAK_WRAPPED_TABLES: { bool bTmp; @@ -1674,6 +1686,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf DocumentSettingId::APPLY_TEXT_ATTR_TO_EMPTY_LINE_AT_END_OF_PARAGRAPH); } break; + case HANDLE_DO_NOT_MIRROR_RTL_DRAW_OBJS: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get( + DocumentSettingId::DO_NOT_MIRROR_RTL_DRAW_OBJS); + } + break; case HANDLE_DO_NOT_BREAK_WRAPPED_TABLES: { rValue <<= mpDoc->getIDocumentSettingAccess().get( |