1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WW8Picture.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <resources.hxx>
32 #include <WW8DocumentImpl.hxx>
34 namespace writerfilter
{
38 void WW8PICF::resolveNoAuto(Properties
& rHandler
)
40 WW8Stream::Pointer_t pStream
= getDocument()->getDataStream();
43 writerfilter::Reference
<Properties
>::Pointer_t pContent
;
44 if (getDocument()->isPicData())
46 WW8Value::Pointer_t pValue
= createValue(get_ffdata());
47 rHandler
.attribute(NS_rtf::LN_ffdata
, *pValue
);
51 WW8Value::Pointer_t pValue
= createValue(get_DffRecord());
52 rHandler
.attribute(NS_rtf::LN_DffRecord
, *pValue
);
57 writerfilter::Reference
<Properties
>::Pointer_t
58 WW8PICF::get_DffRecord()
60 writerfilter::Reference
<Properties
>::Pointer_t
61 pRet(new DffBlock(this, get_cbHeader(), getCount() - get_cbHeader(),
66 writerfilter::Reference
<Properties
>::Pointer_t
69 writerfilter::Reference
<Properties
>::Pointer_t
70 pRet(new WW8FFDATA(this, get_cbHeader(), getCount() - get_cbHeader()));
72 WW8StructBase::Pointer_t pStruct
73 (new WW8StructBase(this, get_cbHeader(),
74 getCount() - get_cbHeader()));
76 pStruct
->dump(output
);
81 writerfilter::Reference
<Properties
>::Pointer_t
84 return getDocument()->getShape(get_spid());
87 void WW8FFDATA::resolveNoAuto(Properties
& rHandler
)
89 WW8DocumentImpl
* pDocument
= getDocument();
91 if (pDocument
!= NULL
)
93 WW8FLD::Pointer_t pFLD
= pDocument
->getCurrentFLD();
94 WW8Value::Pointer_t pValue
= createValue(pFLD
->get_flt());
96 rHandler
.attribute(NS_rtf::LN_FLT
, *pValue
);
101 sal_uInt32
WW8FFDATA::get_FLT()
103 sal_uInt32 nResult
= 0;
105 WW8DocumentImpl
* pDocument
= getDocument();
107 if (pDocument
!= NULL
)
109 WW8FLD::Pointer_t pFLD
= pDocument
->getCurrentFLD();
111 if (pFLD
.get() != NULL
)
112 nResult
= pFLD
->get_flt();
118 static sal_uInt32
lcl_FFDATA_default_offset(WW8FFDATA
& rRef
)
120 return 0xa + (rRef
.getU16(0xa) + 2) * 2;
123 static sal_uInt32
lcl_FFDATA_formatting_offset(WW8FFDATA
& rRef
)
125 sal_uInt32 nResult
= lcl_FFDATA_default_offset(rRef
);
127 switch (rRef
.get_FLT())
129 case 71: // forms checkbox
130 case 83: // forms listbox
134 nResult
+= (rRef
.getU16(nResult
) + 2) * 2;
141 static sal_uInt32
lcl_FFDATA_help_offset(WW8FFDATA
& rRef
)
143 sal_uInt32 nResult
= lcl_FFDATA_formatting_offset(rRef
);
145 nResult
+= (rRef
.getU16(nResult
) + 2) * 2;
150 static sal_uInt32
lcl_FFDATA_tooltip_offset(WW8FFDATA
& rRef
)
152 sal_uInt32 nResult
= lcl_FFDATA_help_offset(rRef
);
154 nResult
+= (rRef
.getU16(nResult
) + 2) * 2;
159 rtl::OUString
WW8FFDATA::get_default()
161 rtl::OUString sResult
;
163 sal_uInt32 nOffset
= lcl_FFDATA_default_offset(*this);
167 sResult
= getString(nOffset
);
177 rtl::OUString
WW8FFDATA::get_formatting()
179 return getString(lcl_FFDATA_formatting_offset(*this));
182 rtl::OUString
WW8FFDATA::get_help()
184 return getString(lcl_FFDATA_help_offset(*this));
187 rtl::OUString
WW8FFDATA::get_tooltip()
189 rtl::OUString sResult
;
191 sResult
= getString(lcl_FFDATA_tooltip_offset(*this));
196 sal_uInt16
WW8FFDATA::get_checked()
198 sal_uInt16 nResult
= 0;
203 nResult
= getU16(lcl_FFDATA_default_offset(*this));