LibreOffice Module lotuswordpro (master) 1
lwpnotes.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
6 *
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
9 *
10 * Sun Microsystems Inc., October, 2000
11 *
12 * GNU Lesser General Public License Version 2.1
13 * =============================================
14 * Copyright 2000 by Sun Microsystems, Inc.
15 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License version 2.1, as published by the Free Software Foundation.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 *
31 *
32 * Sun Industry Standards Source License Version 1.1
33 * =================================================
34 * The contents of this file are subject to the Sun Industry Standards
35 * Source License Version 1.1 (the "License"); You may not use this file
36 * except in compliance with the License. You may obtain a copy of the
37 * License at http://www.openoffice.org/license.html.
38 *
39 * Software provided under this License is provided on an "AS IS" basis,
40 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 * See the License for the specific provisions governing your rights and
44 * obligations concerning the Software.
45 *
46 * The Initial Developer of the Original Code is: IBM Corporation
47 *
48 * Copyright: 2008 by IBM Corporation
49 *
50 * All Rights Reserved.
51 *
52 * Contributor(s): _______________________________________
53 *
54 *
55 ************************************************************************/
61#include "lwpnotes.hxx"
62#include "lwppara.hxx"
65#include <localtime.hxx>
66#include <lwptools.hxx>
67
69 : LwpFrib(pPara)
70{
71}
72
76void LwpFribNote::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
77{
78 m_Layout.ReadIndexed(pObjStrm);
79}
80
85{
87 if (pLayout.is())
88 {
89 //register font style
91 //register foonote style
92 pLayout->SetFoundry(m_pPara->GetFoundry());
93 pLayout->DoRegisterStyle();
94 }
95}
96
101{
102 LwpNoteLayout* pLayout = dynamic_cast<LwpNoteLayout*>(m_Layout.obj().get());
103 if (!pLayout)
104 return;
105
106 XFAnnotation* pXFNote = new XFAnnotation;
107 pXFNote->SetAuthor(pLayout->GetAuthor());
108 LtTm aTm;
109 tools::Long nTime = pLayout->GetTime();
110 if (LtgLocalTime(nTime, aTm))
111 {
113 }
114
115 pLayout->XFConvert(pXFNote);
116 if (m_pModifiers)
117 {
118 XFTextSpan* pSpan = new XFTextSpan();
119 pSpan->SetStyleName(GetStyleName());
120 pSpan->Add(pXFNote);
121 pCont->Add(pSpan);
122 }
123 else
124 {
125 pCont->Add(pXFNote);
126 }
127}
128
130 : LwpFrameLayout(objHdr, pStrm)
131 , m_nTime(0)
132{
133}
134
136
142{
144
145 m_nTime = m_pObjStrm->QuickReaduInt32();
147
148 LwpAtomHolder aUserInitials;
149 aUserInitials.Read(m_pObjStrm.get());
150
151 LwpColor aColor;
152 aColor.Read(m_pObjStrm.get());
153
154 // vacant note sequence
155 m_pObjStrm->QuickReadInt32();
156
157 m_pObjStrm->SkipExtra();
158}
159
164{
165 LwpVirtualLayout* pTextLayout = GetTextLayout();
166 if (pTextLayout)
167 {
168 pTextLayout->SetFoundry(GetFoundry());
169 pTextLayout->DoRegisterStyle();
170 }
171}
172
177{
178 LwpVirtualLayout* pTextLayout = GetTextLayout();
179 if (pTextLayout)
180 {
181 pTextLayout->DoXFConvert(pCont);
182 }
183}
184
189{
191 if (pLayout)
192 {
193 return pLayout->FindChildByType(LWP_NOTETEXT_LAYOUT);
194 }
195
196 return nullptr;
197}
202{
203 if (m_UserName.HasValue())
204 {
205 if (m_UserName.str() != " ")
206 {
207 return m_UserName.str();
208 }
209 }
210 //if username is null or writerspace, get username from noteheaderlayout
211 LwpNoteHeaderLayout* pTextLayout
213 if (pTextLayout)
214 {
215 LwpStory* pStory = dynamic_cast<LwpStory*>(pTextLayout->GetContent().obj().get());
216 if (pStory)
217 {
218 LwpPara* pFirst = dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
219 if (pFirst)
220 return pFirst->GetContentText(true);
221 }
222 }
223
224 return m_UserName.str();
225}
226
228 : LwpFrameLayout(objHdr, pStrm)
229{
230}
231
233
239{
241 m_pObjStrm->SkipExtra();
242}
243
245
247
249 : LwpFrameLayout(objHdr, pStrm)
250{
251}
252
254
260{
262 m_pObjStrm->SkipExtra();
263}
264
269{
271 if (pContent.is())
272 {
273 pContent->SetFoundry(GetFoundry());
274 pContent->DoRegisterStyle();
275 }
276}
277
279{
281 if (pContent.is())
282 {
283 pContent->DoXFConvert(pCont);
284 }
285}
286
288 : LwpPlacableLayout(objHdr, pStrm)
289{
290}
291
293
299{
301 m_pObjStrm->SkipExtra();
302}
303
305
307
308/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AtomHolder class of Word Pro to hold a string.
void Read(LwpObjectStream *pStrm)
@descr read atomholder from object stream the default encoding used in Word Pro is 1252
bool HasValue() const
const OUString & str() const
lwpcolor class (red, green, blue, extra)
Definition: lwpcolor.hxx:71
void Read(LwpObjectStream *pStrm)
@descr read color and then resolve the RGB values
Definition: lwpcolor.cxx:74
VO_FRAMELAYOUT object.
void Read() override
@descr read frame layout object
void XFConvert(XFContentContainer *pCont)
@descr convert note
Definition: lwpnotes.cxx:100
void Read(LwpObjectStream *pObjStrm, sal_uInt16 len) override
@descr read frib information
Definition: lwpnotes.cxx:76
void RegisterNewStyle()
@descr Register style
Definition: lwpnotes.cxx:84
LwpFribNote(LwpPara *pPara)
Definition: lwpnotes.cxx:68
LwpObjectID m_Layout
Definition: lwpnotes.hxx:80
const OUString & GetStyleName() const
Definition: lwpfrib.hxx:112
LwpPara * m_pPara
Definition: lwpfrib.hxx:104
virtual void RegisterStyle(LwpFoundry *pFoundry)
Definition: lwpfrib.cxx:223
std::unique_ptr< ModifierInfo > m_pModifiers
Definition: lwpfrib.hxx:107
LwpObjectID & GetContent()
Definition: lwplayout.hxx:415
LwpObjectID m_Content
Definition: lwplayout.hxx:401
VO_NOTEHEADERLAYOUT object.
Definition: lwpnotes.hxx:111
LwpNoteHeaderLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
Definition: lwpnotes.cxx:227
virtual ~LwpNoteHeaderLayout() override
Definition: lwpnotes.cxx:232
virtual void RegisterStyle() override
@descr register frame style
Definition: lwpnotes.cxx:244
void Read() override
@descr read note layout object
Definition: lwpnotes.cxx:238
virtual void XFConvert(XFContentContainer *pCont) override
@descr create a xfframe and add into content container
Definition: lwpnotes.cxx:246
VO_NOTELAYOUT object.
Definition: lwpnotes.hxx:88
sal_uInt32 m_nTime
Definition: lwpnotes.hxx:102
LwpNoteLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
Definition: lwpnotes.cxx:129
LwpVirtualLayout * GetTextLayout()
@descr Get layout that contains note text.
Definition: lwpnotes.cxx:188
virtual void RegisterStyle() override
@descr Register style
Definition: lwpnotes.cxx:163
void Read() override
@descr read note layout object
Definition: lwpnotes.cxx:141
OUString GetAuthor()
@descr Get author.
Definition: lwpnotes.cxx:201
LwpAtomHolder m_UserName
Definition: lwpnotes.hxx:103
virtual ~LwpNoteLayout() override
Definition: lwpnotes.cxx:135
virtual void XFConvert(XFContentContainer *pCont) override
@descr convert note
Definition: lwpnotes.cxx:176
sal_uInt32 GetTime() const
Definition: lwpnotes.hxx:95
virtual void XFConvert(XFContentContainer *pCont) override
@descr create a xfframe and add into content container
Definition: lwpnotes.cxx:278
void Read() override
@descr read note layout object
Definition: lwpnotes.cxx:259
virtual ~LwpNoteTextLayout() override
Definition: lwpnotes.cxx:253
virtual void RegisterStyle() override
@descr Register style, SODC doesn't support text style in note
Definition: lwpnotes.cxx:268
LwpNoteTextLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
Definition: lwpnotes.cxx:248
Base class of all Lwp VO objects.
Definition: lwpobjhdr.hxx:71
void ReadIndexed(LwpSvStream *pStrm)
@descr Read object id with indexed format from stream if index>0, lowid is get from time table per th...
Definition: lwpobjid.cxx:96
rtl::Reference< LwpObject > obj(VO_TYPE tag=VO_INVALID) const
@descr get object from object factory per the object id
Definition: lwpobjid.cxx:183
stream class for LwpObject body data provide stream like interface to read object data
Definition: lwpobjstrm.hxx:77
void DoRegisterStyle()
Definition: lwpobj.hxx:107
void SetFoundry(LwpFoundry *pFoundry)
Definition: lwpobj.hxx:137
std::unique_ptr< LwpObjectStream > m_pObjStrm
Definition: lwpobj.hxx:90
LwpFoundry * GetFoundry()
Definition: lwpobj.hxx:136
void DoXFConvert(XFContentContainer *pCont)
Definition: lwpobj.hxx:127
OUString const & GetContentText(bool bAllText=false)
get text of paragraph
Definition: lwppara1.cxx:86
void Read() override
@descr Read name of LwpDLNFVList from object stream
Definition: lwplayout.cxx:1936
LwpObjectID & GetFirstPara()
Definition: lwpstory.hxx:139
encapsulate XInputStream to provide SvStream like interfaces
Definition: lwpsvstream.hxx:69
static OUString DateTimeToOUString(const LtTm &dt)
Definition: lwptools.cxx:226
void Read() override
@descr read note layout object
Definition: lwpnotes.cxx:298
LwpViewportLayout(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
Definition: lwpnotes.cxx:287
virtual ~LwpViewportLayout() override
Definition: lwpnotes.cxx:292
virtual void XFConvert(XFContentContainer *pCont) override
@descr default XFConvert function pCont is the XFContentContainer for the object conversion
Definition: lwpnotes.cxx:306
virtual void RegisterStyle() override
@descr default register style function
Definition: lwpnotes.cxx:304
LwpVirtualLayout * FindChildByType(LWP_LAYOUT_TYPE eType)
@descr: Find child layout by layout type
Definition: lwplayout.cxx:370
void SetAuthor(const OUString &author)
void SetDate(const OUString &date)
A container for content.
virtual void Add(XFContent *pContent)
@descr Add content.
virtual void SetStyleName(const OUString &style)
: All content except XFTextContent can have a style.
Definition: xfcontent.hxx:90
void Add(XFContent *pContent)
Definition: xftextspan.cxx:87
bool LtgLocalTime(tools::Long rtime, LtTm &rtm)
Definition: localtime.cxx:169
For LWP filter architecture prototype - notes.
long Long