writerfilter/source/dmapper/DomainMapper.cxx |   45 +++++++++++++++------------
 1 file changed, 25 insertions(+), 20 deletions(-)

New commits:
commit 2d0a87f97e2c9ac50cd6ce329ca8256daf94ead4
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Wed Apr 26 18:03:18 2023 +0300
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Wed May 3 01:16:52 2023 +0200

    tdf#151974: writerfilter: apply props only to new document
    
    Properties applied to document shoudl be a case only for new doc,
    but DomainMapper can be called during pasing of RTF and cause
    modifications to props in already open document.
    
    Tested only for "NoNumberingShowFollowBy" but I assume this is
    a case for all compatibility props.
    
    Change-Id: I4558d809ca477918373b15fa05500ed985e170a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151069
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 9da64ce6921a..3db5c2970705 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -116,26 +116,31 @@ DomainMapper::DomainMapper( const uno::Reference< 
uno::XComponentContext >& xCon
     mbHasControls(false),
     mbWasShapeInPara(false)
 {
-    // #i24363# tab stops relative to indent
-    m_pImpl->SetDocumentSettingsProperty(
-        getPropertyName( PROP_TABS_RELATIVE_TO_INDENT ),
-        uno::Any( false ) );
-    m_pImpl->SetDocumentSettingsProperty(
-        getPropertyName( PROP_SURROUND_TEXT_WRAP_SMALL ),
-        uno::Any( true ) );
-    m_pImpl->SetDocumentSettingsProperty(
-        getPropertyName( PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING ),
-        uno::Any( true ) );
-
-    // Don't load the default style definitions to avoid weird mix
-    m_pImpl->SetDocumentSettingsProperty("StylesNoDefault", uno::Any(true));
-    m_pImpl->SetDocumentSettingsProperty("MsWordCompTrailingBlanks", 
uno::Any(true));
-    m_pImpl->SetDocumentSettingsProperty("HeaderSpacingBelowLastPara",
-                                         uno::Any(true));
-    m_pImpl->SetDocumentSettingsProperty("FrameAutowidthWithMorePara", 
uno::Any(true));
-    m_pImpl->SetDocumentSettingsProperty("FootnoteInColumnToPageEnd", 
uno::Any(true));
-    m_pImpl->SetDocumentSettingsProperty("TabAtLeftIndentForParagraphsInList", 
uno::Any(true));
-    m_pImpl->SetDocumentSettingsProperty("NoNumberingShowFollowBy", 
uno::Any(true));
+    if (m_pImpl->IsNewDoc())
+    {
+        // #i24363# tab stops relative to indent
+        m_pImpl->SetDocumentSettingsProperty(
+            getPropertyName(PROP_TABS_RELATIVE_TO_INDENT),
+            uno::Any(false));
+        m_pImpl->SetDocumentSettingsProperty(
+            getPropertyName(PROP_SURROUND_TEXT_WRAP_SMALL),
+            uno::Any(true));
+        m_pImpl->SetDocumentSettingsProperty(
+            getPropertyName(PROP_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING),
+            uno::Any(true));
+
+        // Don't load the default style definitions to avoid weird mix
+        m_pImpl->SetDocumentSettingsProperty("StylesNoDefault", 
uno::Any(true));
+        m_pImpl->SetDocumentSettingsProperty("MsWordCompTrailingBlanks", 
uno::Any(true));
+        m_pImpl->SetDocumentSettingsProperty("HeaderSpacingBelowLastPara",
+            uno::Any(true));
+        m_pImpl->SetDocumentSettingsProperty("FrameAutowidthWithMorePara", 
uno::Any(true));
+        m_pImpl->SetDocumentSettingsProperty("FootnoteInColumnToPageEnd", 
uno::Any(true));
+        
m_pImpl->SetDocumentSettingsProperty("TabAtLeftIndentForParagraphsInList", 
uno::Any(true));
+
+        // Enable only for new documents, since pasting from clipboard can 
influence existing doc
+        m_pImpl->SetDocumentSettingsProperty("NoNumberingShowFollowBy", 
uno::Any(true));
+    }
 
     // Initialize RDF metadata, to be able to add statements during the import.
     try

Reply via email to