xref: /aoo41x/main/sw/source/ui/inc/content.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19*1d2dbeb0SAndrew Rist  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _CONTENT_HXX
24cdf0e10cSrcweir #define _CONTENT_HXX
25cdf0e10cSrcweir #include <limits.h>		// USHRT_MAX
26cdf0e10cSrcweir #include "swcont.hxx"
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifndef _MENU_HXX //autogen
29cdf0e10cSrcweir #include <vcl/menu.hxx>
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir 
32cdf0e10cSrcweir class SwWrtShell;
33cdf0e10cSrcweir class SwContentArr;
34cdf0e10cSrcweir class SwContentType;
35cdf0e10cSrcweir class SwFmtFld;
36cdf0e10cSrcweir class SwTxtINetFmt;
37cdf0e10cSrcweir class SwTOXBase;
38cdf0e10cSrcweir class SwRedline;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir //----------------------------------------------------------------------------
41cdf0e10cSrcweir //	Hilfsklassen
42cdf0e10cSrcweir //----------------------------------------------------------------------------
43cdf0e10cSrcweir 
44cdf0e10cSrcweir class SwPopup : public PopupMenu
45cdf0e10cSrcweir {
46cdf0e10cSrcweir 	sal_uInt16			nCurId;
Select()47cdf0e10cSrcweir 	virtual void    Select(){nCurId = GetCurItemId();}
48cdf0e10cSrcweir 
49cdf0e10cSrcweir public:
SwPopup()50cdf0e10cSrcweir 	SwPopup() :
51cdf0e10cSrcweir 		PopupMenu(),
52cdf0e10cSrcweir 		nCurId(USHRT_MAX){}
53cdf0e10cSrcweir 
GetCurId() const54cdf0e10cSrcweir 	sal_uInt16			GetCurId() const { return nCurId; }
55cdf0e10cSrcweir 
56cdf0e10cSrcweir };
57cdf0e10cSrcweir 
58cdf0e10cSrcweir //----------------------------------------------------------------------------
59cdf0e10cSrcweir 
60cdf0e10cSrcweir class SwOutlineContent : public SwContent
61cdf0e10cSrcweir {
62cdf0e10cSrcweir 	sal_uInt16	nOutlinePos;
63cdf0e10cSrcweir 	sal_uInt8	nOutlineLevel;
64cdf0e10cSrcweir 	sal_Bool	bIsMoveable;
65cdf0e10cSrcweir 	public:
SwOutlineContent(const SwContentType * pCnt,const String & rName,sal_uInt16 nArrPos,sal_uInt8 nLevel,sal_Bool bMove,long nYPos)66cdf0e10cSrcweir 		SwOutlineContent(	const SwContentType* pCnt,
67cdf0e10cSrcweir 							const String& rName,
68cdf0e10cSrcweir 							sal_uInt16 nArrPos,
69cdf0e10cSrcweir 							sal_uInt8 nLevel,
70cdf0e10cSrcweir 							sal_Bool bMove,
71cdf0e10cSrcweir 							long nYPos) :
72cdf0e10cSrcweir 			SwContent(pCnt, rName, nYPos),
73cdf0e10cSrcweir 			nOutlinePos(nArrPos), nOutlineLevel(nLevel), bIsMoveable(bMove) {}
74cdf0e10cSrcweir 
GetPos()75cdf0e10cSrcweir 	sal_uInt16 	GetPos(){return nOutlinePos;}
GetOutlineLevel()76cdf0e10cSrcweir 	sal_uInt8 	GetOutlineLevel(){return nOutlineLevel;}
IsMoveable()77cdf0e10cSrcweir 	sal_Bool	IsMoveable(){return bIsMoveable;};
78cdf0e10cSrcweir };
79cdf0e10cSrcweir 
80cdf0e10cSrcweir //----------------------------------------------------------------------------
81cdf0e10cSrcweir class SwRegionContent : public SwContent
82cdf0e10cSrcweir {
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	sal_uInt8	nRegionLevel;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	public:
SwRegionContent(const SwContentType * pCnt,const String & rName,sal_uInt8 nLevel,long nYPos)87cdf0e10cSrcweir 		SwRegionContent(	const SwContentType* pCnt,
88cdf0e10cSrcweir 							const String& rName,
89cdf0e10cSrcweir 							sal_uInt8 nLevel,
90cdf0e10cSrcweir 							long nYPos) :
91cdf0e10cSrcweir 			SwContent(pCnt, rName, nYPos),
92cdf0e10cSrcweir 						nRegionLevel(nLevel){}
GetRegionLevel() const93cdf0e10cSrcweir 	sal_uInt8 	GetRegionLevel() const {return nRegionLevel;}
94cdf0e10cSrcweir };
95cdf0e10cSrcweir //----------------------------------------------------------------------------
96cdf0e10cSrcweir 
97cdf0e10cSrcweir class SwURLFieldContent : public SwContent
98cdf0e10cSrcweir {
99cdf0e10cSrcweir 	String sURL;
100cdf0e10cSrcweir 	const SwTxtINetFmt* pINetAttr;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir public:
SwURLFieldContent(const SwContentType * pCnt,const String & rName,const String & rURL,const SwTxtINetFmt * pAttr,long nYPos)103cdf0e10cSrcweir 	SwURLFieldContent(	const SwContentType* pCnt,
104cdf0e10cSrcweir 							const String& rName,
105cdf0e10cSrcweir 							const String& rURL,
106cdf0e10cSrcweir 							const SwTxtINetFmt* pAttr,
107cdf0e10cSrcweir 							long nYPos )
108cdf0e10cSrcweir 		: SwContent( pCnt, rName, nYPos ), sURL( rURL ), pINetAttr( pAttr )
109cdf0e10cSrcweir 	{}
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	virtual sal_Bool	IsProtect() const;
GetURL()112cdf0e10cSrcweir 	const String& 	GetURL() 				{ return sURL; }
GetINetAttr()113cdf0e10cSrcweir 	const SwTxtINetFmt* GetINetAttr()		{ return pINetAttr; }
114cdf0e10cSrcweir };
115cdf0e10cSrcweir 
116cdf0e10cSrcweir //----------------------------------------------------------------------------
117cdf0e10cSrcweir class SwPostItContent : public SwContent
118cdf0e10cSrcweir {
119cdf0e10cSrcweir 	const SwFmtFld* 	pFld;
120cdf0e10cSrcweir 	SwRedline* 			pRedline;
121cdf0e10cSrcweir 	bool				mbPostIt;
122cdf0e10cSrcweir public:
SwPostItContent(const SwContentType * pCnt,const String & rName,const SwFmtFld * pField,long nYPos)123cdf0e10cSrcweir 	SwPostItContent( const SwContentType* pCnt,
124cdf0e10cSrcweir 							const String& rName,
125cdf0e10cSrcweir 							const SwFmtFld* pField,
126cdf0e10cSrcweir 							long nYPos )
127cdf0e10cSrcweir 		: SwContent( pCnt, rName, nYPos ), pFld( pField ),mbPostIt(true)
128cdf0e10cSrcweir 	{}
SwPostItContent(const SwContentType * pCnt,const String & rName,SwRedline * pRed,long nYPos)129cdf0e10cSrcweir 	SwPostItContent( const SwContentType* pCnt,
130cdf0e10cSrcweir 							const String& rName,
131cdf0e10cSrcweir 							SwRedline* pRed,
132cdf0e10cSrcweir 							long nYPos )
133cdf0e10cSrcweir 		: SwContent( pCnt, rName, nYPos ), pRedline( pRed ),mbPostIt(false)
134cdf0e10cSrcweir 	{}
135cdf0e10cSrcweir 
GetPostIt()136cdf0e10cSrcweir 	const SwFmtFld* GetPostIt()		{ return pFld; }
GetRedline()137cdf0e10cSrcweir 	SwRedline* GetRedline()	{ return pRedline; }
138cdf0e10cSrcweir 	virtual sal_Bool	IsProtect()		const;
IsPostIt()139cdf0e10cSrcweir 	bool			IsPostIt()		{return mbPostIt; }
140cdf0e10cSrcweir };
141cdf0e10cSrcweir 
142cdf0e10cSrcweir //----------------------------------------------------------------------------
143cdf0e10cSrcweir 
144cdf0e10cSrcweir class SwGraphicContent : public SwContent
145cdf0e10cSrcweir {
146cdf0e10cSrcweir 	String 		sLink;
147cdf0e10cSrcweir public:
SwGraphicContent(const SwContentType * pCnt,const String & rName,const String & rLink,long nYPos)148cdf0e10cSrcweir 	SwGraphicContent(const SwContentType* pCnt, const String& rName, const String& rLink, long nYPos)
149cdf0e10cSrcweir 		: SwContent( pCnt, rName, nYPos ), sLink( rLink )
150cdf0e10cSrcweir 		{}
151cdf0e10cSrcweir 	virtual ~SwGraphicContent();
152cdf0e10cSrcweir 
GetLink() const153cdf0e10cSrcweir 	const String& 	GetLink() const {return sLink;}
154cdf0e10cSrcweir };
155cdf0e10cSrcweir 
156cdf0e10cSrcweir //----------------------------------------------------------------------------
157cdf0e10cSrcweir class SwTOXBaseContent : public SwContent
158cdf0e10cSrcweir {
159cdf0e10cSrcweir 	const SwTOXBase* pBase;
160cdf0e10cSrcweir public:
SwTOXBaseContent(const SwContentType * pCnt,const String & rName,long nYPos,const SwTOXBase & rBase)161cdf0e10cSrcweir 	SwTOXBaseContent(const SwContentType* pCnt, const String& rName, long nYPos, const SwTOXBase& rBase)
162cdf0e10cSrcweir 		: SwContent( pCnt, rName, nYPos ), pBase(&rBase)
163cdf0e10cSrcweir 		{}
164cdf0e10cSrcweir 	virtual ~SwTOXBaseContent();
165cdf0e10cSrcweir 
GetTOXBase() const166cdf0e10cSrcweir 	const SwTOXBase* GetTOXBase() const {return pBase;}
167cdf0e10cSrcweir };
168cdf0e10cSrcweir /*
169cdf0e10cSrcweir 	class ContentType enthaelt Informationen zu einer Inhaltsform
170cdf0e10cSrcweir 	Das MemberArray wird nur gefuellt, wenn der Inhalt mit GetMember
171cdf0e10cSrcweir 	angefordert wird. Es wird nach Invalidate() nur dann neu geladen,
172cdf0e10cSrcweir 	wenn der Inhalt erneut ausgelesen werden soll.
173cdf0e10cSrcweir */
174cdf0e10cSrcweir //----------------------------------------------------------------------------
175cdf0e10cSrcweir //----------------------------------------------------------------------------
176cdf0e10cSrcweir 
177cdf0e10cSrcweir class SwContentType : public SwTypeNumber
178cdf0e10cSrcweir {
179cdf0e10cSrcweir 	SwWrtShell* 		pWrtShell;
180cdf0e10cSrcweir 	SwContentArr* 		pMember;			// Array fuer Inhalte
181cdf0e10cSrcweir 	String 				sContentTypeName; 	// Name der Inhaltsform
182cdf0e10cSrcweir 	String 				sSingleContentTypeName; // Name der Inhaltsform, Singular
183cdf0e10cSrcweir 	String 				sTypeToken;			// Anhaengsel fuer URL
184cdf0e10cSrcweir 	sal_uInt16				nMemberCount;		// Inhaltsanzahl
185cdf0e10cSrcweir 	sal_uInt16				nContentType;		// Id der Inhaltsform
186cdf0e10cSrcweir 	sal_uInt8 				nOutlineLevel;
187cdf0e10cSrcweir 	sal_Bool 				bMemberFilled : 1; 	// wurden die Inhalte bereits eingefuegt?
188cdf0e10cSrcweir 	sal_Bool 				bIsInternalDrag:1;	// koennen die Inhalte verschoben werden?
189cdf0e10cSrcweir 	sal_Bool				bDataValid : 	1;  //
190cdf0e10cSrcweir 	sal_Bool				bEdit:			1;	// kann diese Type bearbeitet werden ?
191cdf0e10cSrcweir 	sal_Bool				bDelete:		1;	// kann diese Type geloescht werden ?
192cdf0e10cSrcweir protected:
193cdf0e10cSrcweir 		void			RemoveNewline(String&);
194cdf0e10cSrcweir public:
195cdf0e10cSrcweir 		SwContentType(SwWrtShell* pParent, sal_uInt16 nType, sal_uInt8 nLevel );
196cdf0e10cSrcweir 		~SwContentType();
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 		void				Init(sal_Bool* pbInvalidateWindow = 0);
199cdf0e10cSrcweir 		void				FillMemberList(sal_Bool* pbLevelChanged = NULL);
GetMemberCount() const200cdf0e10cSrcweir 		sal_uInt16				GetMemberCount() const
201cdf0e10cSrcweir 								{return nMemberCount;};
GetType() const202cdf0e10cSrcweir 		sal_uInt16				GetType() const {return nContentType;}
203cdf0e10cSrcweir 		const SwContent*	GetMember(sal_uInt16 nIndex);
GetName()204cdf0e10cSrcweir 		const String&		GetName() {return sContentTypeName;}
GetSingleName() const205cdf0e10cSrcweir 		const String&		GetSingleName() const {return sSingleContentTypeName;}
GetTypeToken() const206cdf0e10cSrcweir 		const String&		GetTypeToken() const{return sTypeToken;}
207cdf0e10cSrcweir 
SetOutlineLevel(sal_uInt8 nNew)208cdf0e10cSrcweir 		void				SetOutlineLevel(sal_uInt8 nNew)
209cdf0e10cSrcweir 							{
210cdf0e10cSrcweir 								nOutlineLevel = nNew;
211cdf0e10cSrcweir 								Invalidate();
212cdf0e10cSrcweir 							}
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 		void				Invalidate(); // nur nMemberCount wird neu gelesen
215cdf0e10cSrcweir 
IsEditable() const216cdf0e10cSrcweir 		sal_Bool 				IsEditable() const {return bEdit;}
IsDeletable() const217cdf0e10cSrcweir 		sal_Bool				IsDeletable() const {return bDelete;}
218cdf0e10cSrcweir };
219cdf0e10cSrcweir 
220cdf0e10cSrcweir #endif
221cdf0e10cSrcweir 
222