LibreOffice Module vcl (master)  1
wmfexternal.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <vcl/wmfexternal.hxx>
21 #include <com/sun/star/beans/PropertyValue.hpp>
22 
23 // formally known as WMF_EXTERNALHEADER
25  xExt(0),
26  yExt(0),
27  mapMode(0)
28 {
29 }
30 
31 css::uno::Sequence< css::beans::PropertyValue > WmfExternal::getSequence() const
32 {
33  css::uno::Sequence< css::beans::PropertyValue > aSequence;
34 
35  if (0 != xExt || 0 != yExt || 0 != mapMode)
36  {
37  aSequence.realloc(3);
38  aSequence[0].Name = "Width";
39  aSequence[0].Value <<= static_cast<sal_Int16>(xExt);
40  aSequence[1].Name = "Height";
41  aSequence[1].Value <<= static_cast<sal_Int16>(yExt);
42  aSequence[2].Name = "MapMode";
43  aSequence[2].Value <<= static_cast<sal_Int16>(mapMode);
44  }
45 
46  return aSequence;
47 }
48 
49 bool WmfExternal::setSequence(const css::uno::Sequence< css::beans::PropertyValue >& rSequence)
50 {
51  bool bRetval(false);
52 
53  for (const auto& rPropVal : rSequence)
54  {
55  const OUString aName(rPropVal.Name);
56 
57  if (aName == "Width")
58  {
59  rPropVal.Value >>= xExt;
60  bRetval = true;
61  }
62  else if (aName == "Height")
63  {
64  rPropVal.Value >>= yExt;
65  bRetval = true;
66  }
67  else if (aName == "MapMode")
68  {
69  rPropVal.Value >>= mapMode;
70  bRetval = true;
71  }
72  }
73 
74  return bRetval;
75 }
76 
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 mapMode
One of the following values:
Definition: wmfexternal.hxx:47
bool setSequence(const css::uno::Sequence< css::beans::PropertyValue > &rSequence)
Definition: wmfexternal.cxx:49
css::uno::Sequence< css::beans::PropertyValue > getSequence() const
Definition: wmfexternal.cxx:31
sal_uInt16 xExt
Definition: wmfexternal.hxx:30
sal_uInt16 yExt
Definition: wmfexternal.hxx:31
OString const aName