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: content.hxx,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 ************************************************************************/
32 #include <limits.h> // USHRT_MAX
35 #ifndef _MENU_HXX //autogen
36 #include <vcl/menu.hxx>
47 //----------------------------------------------------------------------------
49 //----------------------------------------------------------------------------
51 class SwPopup
: public PopupMenu
54 virtual void Select(){nCurId
= GetCurItemId();}
61 USHORT
GetCurId() const { return nCurId
; }
65 //----------------------------------------------------------------------------
67 class SwOutlineContent
: public SwContent
73 SwOutlineContent( const SwContentType
* pCnt
,
79 SwContent(pCnt
, rName
, nYPos
),
80 nOutlinePos(nArrPos
), nOutlineLevel(nLevel
), bIsMoveable(bMove
) {}
82 USHORT
GetPos(){return nOutlinePos
;}
83 BYTE
GetOutlineLevel(){return nOutlineLevel
;}
84 BOOL
IsMoveable(){return bIsMoveable
;};
87 //----------------------------------------------------------------------------
88 class SwRegionContent
: public SwContent
94 SwRegionContent( const SwContentType
* pCnt
,
98 SwContent(pCnt
, rName
, nYPos
),
99 nRegionLevel(nLevel
){}
100 BYTE
GetRegionLevel() const {return nRegionLevel
;}
102 //----------------------------------------------------------------------------
104 class SwURLFieldContent
: public SwContent
107 const SwTxtINetFmt
* pINetAttr
;
110 SwURLFieldContent( const SwContentType
* pCnt
,
113 const SwTxtINetFmt
* pAttr
,
115 : SwContent( pCnt
, rName
, nYPos
), sURL( rURL
), pINetAttr( pAttr
)
118 virtual BOOL
IsProtect() const;
119 const String
& GetURL() { return sURL
; }
120 const SwTxtINetFmt
* GetINetAttr() { return pINetAttr
; }
123 //----------------------------------------------------------------------------
124 class SwPostItContent
: public SwContent
126 const SwFmtFld
* pFld
;
130 SwPostItContent( const SwContentType
* pCnt
,
132 const SwFmtFld
* pField
,
134 : SwContent( pCnt
, rName
, nYPos
), pFld( pField
),mbPostIt(true)
136 SwPostItContent( const SwContentType
* pCnt
,
140 : SwContent( pCnt
, rName
, nYPos
), pRedline( pRed
),mbPostIt(false)
143 const SwFmtFld
* GetPostIt() { return pFld
; }
144 SwRedline
* GetRedline() { return pRedline
; }
145 virtual BOOL
IsProtect() const;
146 bool IsPostIt() {return mbPostIt
; }
149 //----------------------------------------------------------------------------
151 class SwGraphicContent
: public SwContent
155 SwGraphicContent(const SwContentType
* pCnt
, const String
& rName
, const String
& rLink
, long nYPos
)
156 : SwContent( pCnt
, rName
, nYPos
), sLink( rLink
)
158 virtual ~SwGraphicContent();
160 const String
& GetLink() const {return sLink
;}
163 //----------------------------------------------------------------------------
164 class SwTOXBaseContent
: public SwContent
166 const SwTOXBase
* pBase
;
168 SwTOXBaseContent(const SwContentType
* pCnt
, const String
& rName
, long nYPos
, const SwTOXBase
& rBase
)
169 : SwContent( pCnt
, rName
, nYPos
), pBase(&rBase
)
171 virtual ~SwTOXBaseContent();
173 const SwTOXBase
* GetTOXBase() const {return pBase
;}
176 class ContentType enthaelt Informationen zu einer Inhaltsform
177 Das MemberArray wird nur gefuellt, wenn der Inhalt mit GetMember
178 angefordert wird. Es wird nach Invalidate() nur dann neu geladen,
179 wenn der Inhalt erneut ausgelesen werden soll.
181 //----------------------------------------------------------------------------
182 //----------------------------------------------------------------------------
184 class SwContentType
: public SwTypeNumber
186 SwWrtShell
* pWrtShell
;
187 SwContentArr
* pMember
; // Array fuer Inhalte
188 String sContentTypeName
; // Name der Inhaltsform
189 String sSingleContentTypeName
; // Name der Inhaltsform, Singular
190 String sTypeToken
; // Anhaengsel fuer URL
191 USHORT nMemberCount
; // Inhaltsanzahl
192 USHORT nContentType
; // Id der Inhaltsform
194 BOOL bMemberFilled
: 1; // wurden die Inhalte bereits eingefuegt?
195 BOOL bIsInternalDrag
:1; // koennen die Inhalte verschoben werden?
196 BOOL bDataValid
: 1; //
197 BOOL bEdit
: 1; // kann diese Type bearbeitet werden ?
198 BOOL bDelete
: 1; // kann diese Type geloescht werden ?
200 void RemoveNewline(String
&);
202 SwContentType(SwWrtShell
* pParent
, USHORT nType
, BYTE nLevel
);
205 void Init(BOOL
* pbInvalidateWindow
= 0);
206 void FillMemberList(BOOL
* pbLevelChanged
= NULL
);
207 USHORT
GetMemberCount() const
208 {return nMemberCount
;};
209 USHORT
GetType() const {return nContentType
;}
210 const SwContent
* GetMember(USHORT nIndex
);
211 const String
& GetName() {return sContentTypeName
;}
212 const String
& GetSingleName() const {return sSingleContentTypeName
;}
213 const String
& GetTypeToken() const{return sTypeToken
;}
215 void SetOutlineLevel(BYTE nNew
)
217 nOutlineLevel
= nNew
;
221 void Invalidate(); // nur nMemberCount wird neu gelesen
223 BOOL
IsEditable() const {return bEdit
;}
224 BOOL
IsDeletable() const {return bDelete
;}