update dev300-m58
[ooovba.git] / sw / source / ui / inc / content.hxx
blob6d99ee4eaa7480c920ecfb6de36c02899204e446
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: content.hxx,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
30 #ifndef _CONTENT_HXX
31 #define _CONTENT_HXX
32 #include <limits.h> // USHRT_MAX
33 #include "swcont.hxx"
35 #ifndef _MENU_HXX //autogen
36 #include <vcl/menu.hxx>
37 #endif
39 class SwWrtShell;
40 class SwContentArr;
41 class SwContentType;
42 class SwFmtFld;
43 class SwTxtINetFmt;
44 class SwTOXBase;
45 class SwRedline;
47 //----------------------------------------------------------------------------
48 // Hilfsklassen
49 //----------------------------------------------------------------------------
51 class SwPopup : public PopupMenu
53 USHORT nCurId;
54 virtual void Select(){nCurId = GetCurItemId();}
56 public:
57 SwPopup() :
58 PopupMenu(),
59 nCurId(USHRT_MAX){}
61 USHORT GetCurId() const { return nCurId; }
65 //----------------------------------------------------------------------------
67 class SwOutlineContent : public SwContent
69 USHORT nOutlinePos;
70 BYTE nOutlineLevel;
71 BOOL bIsMoveable;
72 public:
73 SwOutlineContent( const SwContentType* pCnt,
74 const String& rName,
75 USHORT nArrPos,
76 BYTE nLevel,
77 BOOL bMove,
78 long nYPos) :
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
91 BYTE nRegionLevel;
93 public:
94 SwRegionContent( const SwContentType* pCnt,
95 const String& rName,
96 BYTE nLevel,
97 long nYPos) :
98 SwContent(pCnt, rName, nYPos),
99 nRegionLevel(nLevel){}
100 BYTE GetRegionLevel() const {return nRegionLevel;}
102 //----------------------------------------------------------------------------
104 class SwURLFieldContent : public SwContent
106 String sURL;
107 const SwTxtINetFmt* pINetAttr;
109 public:
110 SwURLFieldContent( const SwContentType* pCnt,
111 const String& rName,
112 const String& rURL,
113 const SwTxtINetFmt* pAttr,
114 long nYPos )
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;
127 SwRedline* pRedline;
128 bool mbPostIt;
129 public:
130 SwPostItContent( const SwContentType* pCnt,
131 const String& rName,
132 const SwFmtFld* pField,
133 long nYPos )
134 : SwContent( pCnt, rName, nYPos ), pFld( pField ),mbPostIt(true)
136 SwPostItContent( const SwContentType* pCnt,
137 const String& rName,
138 SwRedline* pRed,
139 long nYPos )
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
153 String sLink;
154 public:
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;
167 public:
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
193 BYTE nOutlineLevel;
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 ?
199 protected:
200 void RemoveNewline(String&);
201 public:
202 SwContentType(SwWrtShell* pParent, USHORT nType, BYTE nLevel );
203 ~SwContentType();
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;
218 Invalidate();
221 void Invalidate(); // nur nMemberCount wird neu gelesen
223 BOOL IsEditable() const {return bEdit;}
224 BOOL IsDeletable() const {return bDelete;}
227 #endif