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: caption.cxx,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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <tools/debug.hxx>
37 #include "numrule.hxx"
38 #include "caption.hxx"
41 #define CAPTION_VERSION VERSION_01
43 /*--------------------------------------------------------------------
45 --------------------------------------------------------------------*/
47 InsCaptionOpt::InsCaptionOpt(const SwCapObjType eType
, const SvGlobalName
* pOleId
) :
50 nNumType(SVX_NUM_ARABIC
),
51 sNumberSeparator( ::rtl::OUString::createFromAscii(". ") ),
54 sSeparator( String::CreateFromAscii( ": " ) ),
55 bIgnoreSeqOpts(FALSE
),
56 bCopyAttributes(FALSE
)
62 /*--------------------------------------------------------------------
64 --------------------------------------------------------------------*/
66 InsCaptionOpt::InsCaptionOpt(const InsCaptionOpt
& rOpt
)
71 /*--------------------------------------------------------------------
73 --------------------------------------------------------------------*/
75 InsCaptionOpt::~InsCaptionOpt()
79 /*--------------------------------------------------------------------
81 --------------------------------------------------------------------*/
83 InsCaptionOpt
& InsCaptionOpt::operator=( const InsCaptionOpt
& rOpt
)
85 bUseCaption
= rOpt
.bUseCaption
;
86 eObjType
= rOpt
.eObjType
;
88 sCategory
= rOpt
.sCategory
;
89 nNumType
= rOpt
.nNumType
;
90 sNumberSeparator
= rOpt
.sNumberSeparator
;
91 sCaption
= rOpt
.sCaption
;
94 sSeparator
= rOpt
.sSeparator
;
95 bIgnoreSeqOpts
= rOpt
.bIgnoreSeqOpts
;
96 sCharacterStyle
= rOpt
.sCharacterStyle
;
97 bCopyAttributes
= rOpt
.bCopyAttributes
;
102 /*--------------------------------------------------------------------
104 --------------------------------------------------------------------*/
106 BOOL
InsCaptionOpt::operator==( const InsCaptionOpt
& rOpt
) const
108 return (eObjType
== rOpt
.eObjType
&&
109 aOleId
== rOpt
.aOleId
); // Damit gleiche Ole-IDs nicht mehrfach eingefuegt
110 // werden koennen, auf nichts weiteres vergleichen
114 sCategory == rOpt.sCategory &&
115 nNumType == rOpt.nNumType &&
116 sCaption == rOpt.sCaption &&
118 nLevel == rOpt.nLevel &&
119 cSeparator == rOpt.cSeparator);*/
122 /*************************************************************************
124 |* InsCaptionOpt::operator>>()
126 |* Beschreibung Stream-Leseoperator
128 *************************************************************************/
130 /*SvStream& operator>>( SvStream& rIStream, InsCaptionOpt& rCapOpt )
132 rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding();
137 rIStream >> nVersion;
138 rIStream >> cVal; rCapOpt.UseCaption() = cVal != 0;
139 rIStream >> nVal; rCapOpt.eObjType = (SwCapObjType)nVal;
140 rIStream >> rCapOpt.aOleId;
142 rIStream.ReadByteString( rCapOpt.sCategory, eEncoding );
143 rIStream >> nVal; rCapOpt.nNumType = nVal;
144 rIStream.ReadByteString( rCapOpt.sCaption, eEncoding );
145 rIStream >> nVal; rCapOpt.nPos = nVal;
146 rIStream >> nVal; rCapOpt.nLevel = nVal;
149 rCapOpt.sSeparator = UniString(
150 ByteString(static_cast< char >(cVal)) , eEncoding).GetChar(0);
155 /*************************************************************************
157 |* InsCaptionOpt::operator<<()
159 |* Beschreibung Stream-Schreiboperator
161 *************************************************************************/
163 /*SvStream& operator<<( SvStream& rOStream, const InsCaptionOpt& rCapOpt )
165 rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding();
166 rOStream << (BYTE)CAPTION_VERSION
167 << (BYTE)rCapOpt.UseCaption()
168 << (UINT16)rCapOpt.eObjType
171 rOStream.WriteByteString( rCapOpt.sCategory, eEncoding );
173 rOStream << (UINT16)rCapOpt.nNumType;
175 rOStream.WriteByteString( rCapOpt.sCaption, eEncoding );
177 BYTE cSep = ByteString(rCapOpt.sSeparator, eEncoding).GetChar(0);
178 rOStream << (UINT16)rCapOpt.nPos
179 << (UINT16)rCapOpt.nLevel