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: editobj2.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 ************************************************************************/
34 #include <svx/editobj.hxx>
35 #include <editdoc.hxx>
37 #include <vcl/fontcvt.hxx>
40 class SfxStyleSheetPool
;
44 friend class ContentInfo
; // fuer DTOR
45 friend class BinTextObject
; // fuer DTOR
48 const SfxPoolItem
* pItem
;
53 XEditAttribute( const XEditAttribute
& rCopyFrom
);
58 XEditAttribute( const SfxPoolItem
& rAttr
);
59 XEditAttribute( const SfxPoolItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
61 const SfxPoolItem
* GetItem() const { return pItem
; }
63 USHORT
& GetStart() { return nStart
; }
64 USHORT
& GetEnd() { return nEnd
; }
66 USHORT
GetStart() const { return nStart
; }
67 USHORT
GetEnd() const { return nEnd
; }
69 USHORT
GetLen() const { return nEnd
-nStart
; }
71 inline BOOL
IsFeature();
73 inline bool operator==( const XEditAttribute
& rCompare
);
76 inline bool XEditAttribute::operator==( const XEditAttribute
& rCompare
)
78 return (nStart
== rCompare
.nStart
) &&
79 (nEnd
== rCompare
.nEnd
) &&
80 ( (pItem
== rCompare
.pItem
) ||
81 ( pItem
->Which() != rCompare
.pItem
->Which()) ||
82 (*pItem
== *rCompare
.pItem
));
85 inline BOOL
XEditAttribute::IsFeature()
87 USHORT nWhich
= pItem
->Which();
88 return ( ( nWhich
>= EE_FEATURE_START
) &&
89 ( nWhich
<= EE_FEATURE_END
) );
92 typedef XEditAttribute
* XEditAttributePtr
;
93 SV_DECL_PTRARR( XEditAttributeListImpl
, XEditAttributePtr
, 0, 4 )
95 class XEditAttributeList
: public XEditAttributeListImpl
98 XEditAttribute
* FindAttrib( USHORT nWhich
, USHORT nChar
) const;
104 USHORT nFirstLineOffset
;
107 TextPortionList aTextPortions
;
110 typedef XParaPortion
* XParaPortionPtr
;
111 SV_DECL_PTRARR( XBaseParaPortionList
, XParaPortionPtr
, 0, 4 )
113 class XParaPortionList
: public XBaseParaPortionList
116 OutDevType eRefDevType
;
118 sal_uInt16 nStretchX
;
119 sal_uInt16 nStretchY
;
124 XParaPortionList( OutputDevice
* pRefDev
, ULONG nPW
, sal_uInt16 _nStretchX
, sal_uInt16 _nStretchY
) :
125 aRefMapMode( pRefDev
->GetMapMode() ),
126 nStretchX(_nStretchX
),
127 nStretchY(_nStretchY
)
129 nRefDevPtr
= (ULONG
)pRefDev
; nPaperWidth
= nPW
;
130 eRefDevType
= pRefDev
->GetOutDevType();
133 ULONG
GetRefDevPtr() const { return nRefDevPtr
; }
134 ULONG
GetPaperWidth() const { return nPaperWidth
; }
135 OutDevType
GetRefDevType() const { return eRefDevType
; }
136 const MapMode
& GetRefMapMode() const { return aRefMapMode
; }
137 sal_uInt16
GetStretchX() const { return nStretchX
; }
138 sal_uInt16
GetStretchY() const { return nStretchY
; }
141 /* cl removed because not needed anymore since binfilter
142 struct LoadStoreTempInfos
144 ByteString aOrgString_Load;
146 FontToSubsFontConverter hOldSymbolConv_Store;
147 BOOL bSymbolParagraph_Store;
150 LoadStoreTempInfos() { bSymbolParagraph_Store = FALSE; hOldSymbolConv_Store = NULL; }
156 friend class BinTextObject
;
161 XEditAttributeList aAttribs
;
162 SfxStyleFamily eFamily
;
163 SfxItemSet aParaAttribs
;
166 /* cl removed because not needed anymore since binfilter
167 LoadStoreTempInfos* pTempLoadStoreInfos;
170 ContentInfo( SfxItemPool
& rPool
);
171 ContentInfo( const ContentInfo
& rCopyFrom
, SfxItemPool
& rPoolToUse
);
176 const String
& GetText() const { return aText
; }
177 const String
& GetStyle() const { return aStyle
; }
178 const XEditAttributeList
& GetAttribs() const { return aAttribs
; }
179 const SfxItemSet
& GetParaAttribs() const { return aParaAttribs
; }
180 SfxStyleFamily
GetFamily() const { return eFamily
; }
182 String
& GetText() { return aText
; }
183 String
& GetStyle() { return aStyle
; }
184 XEditAttributeList
& GetAttribs() { return aAttribs
; }
185 SfxItemSet
& GetParaAttribs() { return aParaAttribs
; }
186 SfxStyleFamily
& GetFamily() { return eFamily
; }
188 WrongList
* GetWrongList() const { return pWrongs
; }
189 void SetWrongList( WrongList
* p
) { pWrongs
= p
; }
190 bool operator==( const ContentInfo
& rCompare
) const;
193 bool isWrongListEqual(const ContentInfo
& rCompare
) const;
196 typedef ContentInfo
* ContentInfoPtr
;
197 SV_DECL_PTRARR( ContentInfoList
, ContentInfoPtr
, 1, 4 )
199 // MT 05/00: Sollte mal direkt EditTextObjekt werden => keine virtuellen Methoden mehr.
201 class BinTextObject
: public EditTextObject
, public SfxItemPoolUser
203 using EditTextObject::operator==;
204 using EditTextObject::isWrongListEqual
;
207 ContentInfoList aContents
;
210 XParaPortionList
* pPortionInfo
;
212 sal_uInt32 nObjSettings
;
219 BOOL bStoreUnicodeStrings
;
222 void DeleteContents();
223 virtual void StoreData( SvStream
& rOStream
) const;
224 virtual void CreateData( SvStream
& rIStream
);
225 BOOL
ImpChangeStyleSheets( const String
& rOldName
, SfxStyleFamily eOldFamily
,
226 const String
& rNewName
, SfxStyleFamily eNewFamily
);
229 BinTextObject( SfxItemPool
* pPool
);
230 BinTextObject( const BinTextObject
& );
231 virtual ~BinTextObject();
233 virtual EditTextObject
* Clone() const;
235 USHORT
GetUserType() const;
236 void SetUserType( USHORT n
);
238 ULONG
GetObjectSettings() const;
239 void SetObjectSettings( ULONG n
);
241 BOOL
IsVertical() const;
242 void SetVertical( BOOL b
);
244 USHORT
GetScriptType() const;
245 void SetScriptType( USHORT nType
);
247 USHORT
GetVersion() const; // Solange der Outliner keine Recordlaenge speichert
249 ContentInfo
* CreateAndInsertContent();
250 XEditAttribute
* CreateAttrib( const SfxPoolItem
& rItem
, USHORT nStart
, USHORT nEnd
);
251 void DestroyAttrib( XEditAttribute
* pAttr
);
253 ContentInfoList
& GetContents() { return aContents
; }
254 const ContentInfoList
& GetContents() const { return aContents
; }
255 SfxItemPool
* GetPool() const { return pPool
; }
256 XParaPortionList
* GetPortionInfo() const { return pPortionInfo
; }
257 void SetPortionInfo( XParaPortionList
* pP
)
258 { pPortionInfo
= pP
; }
260 virtual USHORT
GetParagraphCount() const;
261 virtual String
GetText( USHORT nParagraph
) const;
262 virtual void Insert( const EditTextObject
& rObj
, USHORT nPara
);
263 virtual EditTextObject
* CreateTextObject( USHORT nPara
, USHORT nParas
= 1 ) const;
264 virtual void RemoveParagraph( USHORT nPara
);
266 virtual BOOL
HasPortionInfo() const;
267 virtual void ClearPortionInfo();
269 virtual BOOL
HasOnlineSpellErrors() const;
271 virtual BOOL
HasCharAttribs( USHORT nWhich
= 0 ) const;
272 virtual void GetCharAttribs( USHORT nPara
, EECharAttribArray
& rLst
) const;
274 virtual BOOL
RemoveCharAttribs( USHORT nWhich
= 0 );
275 virtual BOOL
RemoveParaAttribs( USHORT nWhich
= 0 );
277 virtual void MergeParaAttribs( const SfxItemSet
& rAttribs
, USHORT nStart
, USHORT nEnd
);
279 virtual BOOL
IsFieldObject() const;
280 virtual const SvxFieldItem
* GetField() const;
281 virtual BOOL
HasField( TypeId Type
= NULL
) const;
283 SfxItemSet
GetParaAttribs( USHORT nPara
) const;
284 void SetParaAttribs( USHORT nPara
, const SfxItemSet
& rAttribs
);
286 virtual BOOL
HasStyleSheet( const XubString
& rName
, SfxStyleFamily eFamily
) const;
287 virtual void GetStyleSheet( USHORT nPara
, XubString
& rName
, SfxStyleFamily
& eFamily
) const;
288 virtual void SetStyleSheet( USHORT nPara
, const XubString
& rName
, const SfxStyleFamily
& eFamily
);
289 virtual BOOL
ChangeStyleSheets( const XubString
& rOldName
, SfxStyleFamily eOldFamily
,
290 const String
& rNewName
, SfxStyleFamily eNewFamily
);
291 virtual void ChangeStyleSheetName( SfxStyleFamily eFamily
, const XubString
& rOldName
, const XubString
& rNewName
);
293 void CreateData300( SvStream
& rIStream
);
295 BOOL
HasMetric() const { return nMetric
!= 0xFFFF; }
296 USHORT
GetMetric() const { return nMetric
; }
297 void SetMetric( USHORT n
) { nMetric
= n
; }
299 BOOL
IsOwnerOfPool() const { return bOwnerOfPool
; }
300 void StoreUnicodeStrings( BOOL b
) { bStoreUnicodeStrings
= b
; }
302 /* cl removed because not needed anymore since binfilter
303 void PrepareStore( SfxStyleSheetPool* pStyleSheetPool );
305 void FinishLoad( SfxStyleSheetPool* pStyleSheetPool );
308 bool operator==( const BinTextObject
& rCompare
) const;
311 bool isWrongListEqual(const BinTextObject
& rCompare
) const;
313 // from SfxItemPoolUser
314 virtual void ObjectInDestruction(const SfxItemPool
& rSfxItemPool
);
317 #endif // _EDITOBJ2_HXX