1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef _CONTENT_HXX 28*cdf0e10cSrcweir #define _CONTENT_HXX 29*cdf0e10cSrcweir #include <limits.h> // USHRT_MAX 30*cdf0e10cSrcweir #include "swcont.hxx" 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #ifndef _MENU_HXX //autogen 33*cdf0e10cSrcweir #include <vcl/menu.hxx> 34*cdf0e10cSrcweir #endif 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir class SwWrtShell; 37*cdf0e10cSrcweir class SwContentArr; 38*cdf0e10cSrcweir class SwContentType; 39*cdf0e10cSrcweir class SwFmtFld; 40*cdf0e10cSrcweir class SwTxtINetFmt; 41*cdf0e10cSrcweir class SwTOXBase; 42*cdf0e10cSrcweir class SwRedline; 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir //---------------------------------------------------------------------------- 45*cdf0e10cSrcweir // Hilfsklassen 46*cdf0e10cSrcweir //---------------------------------------------------------------------------- 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir class SwPopup : public PopupMenu 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir sal_uInt16 nCurId; 51*cdf0e10cSrcweir virtual void Select(){nCurId = GetCurItemId();} 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir public: 54*cdf0e10cSrcweir SwPopup() : 55*cdf0e10cSrcweir PopupMenu(), 56*cdf0e10cSrcweir nCurId(USHRT_MAX){} 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir sal_uInt16 GetCurId() const { return nCurId; } 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir }; 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir //---------------------------------------------------------------------------- 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir class SwOutlineContent : public SwContent 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir sal_uInt16 nOutlinePos; 67*cdf0e10cSrcweir sal_uInt8 nOutlineLevel; 68*cdf0e10cSrcweir sal_Bool bIsMoveable; 69*cdf0e10cSrcweir public: 70*cdf0e10cSrcweir SwOutlineContent( const SwContentType* pCnt, 71*cdf0e10cSrcweir const String& rName, 72*cdf0e10cSrcweir sal_uInt16 nArrPos, 73*cdf0e10cSrcweir sal_uInt8 nLevel, 74*cdf0e10cSrcweir sal_Bool bMove, 75*cdf0e10cSrcweir long nYPos) : 76*cdf0e10cSrcweir SwContent(pCnt, rName, nYPos), 77*cdf0e10cSrcweir nOutlinePos(nArrPos), nOutlineLevel(nLevel), bIsMoveable(bMove) {} 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir sal_uInt16 GetPos(){return nOutlinePos;} 80*cdf0e10cSrcweir sal_uInt8 GetOutlineLevel(){return nOutlineLevel;} 81*cdf0e10cSrcweir sal_Bool IsMoveable(){return bIsMoveable;}; 82*cdf0e10cSrcweir }; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir //---------------------------------------------------------------------------- 85*cdf0e10cSrcweir class SwRegionContent : public SwContent 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir sal_uInt8 nRegionLevel; 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir public: 91*cdf0e10cSrcweir SwRegionContent( const SwContentType* pCnt, 92*cdf0e10cSrcweir const String& rName, 93*cdf0e10cSrcweir sal_uInt8 nLevel, 94*cdf0e10cSrcweir long nYPos) : 95*cdf0e10cSrcweir SwContent(pCnt, rName, nYPos), 96*cdf0e10cSrcweir nRegionLevel(nLevel){} 97*cdf0e10cSrcweir sal_uInt8 GetRegionLevel() const {return nRegionLevel;} 98*cdf0e10cSrcweir }; 99*cdf0e10cSrcweir //---------------------------------------------------------------------------- 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir class SwURLFieldContent : public SwContent 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir String sURL; 104*cdf0e10cSrcweir const SwTxtINetFmt* pINetAttr; 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir public: 107*cdf0e10cSrcweir SwURLFieldContent( const SwContentType* pCnt, 108*cdf0e10cSrcweir const String& rName, 109*cdf0e10cSrcweir const String& rURL, 110*cdf0e10cSrcweir const SwTxtINetFmt* pAttr, 111*cdf0e10cSrcweir long nYPos ) 112*cdf0e10cSrcweir : SwContent( pCnt, rName, nYPos ), sURL( rURL ), pINetAttr( pAttr ) 113*cdf0e10cSrcweir {} 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir virtual sal_Bool IsProtect() const; 116*cdf0e10cSrcweir const String& GetURL() { return sURL; } 117*cdf0e10cSrcweir const SwTxtINetFmt* GetINetAttr() { return pINetAttr; } 118*cdf0e10cSrcweir }; 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir //---------------------------------------------------------------------------- 121*cdf0e10cSrcweir class SwPostItContent : public SwContent 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir const SwFmtFld* pFld; 124*cdf0e10cSrcweir SwRedline* pRedline; 125*cdf0e10cSrcweir bool mbPostIt; 126*cdf0e10cSrcweir public: 127*cdf0e10cSrcweir SwPostItContent( const SwContentType* pCnt, 128*cdf0e10cSrcweir const String& rName, 129*cdf0e10cSrcweir const SwFmtFld* pField, 130*cdf0e10cSrcweir long nYPos ) 131*cdf0e10cSrcweir : SwContent( pCnt, rName, nYPos ), pFld( pField ),mbPostIt(true) 132*cdf0e10cSrcweir {} 133*cdf0e10cSrcweir SwPostItContent( const SwContentType* pCnt, 134*cdf0e10cSrcweir const String& rName, 135*cdf0e10cSrcweir SwRedline* pRed, 136*cdf0e10cSrcweir long nYPos ) 137*cdf0e10cSrcweir : SwContent( pCnt, rName, nYPos ), pRedline( pRed ),mbPostIt(false) 138*cdf0e10cSrcweir {} 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir const SwFmtFld* GetPostIt() { return pFld; } 141*cdf0e10cSrcweir SwRedline* GetRedline() { return pRedline; } 142*cdf0e10cSrcweir virtual sal_Bool IsProtect() const; 143*cdf0e10cSrcweir bool IsPostIt() {return mbPostIt; } 144*cdf0e10cSrcweir }; 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir //---------------------------------------------------------------------------- 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir class SwGraphicContent : public SwContent 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir String sLink; 151*cdf0e10cSrcweir public: 152*cdf0e10cSrcweir SwGraphicContent(const SwContentType* pCnt, const String& rName, const String& rLink, long nYPos) 153*cdf0e10cSrcweir : SwContent( pCnt, rName, nYPos ), sLink( rLink ) 154*cdf0e10cSrcweir {} 155*cdf0e10cSrcweir virtual ~SwGraphicContent(); 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir const String& GetLink() const {return sLink;} 158*cdf0e10cSrcweir }; 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir //---------------------------------------------------------------------------- 161*cdf0e10cSrcweir class SwTOXBaseContent : public SwContent 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir const SwTOXBase* pBase; 164*cdf0e10cSrcweir public: 165*cdf0e10cSrcweir SwTOXBaseContent(const SwContentType* pCnt, const String& rName, long nYPos, const SwTOXBase& rBase) 166*cdf0e10cSrcweir : SwContent( pCnt, rName, nYPos ), pBase(&rBase) 167*cdf0e10cSrcweir {} 168*cdf0e10cSrcweir virtual ~SwTOXBaseContent(); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir const SwTOXBase* GetTOXBase() const {return pBase;} 171*cdf0e10cSrcweir }; 172*cdf0e10cSrcweir /* 173*cdf0e10cSrcweir class ContentType enthaelt Informationen zu einer Inhaltsform 174*cdf0e10cSrcweir Das MemberArray wird nur gefuellt, wenn der Inhalt mit GetMember 175*cdf0e10cSrcweir angefordert wird. Es wird nach Invalidate() nur dann neu geladen, 176*cdf0e10cSrcweir wenn der Inhalt erneut ausgelesen werden soll. 177*cdf0e10cSrcweir */ 178*cdf0e10cSrcweir //---------------------------------------------------------------------------- 179*cdf0e10cSrcweir //---------------------------------------------------------------------------- 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir class SwContentType : public SwTypeNumber 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir SwWrtShell* pWrtShell; 184*cdf0e10cSrcweir SwContentArr* pMember; // Array fuer Inhalte 185*cdf0e10cSrcweir String sContentTypeName; // Name der Inhaltsform 186*cdf0e10cSrcweir String sSingleContentTypeName; // Name der Inhaltsform, Singular 187*cdf0e10cSrcweir String sTypeToken; // Anhaengsel fuer URL 188*cdf0e10cSrcweir sal_uInt16 nMemberCount; // Inhaltsanzahl 189*cdf0e10cSrcweir sal_uInt16 nContentType; // Id der Inhaltsform 190*cdf0e10cSrcweir sal_uInt8 nOutlineLevel; 191*cdf0e10cSrcweir sal_Bool bMemberFilled : 1; // wurden die Inhalte bereits eingefuegt? 192*cdf0e10cSrcweir sal_Bool bIsInternalDrag:1; // koennen die Inhalte verschoben werden? 193*cdf0e10cSrcweir sal_Bool bDataValid : 1; // 194*cdf0e10cSrcweir sal_Bool bEdit: 1; // kann diese Type bearbeitet werden ? 195*cdf0e10cSrcweir sal_Bool bDelete: 1; // kann diese Type geloescht werden ? 196*cdf0e10cSrcweir protected: 197*cdf0e10cSrcweir void RemoveNewline(String&); 198*cdf0e10cSrcweir public: 199*cdf0e10cSrcweir SwContentType(SwWrtShell* pParent, sal_uInt16 nType, sal_uInt8 nLevel ); 200*cdf0e10cSrcweir ~SwContentType(); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir void Init(sal_Bool* pbInvalidateWindow = 0); 203*cdf0e10cSrcweir void FillMemberList(sal_Bool* pbLevelChanged = NULL); 204*cdf0e10cSrcweir sal_uInt16 GetMemberCount() const 205*cdf0e10cSrcweir {return nMemberCount;}; 206*cdf0e10cSrcweir sal_uInt16 GetType() const {return nContentType;} 207*cdf0e10cSrcweir const SwContent* GetMember(sal_uInt16 nIndex); 208*cdf0e10cSrcweir const String& GetName() {return sContentTypeName;} 209*cdf0e10cSrcweir const String& GetSingleName() const {return sSingleContentTypeName;} 210*cdf0e10cSrcweir const String& GetTypeToken() const{return sTypeToken;} 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir void SetOutlineLevel(sal_uInt8 nNew) 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir nOutlineLevel = nNew; 215*cdf0e10cSrcweir Invalidate(); 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir void Invalidate(); // nur nMemberCount wird neu gelesen 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir sal_Bool IsEditable() const {return bEdit;} 221*cdf0e10cSrcweir sal_Bool IsDeletable() const {return bDelete;} 222*cdf0e10cSrcweir }; 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir #endif 225*cdf0e10cSrcweir 226