1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <doctok/resources.hxx>
21 #include <WW8DocumentImpl.hxx>
23 namespace writerfilter
{
27 void WW8PICF::resolveNoAuto(Properties
& rHandler
)
29 WW8Stream::Pointer_t pStream
= getDocument()->getDataStream();
32 writerfilter::Reference
<Properties
>::Pointer_t pContent
;
33 if (getDocument()->isPicData())
35 WW8Value::Pointer_t pValue
= createValue(get_ffdata());
36 rHandler
.attribute(NS_rtf::LN_ffdata
, *pValue
);
40 WW8Value::Pointer_t pValue
= createValue(get_DffRecord());
41 rHandler
.attribute(NS_rtf::LN_DffRecord
, *pValue
);
46 writerfilter::Reference
<Properties
>::Pointer_t
47 WW8PICF::get_DffRecord()
49 writerfilter::Reference
<Properties
>::Pointer_t
50 pRet(new DffBlock(this, get_cbHeader(), getCount() - get_cbHeader(),
55 writerfilter::Reference
<Properties
>::Pointer_t
58 writerfilter::Reference
<Properties
>::Pointer_t
59 pRet(new WW8FFDATA(this, get_cbHeader(), getCount() - get_cbHeader()));
61 WW8StructBase::Pointer_t pStruct
62 (new WW8StructBase(this, get_cbHeader(),
63 getCount() - get_cbHeader()));
65 pStruct
->dump(output
);
70 writerfilter::Reference
<Properties
>::Pointer_t
73 return getDocument()->getShape(get_spid());
76 void WW8FFDATA::resolveNoAuto(Properties
& rHandler
)
78 WW8DocumentImpl
* pDocument
= getDocument();
80 if (pDocument
!= NULL
)
82 WW8FLD::Pointer_t pFLD
= pDocument
->getCurrentFLD();
83 WW8Value::Pointer_t pValue
= createValue(pFLD
->get_flt());
85 rHandler
.attribute(NS_rtf::LN_FLT
, *pValue
);
90 sal_uInt32
WW8FFDATA::get_FLT()
92 sal_uInt32 nResult
= 0;
94 WW8DocumentImpl
* pDocument
= getDocument();
96 if (pDocument
!= NULL
)
98 WW8FLD::Pointer_t pFLD
= pDocument
->getCurrentFLD();
100 if (pFLD
.get() != NULL
)
101 nResult
= pFLD
->get_flt();
107 static sal_uInt32
lcl_FFDATA_default_offset(WW8FFDATA
& rRef
)
109 return 0xa + (rRef
.getU16(0xa) + 2) * 2;
112 static sal_uInt32
lcl_FFDATA_formatting_offset(WW8FFDATA
& rRef
)
114 sal_uInt32 nResult
= lcl_FFDATA_default_offset(rRef
);
116 switch (rRef
.get_FLT())
118 case 71: // forms checkbox
119 case 83: // forms listbox
123 nResult
+= (rRef
.getU16(nResult
) + 2) * 2;
130 static sal_uInt32
lcl_FFDATA_help_offset(WW8FFDATA
& rRef
)
132 sal_uInt32 nResult
= lcl_FFDATA_formatting_offset(rRef
);
134 nResult
+= (rRef
.getU16(nResult
) + 2) * 2;
139 static sal_uInt32
lcl_FFDATA_tooltip_offset(WW8FFDATA
& rRef
)
141 sal_uInt32 nResult
= lcl_FFDATA_help_offset(rRef
);
143 nResult
+= (rRef
.getU16(nResult
) + 2) * 2;
148 OUString
WW8FFDATA::get_default()
152 sal_uInt32 nOffset
= lcl_FFDATA_default_offset(*this);
156 sResult
= getString(nOffset
);
166 OUString
WW8FFDATA::get_formatting()
168 return getString(lcl_FFDATA_formatting_offset(*this));
171 OUString
WW8FFDATA::get_help()
173 return getString(lcl_FFDATA_help_offset(*this));
176 OUString
WW8FFDATA::get_tooltip()
180 sResult
= getString(lcl_FFDATA_tooltip_offset(*this));
185 sal_uInt16
WW8FFDATA::get_checked()
187 sal_uInt16 nResult
= 0;
192 nResult
= getU16(lcl_FFDATA_default_offset(*this));
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */