1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
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
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.
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.
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,
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.
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.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
55 ************************************************************************/
56 /*************************************************************************
58 * Frame object for OOo.This is the basic object for all Shape Layer.
59 * You can reference to the XFFrame object.
60 ************************************************************************/
61 #ifndef INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFRAME_HXX
62 #define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFFRAME_HXX
64 #include <xfilter/xfcontent.hxx>
65 #include <xfilter/xfrect.hxx>
66 #include <xfilter/xfcontentcontainer.hxx>
68 #define XFFRAME_FLAG_HEIGHT 0x00000001
69 #define XFFRAME_FLAG_MINHEIGHT 0x00000002
70 #define XFFRAME_FLAG_MAXHEIGHT 0x00000004
73 * Base class for all frame object,include drawing,image,text-box.
75 * Use SetX(),SetY(),SetWidth(),SetHeight() to set position for the frame.
76 * Only if you set anchor type to enumXFAnchorPage, the SetAnchorPage functions.
78 class XFFrame
: public XFContentContainer
82 explicit XFFrame(bool isTextBox
);
84 virtual ~XFFrame() override
;
87 using XFContentContainer::Add
;
90 * @descr override the add function to adjust z-index.
92 virtual void Add(XFContent
*pContent
) override
;
95 * @descr: Set the anchor type for the frame object.
97 void SetAnchorType(enumXFAnchor type
);
100 * @descr: if it's page anchor,set the page number.
102 void SetAnchorPage(sal_Int32 page
);
105 * @descr Set frame name.
107 void SetName(const OUString
& name
);
110 * @descr Set z-index of the frame.
112 void SetZIndex(sal_uInt32 zIndex
);
114 * @descr Set frame position X.
119 * @descr Set frame position Y.
124 * @descr Set frame width.
126 void SetWidth(double width
);
129 * @descr Set frame height. Be careful SetHeight and SetMinHeight will override each other.
131 void SetHeight(double height
);
134 * @descr Set frame min-height. Be careful SetHeight and SetMinHeight will override each other.
136 void SetMinHeight(double minHeight
);
139 * @descr Set frame position.
141 void SetPosition(double x
, double y
, double width
, double height
);
144 * @descr Set frame position.
146 void SetPosition(const XFRect
& rect
);
149 * @descr: Link the text content of the two frame.
151 void SetNextLink(const OUString
& next
);
154 * @descr Get the frame type. image, drawing or text-box.
156 enumXFFrameType
GetFrameType() const;
159 * @descr Get content type, enumXFContentFrame.
161 virtual enumXFContent
GetContentType() override
;
166 virtual void ToXml(IXFStream
*pStrm
) override
;
169 void StartFrame(IXFStream
*pStrm
);
171 static void EndFrame(IXFStream
*pStrm
);
176 enumXFAnchor m_eAnchor
;
177 sal_Int32 m_nAnchorPage
;
179 sal_uInt32 m_nZIndex
;
182 OUString m_strNextLink
;
183 enumXFFrameType m_eType
;
184 sal_uInt32 m_nFrameFlag
;
188 inline void XFFrame::SetAnchorType(enumXFAnchor anchor
)
193 inline void XFFrame::SetName(const OUString
& name
)
198 inline void XFFrame::SetX(double x
)
203 inline void XFFrame::SetY(double y
)
208 inline void XFFrame::SetWidth(double width
)
210 m_aRect
.SetWidth(width
);
213 inline void XFFrame::SetHeight(double height
)
215 m_aRect
.SetHeight(height
);
216 m_nFrameFlag
|= XFFRAME_FLAG_HEIGHT
;
217 m_nFrameFlag
&= XFFRAME_FLAG_HEIGHT
;
220 inline void XFFrame::SetMinHeight(double minHeight
)
222 m_fMinHeight
= minHeight
;
223 m_nFrameFlag
|= XFFRAME_FLAG_MINHEIGHT
;
224 m_nFrameFlag
&= XFFRAME_FLAG_MINHEIGHT
;
227 inline void XFFrame::SetPosition(double x
, double y
, double width
, double height
)
229 m_aRect
.SetStartPoint(XFPoint(x
,y
));
230 m_aRect
.SetSize(width
,height
);
231 m_nFrameFlag
|= XFFRAME_FLAG_HEIGHT
;
234 inline void XFFrame::SetPosition(const XFRect
& rect
)
239 inline void XFFrame::SetNextLink(const OUString
& next
)
241 m_strNextLink
= next
;
244 inline void XFFrame::SetAnchorPage(sal_Int32 page
)
246 m_nAnchorPage
= page
;
251 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */