[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Feb 15 08:06:47 UTC 2016


 sw/source/uibase/uiview/view.cxx |   58 ++++++++++-----------------------------
 1 file changed, 15 insertions(+), 43 deletions(-)

New commits:
commit 773b12b72dc3b0c8966097d2bc75205c0c4364b5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Feb 15 09:05:26 2016 +0100

    SwView::WriteUserDataSequence: use comphelper::makePropertyValue()
    
    Change-Id: Ibdb99942ee6c022abad74df93ebfb99c4ce6567f

diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 17256a5..78531dc 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -112,6 +112,7 @@
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 
 #include <svl/cjkoptions.hxx>
+#include <comphelper/propertyvalue.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -1451,73 +1452,44 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >
     }
 }
 
-#define NUM_VIEW_SETTINGS 12
 void SwView::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue >& rSequence, bool bBrowse )
 {
     const SwRect& rRect = m_pWrtShell->GetCharRect();
     const Rectangle& rVis = GetVisArea();
 
-    rSequence.realloc ( NUM_VIEW_SETTINGS );
-    sal_Int16 nIndex = 0;
-    beans::PropertyValue *pValue = rSequence.getArray();
+    std::vector<beans::PropertyValue> aVector;
 
     sal_uInt16 nViewID( GetViewFrame()->GetCurViewId());
-    pValue->Name = "ViewId";
     OUStringBuffer sBuffer ( OUString( "view" ) );
     ::sax::Converter::convertNumber(sBuffer, static_cast<sal_Int32>(nViewID));
-    pValue->Value <<= sBuffer.makeStringAndClear();
-    pValue++;nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("ViewId", sBuffer.makeStringAndClear()));
 
-    pValue->Name = "ViewLeft";
-    pValue->Value <<= convertTwipToMm100 ( rRect.Left() );
-    pValue++;nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("ViewLeft", convertTwipToMm100 ( rRect.Left() )));
 
-    pValue->Name = "ViewTop";
-    pValue->Value <<= convertTwipToMm100 ( rRect.Top() );
-    pValue++;nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("ViewTop", convertTwipToMm100 ( rRect.Top() )));
 
-    pValue->Name = "VisibleLeft";
-    pValue->Value <<= convertTwipToMm100 ( rVis.Left() );
-    pValue++;nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("VisibleLeft", convertTwipToMm100 ( rVis.Left() )));
 
-    pValue->Name = "VisibleTop";
-    pValue->Value <<= convertTwipToMm100 ( rVis.Top() );
-    pValue++;nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("VisibleTop", convertTwipToMm100 ( rVis.Top() )));
 
-    pValue->Name = "VisibleRight";
-    pValue->Value <<= convertTwipToMm100 ( bBrowse ? LONG_MIN : rVis.Right() );
-    pValue++;nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("VisibleRight", convertTwipToMm100 ( bBrowse ? LONG_MIN : rVis.Right() )));
 
-    pValue->Name = "VisibleBottom";
-    pValue->Value <<= convertTwipToMm100 ( bBrowse ? LONG_MIN : rVis.Bottom() );
-    pValue++;nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("VisibleBottom", convertTwipToMm100 ( bBrowse ? LONG_MIN : rVis.Bottom() )));
 
-    pValue->Name = "ZoomType";
     const sal_Int16 nZoomType = static_cast< sal_Int16 >(m_pWrtShell->GetViewOptions()->GetZoomType());
-    pValue->Value <<= nZoomType;
-    pValue++;nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("ZoomType", nZoomType));
 
-    pValue->Name = "ViewLayoutColumns";
     const sal_Int16 nViewLayoutColumns = static_cast< sal_Int16 >(m_pWrtShell->GetViewOptions()->GetViewLayoutColumns());
-    pValue->Value <<= nViewLayoutColumns;
-    pValue++;nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("ViewLayoutColumns", nViewLayoutColumns));
 
-    pValue->Name = "ViewLayoutBookMode";
-    pValue->Value <<= m_pWrtShell->GetViewOptions()->IsViewLayoutBookMode();
-    pValue++;nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("ViewLayoutBookMode", m_pWrtShell->GetViewOptions()->IsViewLayoutBookMode()));
 
-    pValue->Name = "ZoomFactor";
-    pValue->Value <<= static_cast < sal_Int16 > (m_pWrtShell->GetViewOptions()->GetZoom());
-    pValue++;nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("ZoomFactor", static_cast < sal_Int16 > (m_pWrtShell->GetViewOptions()->GetZoom())));
 
-    pValue->Name = "IsSelectedFrame";
-    pValue->Value <<= FrameTypeFlags::NONE != m_pWrtShell->GetSelFrameType();
-    nIndex++;
+    aVector.push_back(comphelper::makePropertyValue("IsSelectedFrame", FrameTypeFlags::NONE != m_pWrtShell->GetSelFrameType()));
 
-    assert(nIndex == NUM_VIEW_SETTINGS);
-    (void)nIndex;
+    rSequence = comphelper::containerToSequence(aVector);
 }
-#undef NUM_VIEW_SETTINGS
 
 void SwView::ShowCursor( bool bOn )
 {


More information about the Libreoffice-commits mailing list