xref: /aoo42x/main/sw/inc/section.hxx (revision 67e470da)
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 
24cdf0e10cSrcweir #ifndef _SECTION_HXX
25cdf0e10cSrcweir #define _SECTION_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <boost/utility.hpp>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <tools/rtti.hxx>
32cdf0e10cSrcweir #include <tools/ref.hxx>
33cdf0e10cSrcweir #include <svl/svarray.hxx>
34713b4dcdSMichael Stahl // --> OD #i117863#
35713b4dcdSMichael Stahl #include <svl/smplhint.hxx>
36713b4dcdSMichael Stahl // <--
37cdf0e10cSrcweir #include <sfx2/lnkbase.hxx>
38cdf0e10cSrcweir #include <sfx2/Metadatable.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <frmfmt.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace com { namespace sun { namespace star {
44cdf0e10cSrcweir     namespace text { class XTextSection; }
45cdf0e10cSrcweir } } }
46cdf0e10cSrcweir 
47cdf0e10cSrcweir // Forward Deklaration
48cdf0e10cSrcweir class SwSectionFmt;
49cdf0e10cSrcweir class SwDoc;
50cdf0e10cSrcweir class SwSection;
51cdf0e10cSrcweir class SwSectionNode;
52cdf0e10cSrcweir class SwTOXBase;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir #ifndef SW_DECL_SWSERVEROBJECT_DEFINED
55cdf0e10cSrcweir #define SW_DECL_SWSERVEROBJECT_DEFINED
56cdf0e10cSrcweir SV_DECL_REF( SwServerObject )
57cdf0e10cSrcweir #endif
58cdf0e10cSrcweir 
59cdf0e10cSrcweir SV_DECL_PTRARR( SwSections, SwSection*, 0, 4 )
60cdf0e10cSrcweir 
61cdf0e10cSrcweir enum SectionType { CONTENT_SECTION,
62cdf0e10cSrcweir 					TOX_HEADER_SECTION,
63cdf0e10cSrcweir 					TOX_CONTENT_SECTION,
64cdf0e10cSrcweir 					DDE_LINK_SECTION	= OBJECT_CLIENT_DDE,
65cdf0e10cSrcweir 					FILE_LINK_SECTION	= OBJECT_CLIENT_FILE
66cdf0e10cSrcweir /*
67cdf0e10cSrcweir // verbleiben noch:
68cdf0e10cSrcweir 	OBJECT_CLIENT_SO			= 0x80,
69cdf0e10cSrcweir 	OBJECT_CLIENT_OLE			= 0x82,
70cdf0e10cSrcweir 	OBJECT_CLIENT_OLE_CACHE		= 0x83,
71cdf0e10cSrcweir */
72cdf0e10cSrcweir 					};
73cdf0e10cSrcweir 
74cdf0e10cSrcweir enum LinkCreateType
75cdf0e10cSrcweir {
76cdf0e10cSrcweir 	CREATE_NONE,			// nichts weiter tun
77cdf0e10cSrcweir 	CREATE_CONNECT,			// Link gleich connecten
78cdf0e10cSrcweir 	CREATE_UPDATE			// Link connecten und updaten
79cdf0e10cSrcweir };
80cdf0e10cSrcweir 
81cdf0e10cSrcweir class SW_DLLPUBLIC SwSectionData
82cdf0e10cSrcweir {
83cdf0e10cSrcweir private:
84cdf0e10cSrcweir     SectionType m_eType;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     String m_sSectionName;
87cdf0e10cSrcweir     String m_sCondition;
88cdf0e10cSrcweir     String m_sLinkFileName;
89cdf0e10cSrcweir     String m_sLinkFilePassword; // JP 27.02.2001: must be changed to Sequence
90cdf0e10cSrcweir     ::com::sun::star::uno::Sequence <sal_Int8> m_Password;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     /// it seems this flag caches the current final "hidden" state
93cdf0e10cSrcweir     bool m_bHiddenFlag          : 1;
94cdf0e10cSrcweir     /// flags that correspond to attributes in the format:
95cdf0e10cSrcweir     /// may have different value than format attribute:
96cdf0e10cSrcweir     /// format attr has value for this section, while flag is
97cdf0e10cSrcweir     /// effectively ORed with parent sections!
98cdf0e10cSrcweir     bool m_bProtectFlag         : 1;
99cdf0e10cSrcweir     // --> FME 2004-06-22 #114856# edit in readonly sections
100cdf0e10cSrcweir     bool m_bEditInReadonlyFlag  : 1;
101cdf0e10cSrcweir     // <--
102cdf0e10cSrcweir     bool m_bHidden              : 1; // all paragraphs hidden?
103cdf0e10cSrcweir     bool m_bCondHiddenFlag      : 1; // Hiddenflag for condition
104cdf0e10cSrcweir     bool m_bConnectFlag         : 1; // connected to server?
105cdf0e10cSrcweir 
106cdf0e10cSrcweir public:
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     SwSectionData(SectionType const eType, String const& rName);
109cdf0e10cSrcweir     explicit SwSectionData(SwSection const&);
110cdf0e10cSrcweir     SwSectionData(SwSectionData const&);
111cdf0e10cSrcweir     SwSectionData & operator=(SwSectionData const&);
112cdf0e10cSrcweir     bool operator==(SwSectionData const&) const;
113cdf0e10cSrcweir 
GetSectionName() const114cdf0e10cSrcweir     String const& GetSectionName() const    { return m_sSectionName; }
SetSectionName(String const & rName)115cdf0e10cSrcweir     void SetSectionName(String const& rName){ m_sSectionName = rName; }
GetType() const116cdf0e10cSrcweir     SectionType GetType() const             { return m_eType; }
SetType(SectionType const eNew)117cdf0e10cSrcweir     void SetType(SectionType const eNew)    { m_eType = eNew; }
118cdf0e10cSrcweir 
IsHidden() const119cdf0e10cSrcweir     bool IsHidden() const { return m_bHidden; }
SetHidden(bool const bFlag=true)120cdf0e10cSrcweir     void SetHidden(bool const bFlag = true) { m_bHidden = bFlag; }
121cdf0e10cSrcweir 
IsHiddenFlag() const122cdf0e10cSrcweir     bool IsHiddenFlag() const { return m_bHiddenFlag; }
123cdf0e10cSrcweir     SW_DLLPRIVATE void
SetHiddenFlag(bool const bFlag)124cdf0e10cSrcweir         SetHiddenFlag(bool const bFlag) { m_bHiddenFlag = bFlag; }
IsProtectFlag() const125cdf0e10cSrcweir     bool IsProtectFlag() const { return m_bProtectFlag; }
126cdf0e10cSrcweir     SW_DLLPRIVATE void
SetProtectFlag(bool const bFlag)127cdf0e10cSrcweir         SetProtectFlag(bool const bFlag) { m_bProtectFlag = bFlag; }
128cdf0e10cSrcweir     // --> FME 2004-06-22 #114856# edit in readonly sections
IsEditInReadonlyFlag() const129cdf0e10cSrcweir     bool IsEditInReadonlyFlag() const { return m_bEditInReadonlyFlag; }
SetEditInReadonlyFlag(bool const bFlag)130cdf0e10cSrcweir     void SetEditInReadonlyFlag(bool const bFlag)
131cdf0e10cSrcweir         { m_bEditInReadonlyFlag = bFlag; }
132cdf0e10cSrcweir     // <--
133cdf0e10cSrcweir 
SetCondHidden(bool const bFlag=true)134cdf0e10cSrcweir     void SetCondHidden(bool const bFlag = true) { m_bCondHiddenFlag = bFlag; };
IsCondHidden() const135cdf0e10cSrcweir     bool IsCondHidden() const { return m_bCondHiddenFlag; }
136cdf0e10cSrcweir 
GetCondition() const137cdf0e10cSrcweir     String const& GetCondition() const      { return m_sCondition; }
SetCondition(String const & rNew)138cdf0e10cSrcweir     void SetCondition(String const& rNew)   { m_sCondition = rNew; }
139cdf0e10cSrcweir 
GetLinkFileName() const140cdf0e10cSrcweir     String const& GetLinkFileName() const   { return m_sLinkFileName; };
SetLinkFileName(String const & rNew,String const * pPassWd=0)141cdf0e10cSrcweir     void SetLinkFileName(String const& rNew, String const* pPassWd = 0)
142cdf0e10cSrcweir     {
143cdf0e10cSrcweir         m_sLinkFileName = rNew;
144cdf0e10cSrcweir         if (pPassWd) { SetLinkFilePassword(*pPassWd); }
145cdf0e10cSrcweir     }
146cdf0e10cSrcweir 
GetLinkFilePassword() const147cdf0e10cSrcweir     String const& GetLinkFilePassword() const   { return m_sLinkFilePassword; }
SetLinkFilePassword(String const & rS)148cdf0e10cSrcweir     void SetLinkFilePassword(String const& rS)  { m_sLinkFilePassword = rS; }
149cdf0e10cSrcweir 
GetPassword() const150cdf0e10cSrcweir     ::com::sun::star::uno::Sequence<sal_Int8> const& GetPassword() const
151cdf0e10cSrcweir                                             { return m_Password; }
SetPassword(::com::sun::star::uno::Sequence<sal_Int8> const & rNew)152cdf0e10cSrcweir     void SetPassword(::com::sun::star::uno::Sequence<sal_Int8> const& rNew)
153cdf0e10cSrcweir                                             { m_Password = rNew; }
IsLinkType() const154cdf0e10cSrcweir     bool IsLinkType() const
155cdf0e10cSrcweir     { return (DDE_LINK_SECTION == m_eType) || (FILE_LINK_SECTION == m_eType); }
156cdf0e10cSrcweir 
IsConnectFlag() const157cdf0e10cSrcweir     bool IsConnectFlag() const                  { return m_bConnectFlag; }
SetConnectFlag(bool const bFlag=true)158cdf0e10cSrcweir     void SetConnectFlag(bool const bFlag = true){ m_bConnectFlag = bFlag; }
159cdf0e10cSrcweir };
160cdf0e10cSrcweir 
161cdf0e10cSrcweir class SW_DLLPUBLIC SwSection
162cdf0e10cSrcweir     : public SwClient
163cdf0e10cSrcweir {
164cdf0e10cSrcweir 	// damit beim Anlegen/Loeschen von Frames das Flag richtig gepflegt wird!
165cdf0e10cSrcweir 	friend class SwSectionNode;
166cdf0e10cSrcweir 	// the "read CTOR" of SwSectionFrm have to change the Hiddenflag
167cdf0e10cSrcweir 	friend class SwSectionFrm;
168cdf0e10cSrcweir 
169cdf0e10cSrcweir private:
170cdf0e10cSrcweir     SwSectionData m_Data;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir     SwServerObjectRef m_RefObj; // set if DataServer
173cdf0e10cSrcweir     ::sfx2::SvBaseLinkRef m_RefLink;
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     SW_DLLPRIVATE void ImplSetHiddenFlag(
176cdf0e10cSrcweir             bool const bHidden, bool const bCondition);
177cdf0e10cSrcweir 
178cdf0e10cSrcweir protected:
179cdf0e10cSrcweir     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
180cdf0e10cSrcweir 
181cdf0e10cSrcweir public:
182cdf0e10cSrcweir 	TYPEINFO();		// rtti
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     SwSection(SectionType const eType, String const& rName,
185cdf0e10cSrcweir                 SwSectionFmt & rFormat);
186cdf0e10cSrcweir     virtual ~SwSection();
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     bool DataEquals(SwSectionData const& rCmp) const;
189cdf0e10cSrcweir 
190cdf0e10cSrcweir     void SetSectionData(SwSectionData const& rData);
191cdf0e10cSrcweir 
GetSectionName() const192cdf0e10cSrcweir     String const& GetSectionName() const    { return m_Data.GetSectionName(); }
SetSectionName(String const & rName)193cdf0e10cSrcweir     void SetSectionName(String const& rName){ m_Data.SetSectionName(rName); }
GetType() const194cdf0e10cSrcweir     SectionType GetType() const             { return m_Data.GetType(); }
SetType(SectionType const eType)195cdf0e10cSrcweir     void SetType(SectionType const eType)   { return m_Data.SetType(eType); }
196cdf0e10cSrcweir 
GetFmt()197cdf0e10cSrcweir 	SwSectionFmt* GetFmt() 			{ return (SwSectionFmt*)GetRegisteredIn(); }
GetFmt() const198cdf0e10cSrcweir 	SwSectionFmt* GetFmt() const	{ return (SwSectionFmt*)GetRegisteredIn(); }
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 	// setze die Hidden/Protected -> gesamten Baum updaten !
201cdf0e10cSrcweir 	// (Attribute/Flags werden gesetzt/erfragt)
IsHidden() const202cdf0e10cSrcweir     bool IsHidden()  const { return m_Data.IsHidden(); }
203cdf0e10cSrcweir     void SetHidden (bool const bFlag = true);
204cdf0e10cSrcweir     bool IsProtect() const;
205cdf0e10cSrcweir     void SetProtect(bool const bFlag = true);
206cdf0e10cSrcweir     // --> FME 2004-06-22 #114856# edit in readonly sections
207cdf0e10cSrcweir     bool IsEditInReadonly() const;
208cdf0e10cSrcweir     void SetEditInReadonly(bool const bFlag = true);
209cdf0e10cSrcweir     // <--
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 	// erfrage die internen Flags (Zustand inklusive Parents nicht, was
212cdf0e10cSrcweir 	// aktuell an der Section gesetzt ist!!)
IsHiddenFlag() const213cdf0e10cSrcweir     bool IsHiddenFlag()  const { return m_Data.IsHiddenFlag(); }
IsProtectFlag() const214cdf0e10cSrcweir     bool IsProtectFlag() const { return m_Data.IsProtectFlag(); }
215cdf0e10cSrcweir     // --> FME 2004-06-22 #114856# edit in readonly sections
IsEditInReadonlyFlag() const216cdf0e10cSrcweir     bool IsEditInReadonlyFlag() const { return m_Data.IsEditInReadonlyFlag(); }
217cdf0e10cSrcweir     // <--
218cdf0e10cSrcweir 
219cdf0e10cSrcweir     void SetCondHidden(bool const bFlag = true);
IsCondHidden() const220cdf0e10cSrcweir     bool IsCondHidden() const { return m_Data.IsCondHidden(); }
221cdf0e10cSrcweir 	// erfrage (auch ueber die Parents), ob diese Section versteckt sein soll.
222cdf0e10cSrcweir 	sal_Bool CalcHiddenFlag() const;
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 	inline SwSection* GetParent() const;
226cdf0e10cSrcweir 
GetCondition() const227cdf0e10cSrcweir     String const& GetCondition() const      { return m_Data.GetCondition(); }
SetCondition(String const & rNew)228cdf0e10cSrcweir     void SetCondition(String const& rNew)   { m_Data.SetCondition(rNew); }
229cdf0e10cSrcweir 
230cdf0e10cSrcweir 	const String& GetLinkFileName() const;
231cdf0e10cSrcweir     void SetLinkFileName(String const& rNew, String const*const pPassWd = 0);
232cdf0e10cSrcweir     // password of linked file (only valid during runtime!)
GetLinkFilePassword() const233cdf0e10cSrcweir     String const& GetLinkFilePassword() const
234cdf0e10cSrcweir         { return m_Data.GetLinkFilePassword(); }
SetLinkFilePassword(String const & rS)235cdf0e10cSrcweir     void SetLinkFilePassword(String const& rS)
236cdf0e10cSrcweir         { m_Data.SetLinkFilePassword(rS); }
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 	// get / set password of this section
GetPassword() const239cdf0e10cSrcweir     ::com::sun::star::uno::Sequence<sal_Int8> const& GetPassword() const
240cdf0e10cSrcweir                                             { return m_Data.GetPassword(); }
SetPassword(::com::sun::star::uno::Sequence<sal_Int8> const & rNew)241cdf0e10cSrcweir     void SetPassword(::com::sun::star::uno::Sequence <sal_Int8> const& rNew)
242cdf0e10cSrcweir                                             { m_Data.SetPassword(rNew); }
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 	// Daten Server-Methoden
245cdf0e10cSrcweir 	void SetRefObject( SwServerObject* pObj );
GetObject() const246cdf0e10cSrcweir     const SwServerObject* GetObject() const {  return & m_RefObj; }
GetObject()247cdf0e10cSrcweir           SwServerObject* GetObject()       {  return & m_RefObj; }
IsServer() const248cdf0e10cSrcweir     bool IsServer() const                   {  return m_RefObj.Is(); }
249cdf0e10cSrcweir 
250cdf0e10cSrcweir 	// Methoden fuer gelinkte Bereiche
GetUpdateType() const251cdf0e10cSrcweir     sal_uInt16 GetUpdateType() const    { return m_RefLink->GetUpdateMode(); }
SetUpdateType(sal_uInt16 const nType)252cdf0e10cSrcweir     void SetUpdateType(sal_uInt16 const nType )
253cdf0e10cSrcweir         { m_RefLink->SetUpdateMode(nType); }
254cdf0e10cSrcweir 
IsConnected() const255cdf0e10cSrcweir     bool IsConnected() const        { return m_RefLink.Is(); }
UpdateNow()256cdf0e10cSrcweir     void UpdateNow()                { m_RefLink->Update(); }
Disconnect()257cdf0e10cSrcweir     void Disconnect()               { m_RefLink->Disconnect(); }
258cdf0e10cSrcweir 
GetBaseLink() const259cdf0e10cSrcweir     const ::sfx2::SvBaseLink& GetBaseLink() const    { return *m_RefLink; }
GetBaseLink()260cdf0e10cSrcweir           ::sfx2::SvBaseLink& GetBaseLink()          { return *m_RefLink; }
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 	void CreateLink( LinkCreateType eType );
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	void MakeChildLinksVisible( const SwSectionNode& rSectNd );
265cdf0e10cSrcweir 
IsLinkType() const266cdf0e10cSrcweir     bool IsLinkType() const { return m_Data.IsLinkType(); }
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 	// Flags fuer UI - Verbindung geklappt?
IsConnectFlag() const269cdf0e10cSrcweir     bool IsConnectFlag() const      { return m_Data.IsConnectFlag(); }
SetConnectFlag(bool const bFlag=true)270cdf0e10cSrcweir     void SetConnectFlag(bool const bFlag = true)
271cdf0e10cSrcweir                                     { m_Data.SetConnectFlag(bFlag); }
272cdf0e10cSrcweir 
273cdf0e10cSrcweir 	// return the TOX base class if the section is a TOX section
274cdf0e10cSrcweir 	const SwTOXBase* GetTOXBase() const;
275cdf0e10cSrcweir 
276cdf0e10cSrcweir     // --> OD 2007-02-14 #b6521322#
277cdf0e10cSrcweir     void BreakLink();
278cdf0e10cSrcweir     // <--
279cdf0e10cSrcweir 
280cdf0e10cSrcweir };
281cdf0e10cSrcweir 
282713b4dcdSMichael Stahl // --> OD #i117863#
283713b4dcdSMichael Stahl class SwSectionFrmMoveAndDeleteHint : public SfxSimpleHint
284713b4dcdSMichael Stahl {
285713b4dcdSMichael Stahl     public:
SwSectionFrmMoveAndDeleteHint(const sal_Bool bSaveCntnt)286713b4dcdSMichael Stahl         SwSectionFrmMoveAndDeleteHint( const sal_Bool bSaveCntnt )
287713b4dcdSMichael Stahl             : SfxSimpleHint( SFX_HINT_DYING )
288713b4dcdSMichael Stahl             , mbSaveCntnt( bSaveCntnt )
289713b4dcdSMichael Stahl         {}
290713b4dcdSMichael Stahl 
~SwSectionFrmMoveAndDeleteHint()291713b4dcdSMichael Stahl         ~SwSectionFrmMoveAndDeleteHint()
292713b4dcdSMichael Stahl         {}
293713b4dcdSMichael Stahl 
IsSaveCntnt() const294713b4dcdSMichael Stahl         sal_Bool IsSaveCntnt() const
295713b4dcdSMichael Stahl         {
296713b4dcdSMichael Stahl             return mbSaveCntnt;
297713b4dcdSMichael Stahl         }
298713b4dcdSMichael Stahl 
299713b4dcdSMichael Stahl     private:
300713b4dcdSMichael Stahl         const sal_Bool mbSaveCntnt;
301713b4dcdSMichael Stahl };
302713b4dcdSMichael Stahl // <--
303cdf0e10cSrcweir 
304cdf0e10cSrcweir enum SectionSort { SORTSECT_NOT, SORTSECT_NAME, SORTSECT_POS };
305cdf0e10cSrcweir 
306cdf0e10cSrcweir class SW_DLLPUBLIC SwSectionFmt
307cdf0e10cSrcweir     : public SwFrmFmt
308cdf0e10cSrcweir     , public ::sfx2::Metadatable
309cdf0e10cSrcweir {
310cdf0e10cSrcweir 	friend class SwDoc;
311cdf0e10cSrcweir 
312cdf0e10cSrcweir     /** why does this exist in addition to the m_wXObject in SwFrmFmt?
313cdf0e10cSrcweir         in case of an index, both a SwXDocumentIndex and a SwXTextSection
314cdf0e10cSrcweir         register at this SwSectionFmt, so we need to have two refs.
315cdf0e10cSrcweir      */
316cdf0e10cSrcweir     ::com::sun::star::uno::WeakReference<
317cdf0e10cSrcweir         ::com::sun::star::text::XTextSection> m_wXTextSection;
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 	SW_DLLPRIVATE void UpdateParent();		// Parent wurde veraendert
320cdf0e10cSrcweir 
321cdf0e10cSrcweir protected:
322cdf0e10cSrcweir 	SwSectionFmt( SwSectionFmt* pDrvdFrm, SwDoc *pDoc );
323cdf0e10cSrcweir    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
324cdf0e10cSrcweir 
325cdf0e10cSrcweir public:
326cdf0e10cSrcweir 	TYPEINFO();		//Bereits in Basisklasse Client drin.
327cdf0e10cSrcweir 	~SwSectionFmt();
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 	//Vernichtet alle Frms in aDepend (Frms werden per PTR_CAST erkannt).
330cdf0e10cSrcweir 	virtual void DelFrms();
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 	//Erzeugt die Ansichten
333cdf0e10cSrcweir 	virtual void MakeFrms();
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 		// erfrage vom Format Informationen
336cdf0e10cSrcweir 	virtual sal_Bool GetInfo( SfxPoolItem& ) const;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir     SwSection* GetSection() const;
339cdf0e10cSrcweir 	inline SwSectionFmt* GetParent() const;
340cdf0e10cSrcweir 	inline SwSection* GetParentSection() const;
341cdf0e10cSrcweir 
342cdf0e10cSrcweir 	// alle Sections, die von dieser abgeleitet sind
343cdf0e10cSrcweir 	// 	- sortiert nach : Name oder Position oder unsortiert
344cdf0e10cSrcweir 	//  - alle oder nur die, die sich im normalten Nodes-Array befinden
345cdf0e10cSrcweir 	sal_uInt16 GetChildSections( SwSections& rArr,
346cdf0e10cSrcweir 							SectionSort eSort = SORTSECT_NOT,
347cdf0e10cSrcweir 							sal_Bool bAllSections = sal_True ) const;
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 	// erfrage, ob sich die Section im Nodes-Array oder UndoNodes-Array
350cdf0e10cSrcweir 	// befindet.
351cdf0e10cSrcweir 	sal_Bool IsInNodesArr() const;
352cdf0e10cSrcweir 
353cdf0e10cSrcweir           SwSectionNode* GetSectionNode(bool const bEvenIfInUndo = false);
GetSectionNode(bool const bEvenIfInUndo=false) const354cdf0e10cSrcweir     const SwSectionNode* GetSectionNode(bool const bEvenIfInUndo = false) const
355cdf0e10cSrcweir         { return const_cast<SwSectionFmt *>(this)
356cdf0e10cSrcweir                 ->GetSectionNode(bEvenIfInUndo); }
357cdf0e10cSrcweir 
358cdf0e10cSrcweir 	// ist die Section eine gueltige fuers GlobalDocument?
359cdf0e10cSrcweir 	const SwSection* GetGlobalDocSection() const;
360cdf0e10cSrcweir 
361cdf0e10cSrcweir     SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
GetXTextSection() const362cdf0e10cSrcweir         ::com::sun::star::text::XTextSection> const& GetXTextSection() const
363cdf0e10cSrcweir             { return m_wXTextSection; }
SetXTextSection(::com::sun::star::uno::Reference<::com::sun::star::text::XTextSection> const & xTextSection)364cdf0e10cSrcweir     SW_DLLPRIVATE void SetXTextSection(::com::sun::star::uno::Reference<
365cdf0e10cSrcweir                     ::com::sun::star::text::XTextSection> const& xTextSection)
366cdf0e10cSrcweir             { m_wXTextSection = xTextSection; }
367cdf0e10cSrcweir 
368cdf0e10cSrcweir     // sfx2::Metadatable
369cdf0e10cSrcweir     virtual ::sfx2::IXmlIdRegistry& GetRegistry();
370cdf0e10cSrcweir     virtual bool IsInClipboard() const;
371cdf0e10cSrcweir     virtual bool IsInUndo() const;
372cdf0e10cSrcweir     virtual bool IsInContent() const;
373cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
374cdf0e10cSrcweir         ::com::sun::star::rdf::XMetadatable > MakeUnoObject();
375cdf0e10cSrcweir 
376cdf0e10cSrcweir };
377cdf0e10cSrcweir 
378cdf0e10cSrcweir // -------------- inlines ---------------------------------
379cdf0e10cSrcweir 
GetParent() const380cdf0e10cSrcweir inline SwSection* SwSection::GetParent() const
381cdf0e10cSrcweir {
382cdf0e10cSrcweir 	SwSectionFmt* pFmt = GetFmt();
383cdf0e10cSrcweir 	SwSection* pRet = 0;
384cdf0e10cSrcweir 	if( pFmt )
385cdf0e10cSrcweir 		pRet = pFmt->GetParentSection();
386cdf0e10cSrcweir 	return pRet;
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
GetParent() const389cdf0e10cSrcweir inline SwSectionFmt* SwSectionFmt::GetParent() const
390cdf0e10cSrcweir {
391cdf0e10cSrcweir 	SwSectionFmt* pRet = 0;
392cdf0e10cSrcweir 	if( GetRegisteredIn() )
393cdf0e10cSrcweir 		pRet = PTR_CAST( SwSectionFmt, GetRegisteredIn() );
394cdf0e10cSrcweir 	return pRet;
395cdf0e10cSrcweir }
396cdf0e10cSrcweir 
GetParentSection() const397cdf0e10cSrcweir inline SwSection* SwSectionFmt::GetParentSection() const
398cdf0e10cSrcweir {
399cdf0e10cSrcweir 	SwSectionFmt* pParent = GetParent();
400cdf0e10cSrcweir 	SwSection* pRet = 0;
401cdf0e10cSrcweir 	if( pParent )
402cdf0e10cSrcweir     {
403cdf0e10cSrcweir         pRet = pParent->GetSection();
404cdf0e10cSrcweir     }
405cdf0e10cSrcweir 	return pRet;
406cdf0e10cSrcweir }
407cdf0e10cSrcweir 
408cdf0e10cSrcweir 
409cdf0e10cSrcweir #endif /* _SECTION_HXX */
410