Kaydet (Commit) 773b12b7 authored tarafından Miklos Vajna's avatar Miklos Vajna

SwView::WriteUserDataSequence: use comphelper::makePropertyValue()

Change-Id: Ibdb99942ee6c022abad74df93ebfb99c4ce6567f
üst e95db186
...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <svl/cjkoptions.hxx> #include <svl/cjkoptions.hxx>
#include <comphelper/propertyvalue.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
...@@ -1451,73 +1452,44 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue > ...@@ -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 ) void SwView::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue >& rSequence, bool bBrowse )
{ {
const SwRect& rRect = m_pWrtShell->GetCharRect(); const SwRect& rRect = m_pWrtShell->GetCharRect();
const Rectangle& rVis = GetVisArea(); const Rectangle& rVis = GetVisArea();
rSequence.realloc ( NUM_VIEW_SETTINGS ); std::vector<beans::PropertyValue> aVector;
sal_Int16 nIndex = 0;
beans::PropertyValue *pValue = rSequence.getArray();
sal_uInt16 nViewID( GetViewFrame()->GetCurViewId()); sal_uInt16 nViewID( GetViewFrame()->GetCurViewId());
pValue->Name = "ViewId";
OUStringBuffer sBuffer ( OUString( "view" ) ); OUStringBuffer sBuffer ( OUString( "view" ) );
::sax::Converter::convertNumber(sBuffer, static_cast<sal_Int32>(nViewID)); ::sax::Converter::convertNumber(sBuffer, static_cast<sal_Int32>(nViewID));
pValue->Value <<= sBuffer.makeStringAndClear(); aVector.push_back(comphelper::makePropertyValue("ViewId", sBuffer.makeStringAndClear()));
pValue++;nIndex++;
pValue->Name = "ViewLeft"; aVector.push_back(comphelper::makePropertyValue("ViewLeft", convertTwipToMm100 ( rRect.Left() )));
pValue->Value <<= convertTwipToMm100 ( rRect.Left() );
pValue++;nIndex++;
pValue->Name = "ViewTop"; aVector.push_back(comphelper::makePropertyValue("ViewTop", convertTwipToMm100 ( rRect.Top() )));
pValue->Value <<= convertTwipToMm100 ( rRect.Top() );
pValue++;nIndex++;
pValue->Name = "VisibleLeft"; aVector.push_back(comphelper::makePropertyValue("VisibleLeft", convertTwipToMm100 ( rVis.Left() )));
pValue->Value <<= convertTwipToMm100 ( rVis.Left() );
pValue++;nIndex++;
pValue->Name = "VisibleTop"; aVector.push_back(comphelper::makePropertyValue("VisibleTop", convertTwipToMm100 ( rVis.Top() )));
pValue->Value <<= convertTwipToMm100 ( rVis.Top() );
pValue++;nIndex++;
pValue->Name = "VisibleRight"; aVector.push_back(comphelper::makePropertyValue("VisibleRight", convertTwipToMm100 ( bBrowse ? LONG_MIN : rVis.Right() )));
pValue->Value <<= convertTwipToMm100 ( bBrowse ? LONG_MIN : rVis.Right() );
pValue++;nIndex++;
pValue->Name = "VisibleBottom"; aVector.push_back(comphelper::makePropertyValue("VisibleBottom", convertTwipToMm100 ( bBrowse ? LONG_MIN : rVis.Bottom() )));
pValue->Value <<= convertTwipToMm100 ( bBrowse ? LONG_MIN : rVis.Bottom() );
pValue++;nIndex++;
pValue->Name = "ZoomType";
const sal_Int16 nZoomType = static_cast< sal_Int16 >(m_pWrtShell->GetViewOptions()->GetZoomType()); const sal_Int16 nZoomType = static_cast< sal_Int16 >(m_pWrtShell->GetViewOptions()->GetZoomType());
pValue->Value <<= nZoomType; aVector.push_back(comphelper::makePropertyValue("ZoomType", nZoomType));
pValue++;nIndex++;
pValue->Name = "ViewLayoutColumns";
const sal_Int16 nViewLayoutColumns = static_cast< sal_Int16 >(m_pWrtShell->GetViewOptions()->GetViewLayoutColumns()); const sal_Int16 nViewLayoutColumns = static_cast< sal_Int16 >(m_pWrtShell->GetViewOptions()->GetViewLayoutColumns());
pValue->Value <<= nViewLayoutColumns; aVector.push_back(comphelper::makePropertyValue("ViewLayoutColumns", nViewLayoutColumns));
pValue++;nIndex++;
pValue->Name = "ViewLayoutBookMode"; aVector.push_back(comphelper::makePropertyValue("ViewLayoutBookMode", m_pWrtShell->GetViewOptions()->IsViewLayoutBookMode()));
pValue->Value <<= m_pWrtShell->GetViewOptions()->IsViewLayoutBookMode();
pValue++;nIndex++;
pValue->Name = "ZoomFactor"; aVector.push_back(comphelper::makePropertyValue("ZoomFactor", static_cast < sal_Int16 > (m_pWrtShell->GetViewOptions()->GetZoom())));
pValue->Value <<= static_cast < sal_Int16 > (m_pWrtShell->GetViewOptions()->GetZoom());
pValue++;nIndex++;
pValue->Name = "IsSelectedFrame"; aVector.push_back(comphelper::makePropertyValue("IsSelectedFrame", FrameTypeFlags::NONE != m_pWrtShell->GetSelFrameType()));
pValue->Value <<= FrameTypeFlags::NONE != m_pWrtShell->GetSelFrameType();
nIndex++;
assert(nIndex == NUM_VIEW_SETTINGS); rSequence = comphelper::containerToSequence(aVector);
(void)nIndex;
} }
#undef NUM_VIEW_SETTINGS
void SwView::ShowCursor( bool bOn ) void SwView::ShowCursor( bool bOn )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment