sw/qa/extras/ooxmlimport/ooxmlimport.cxx          |   10 +++++---
 sw/source/uibase/uiview/view.cxx                  |   20 +++++++---------
 sw/source/uibase/uno/SwXDocumentSettings.cxx      |   16 -------------
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   27 +++++++++++-----------
 4 files changed, 30 insertions(+), 43 deletions(-)

New commits:
commit 2dce8dd41c208ecda40c054635f3736147ec8914
Author: Michael Stahl <mst...@redhat.com>
Date:   Wed Jan 18 18:25:46 2017 +0100

    tdf#99074 sw: remove duplicate property "IsBrowseMode" again
    
    Commit e0f9bb795251d950b5dd960fcd030170c8eb67aa added the property
    "IsBrowseMode" to SwXDocumentSettings, but it is already available in
    the API as SwXViewSettings property "ShowOnlineLayout".
    
    The problem is that both of these properties get exported in ODF into
    settings.xml, so it contains "IsBrowseMode" twice.
    
    Unfortunately the SwXViewSettings are not available in writerfilter,
    because the XModel::getCurrentController() is null, the view is created
    after the import.
    
    But there is already a way to store ViewData in the SfxBaseModel, which
    is then used by SfxBaseController::ConnectSfxFrame_Impl() when creating
    the view.  This applies the property at just the right time.
    
    Change-Id: I842845d09a7b3fe81e27a1ed8ac8a8594da7f4e8

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 97a0991..786c686 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -46,6 +46,7 @@
 #include <com/sun/star/text/SizeType.hpp>
 #include <com/sun/star/style/PageStyleLayout.hpp>
 #include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/view/XViewSettingsSupplier.hpp>
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/document/XImporter.hpp>
 #include <vcl/bitmapaccess.hxx>
@@ -1321,10 +1322,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf98882, "tdf98882.docx")
 
 DECLARE_OOXMLIMPORT_TEST(testTdf99074, "tdf99074.docx")
 {
-    uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, 
uno::UNO_QUERY);
-    uno::Reference<uno::XInterface> xSettings = 
xFactory->createInstance("com.sun.star.document.Settings");
+    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+    uno::Reference<view::XViewSettingsSupplier> const xController(
+        xModel->getCurrentController(), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> const xViewSettings(
+        xController->getViewSettings());
     // This was false, Web Layout was ignored on import.
-    CPPUNIT_ASSERT(getProperty<bool>(xSettings, "InBrowseMode"));
+    CPPUNIT_ASSERT(getProperty<bool>(xViewSettings, "ShowOnlineLayout"));
 }
 
 DECLARE_OOXMLIMPORT_TEST(testTdf100830, "tdf100830.docx")
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 53baef3..f01a65f 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1264,7 +1264,8 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < 
beans::PropertyValue >
                  bGotVisibleTop = false, bGotVisibleRight = false,
                  bGotVisibleBottom = false, bGotZoomType = false,
                  bGotZoomFactor = false, bGotIsSelectedFrame = false,
-                 bGotViewLayoutColumns = false, bGotViewLayoutBookMode = false;
+                 bGotViewLayoutColumns = false, bGotViewLayoutBookMode = false,
+                 bBrowseMode = false, bGotBrowseMode = false;
 
         for (sal_Int32 i = 0 ; i < nLength; i++)
         {
@@ -1327,10 +1328,20 @@ void SwView::ReadUserDataSequence ( const uno::Sequence 
< beans::PropertyValue >
                pValue->Value >>= bSelectedFrame;
                bGotIsSelectedFrame = true;
             }
+            else if (pValue->Name == "ShowOnlineLayout")
+            {
+               pValue->Value >>= bBrowseMode;
+               bGotBrowseMode = true;
+            }
             // Fallback to common SdrModel processing
             else 
GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->ReadUserDataSequenceValue(pValue);
             pValue++;
         }
+        if (bGotBrowseMode)
+        {
+            // delegate further
+            
GetViewImpl()->GetUNOObject_Impl()->getViewSettings()->setPropertyValue("ShowOnlineLayout",
 uno::Any(bBrowseMode));
+        }
         if (bGotVisibleBottom)
         {
             Point aCursorPos( nX, nY );
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx 
b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index f11fae73c..b369e98 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -136,7 +136,6 @@ enum SwDocumentSettingsPropertyHandles
     HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
     HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,
     HANDLE_SUBTRACT_FLYS,
-    HANDLE_BROWSE_MODE,
 };
 
 static MasterPropertySetInfo * lcl_createSettingsInfo()
@@ -213,7 +212,6 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
         { OUString("ApplyParagraphMarkFormatToNumbering"), 
HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType<bool>::get(), 0},
         { OUString("PropLineSpacingShrinksFirstLine"),       
HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE,         
cppu::UnoType<bool>::get(),           0},
         { OUString("SubtractFlysAnchoredAtFlys"),       HANDLE_SUBTRACT_FLYS,  
       cppu::UnoType<bool>::get(),           0},
-        { OUString("InBrowseMode"), HANDLE_BROWSE_MODE, 
cppu::UnoType<bool>::get(), 0},
 /*
  * As OS said, we don't have a view when we need to set this, so I have to
  * find another solution before adding them to this property set - MTG
@@ -865,15 +863,6 @@ void SwXDocumentSettings::_setSingleValue( const 
comphelper::PropertyInfo & rInf
             }
         }
         break;
-        case HANDLE_BROWSE_MODE:
-        {
-            bool bTmp;
-            if (rValue >>= bTmp)
-            {
-                
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, bTmp);
-            }
-        }
-        break;
         default:
             throw UnknownPropertyException();
     }
@@ -1288,11 +1277,6 @@ void SwXDocumentSettings::_getSingleValue( const 
comphelper::PropertyInfo & rInf
             rValue <<= 
mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::SUBTRACT_FLYS);
         }
         break;
-        case HANDLE_BROWSE_MODE:
-        {
-            rValue <<= 
mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE);
-        }
-        break;
         default:
             throw UnknownPropertyException();
     }
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index dca9bfc..f82e45c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -67,6 +67,7 @@
 #include <com/sun/star/drawing/XControlShape.hpp>
 #include <com/sun/star/text/ControlCharacter.hpp>
 #include <com/sun/star/text/XTextColumns.hpp>
+
 #include <oox/mathml/import.hxx>
 #include <rtl/uri.hxx>
 #include <GraphicHelpers.hxx>
@@ -5058,18 +5059,21 @@ void DomainMapper_Impl::ApplySettingsTable()
                 
xTextDefaults->setPropertyValue(getPropertyName(PROP_PARA_LINE_SPACING), 
uno::makeAny(aSpacing));
             }
 
-            if (m_pSettingsTable->GetZoomFactor())
+            if (m_pSettingsTable->GetZoomFactor() || 
m_pSettingsTable->GetView())
             {
-                uno::Sequence<beans::PropertyValue> aViewProps(3);
-                aViewProps[0].Name = "ZoomFactor";
-                aViewProps[0].Value <<= m_pSettingsTable->GetZoomFactor();
-                aViewProps[1].Name = "VisibleBottom";
-                aViewProps[1].Value <<= sal_Int32(0);
-                aViewProps[2].Name = "ZoomType";
-                aViewProps[2].Value <<= sal_Int16(0);
-
+                std::vector<beans::PropertyValue> aViewProps;
+                if (m_pSettingsTable->GetZoomFactor())
+                {
+                    aViewProps.push_back(beans::PropertyValue("ZoomFactor", 
-1, uno::makeAny(m_pSettingsTable->GetZoomFactor()), 
beans::PropertyState_DIRECT_VALUE));
+                    aViewProps.push_back(beans::PropertyValue("VisibleBottom", 
-1, uno::makeAny(sal_Int32(0)), beans::PropertyState_DIRECT_VALUE));
+                    aViewProps.push_back(beans::PropertyValue("ZoomType", -1, 
uno::makeAny(sal_Int16(0)), beans::PropertyState_DIRECT_VALUE));
+                }
+                if (m_pSettingsTable->GetView())
+                {
+                    
aViewProps.push_back(beans::PropertyValue("ShowOnlineLayout", -1, 
uno::makeAny(m_pSettingsTable->GetView() == 
NS_ooxml::LN_Value_doc_ST_View_web), beans::PropertyState_DIRECT_VALUE));
+                }
                 uno::Reference<container::XIndexContainer> xBox = 
document::IndexedPropertyValues::create(m_xComponentContext);
-                xBox->insertByIndex(sal_Int32(0), uno::makeAny(aViewProps));
+                xBox->insertByIndex(sal_Int32(0), 
uno::makeAny(comphelper::containerToSequence(aViewProps)));
                 uno::Reference<container::XIndexAccess> xIndexAccess(xBox, 
uno::UNO_QUERY);
                 uno::Reference<document::XViewDataSupplier> 
xViewDataSupplier(m_xTextDocument, uno::UNO_QUERY);
                 xViewDataSupplier->setViewData(xIndexAccess);
@@ -5083,9 +5087,6 @@ void DomainMapper_Impl::ApplySettingsTable()
             if( m_pSettingsTable->GetEmbedSystemFonts())
                 xSettings->setPropertyValue( getPropertyName( 
PROP_EMBED_SYSTEM_FONTS ), uno::makeAny(true) );
             xSettings->setPropertyValue("AddParaTableSpacing", 
uno::makeAny(m_pSettingsTable->GetDoNotUseHTMLParagraphAutoSpacing()));
-            // Web Layout.
-            if (m_pSettingsTable->GetView() == 
NS_ooxml::LN_Value_doc_ST_View_web)
-                xSettings->setPropertyValue("InBrowseMode", 
uno::makeAny(true));
             if( m_pSettingsTable->GetProtectForm() )
                 xSettings->setPropertyValue("ProtectForm", uno::makeAny( true 
));
         }
commit 7667675397c98bb38cdd14dd689a32e9f8a986d3
Author: Michael Stahl <mst...@redhat.com>
Date:   Wed Jan 18 15:54:47 2017 +0100

    sw: remove duplicate "MsWordCompTrailingBlanks" view setting
    
    This is already a document setting, no point in writing it twice into
    settings.xml.
    
    Change-Id: Idcc99a194df321e11e091a2388b919e11fe94316

diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index aec3bc0..53baef3 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1260,13 +1260,11 @@ void SwView::ReadUserDataSequence ( const uno::Sequence 
< beans::PropertyValue >
         sal_Int16 nViewLayoutColumns = pVOpt->GetViewLayoutColumns();
 
         bool bSelectedFrame = ( m_pWrtShell->GetSelFrameType() != 
FrameTypeFlags::NONE ),
-             bMsWordCompTrailingBlanks = false,
                  bGotVisibleLeft = false,
                  bGotVisibleTop = false, bGotVisibleRight = false,
                  bGotVisibleBottom = false, bGotZoomType = false,
                  bGotZoomFactor = false, bGotIsSelectedFrame = false,
-                 bGotViewLayoutColumns = false, bGotViewLayoutBookMode = false,
-                 bGotMsWordCompTrailingBlanks = false;
+                 bGotViewLayoutColumns = false, bGotViewLayoutBookMode = false;
 
         for (sal_Int32 i = 0 ; i < nLength; i++)
         {
@@ -1329,11 +1327,6 @@ void SwView::ReadUserDataSequence ( const uno::Sequence 
< beans::PropertyValue >
                pValue->Value >>= bSelectedFrame;
                bGotIsSelectedFrame = true;
             }
-            else if ( pValue->Name == "MsWordCompTrailingBlanks" )
-            {
-                pValue->Value >>= bMsWordCompTrailingBlanks;
-                bGotMsWordCompTrailingBlanks = true;
-            }
             // Fallback to common SdrModel processing
             else 
GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->ReadUserDataSequenceValue(pValue);
             pValue++;
@@ -1460,10 +1453,6 @@ void SwView::ReadUserDataSequence ( const uno::Sequence 
< beans::PropertyValue >
                 m_pWrtShell->EnableSmooth( true );
             }
         }
-        if ( bGotMsWordCompTrailingBlanks )
-        {
-            GetDocShell()->GetDoc()->getIDocumentSettingAccess().set( 
DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS, bMsWordCompTrailingBlanks );
-        }
     }
 }
 
@@ -1503,8 +1492,6 @@ void SwView::WriteUserDataSequence ( uno::Sequence < 
beans::PropertyValue >& rSe
 
     aVector.push_back(comphelper::makePropertyValue("IsSelectedFrame", 
FrameTypeFlags::NONE != m_pWrtShell->GetSelFrameType()));
 
-    
aVector.push_back(comphelper::makePropertyValue("MsWordCompTrailingBlanks", 
GetDocShell()->GetDoc()->getIDocumentSettingAccess().get( 
DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS )));
-
     rSequence = comphelper::containerToSequence(aVector);
 
     // Common SdrModel processing
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to