summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-01-18 18:25:46 +0100
committerAndras Timar <andras.timar@collabora.com>2017-02-08 11:56:05 +0100
commit99eb937edce92299b42927f2fbeb846e1cfeb3c5 (patch)
treeee1bd0105933c7d9ceea6cf235aa7a01b24c35cb /sw
parent12ec1061aa22b595c730b65a7f8e2d42f8fc8b5b (diff)
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. (cherry picked from commit 2dce8dd41c208ecda40c054635f3736147ec8914) Change-Id: I842845d09a7b3fe81e27a1ed8ac8a8594da7f4e8 Reviewed-on: https://gerrit.libreoffice.org/33285 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 8c940adc98ed9e5844506d5b66a0cdf57f9e1e7c)
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx10
-rw-r--r--sw/source/uibase/uiview/view.cxx13
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx16
3 files changed, 19 insertions, 20 deletions
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 85e3b204aa60..4c3d0f18a025 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -65,6 +65,7 @@
#include <com/sun/star/style/CaseMap.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>
@@ -3256,10 +3257,13 @@ DECLARE_SW_IMPORT_TEST(testHFLinkToPrev, "headerfooter-link-to-prev.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(testTdf103664, "tdf103664.docx")
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index e95ac2e38415..8b2556baebd7 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1268,7 +1268,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++)
{
@@ -1331,8 +1332,18 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >
pValue->Value >>= bSelectedFrame;
bGotIsSelectedFrame = true;
}
+ else if (pValue->Name == "ShowOnlineLayout")
+ {
+ pValue->Value >>= bBrowseMode;
+ bGotBrowseMode = true;
+ }
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 6b020354e19e..962eaebfecfc 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -132,7 +132,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()
@@ -208,7 +207,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
@@ -855,15 +853,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();
}
@@ -1273,11 +1262,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();
}