Update ooo320-m1
[ooovba.git] / sw / source / ui / config / caption.cxx
blobf06266e5cc8f59f8e3a499a788395074119167a3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: caption.cxx,v $
10 * $Revision: 1.9 $
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"
40 #define VERSION_01 1
41 #define CAPTION_VERSION VERSION_01
43 /*--------------------------------------------------------------------
44 Beschreibung:
45 --------------------------------------------------------------------*/
47 InsCaptionOpt::InsCaptionOpt(const SwCapObjType eType, const SvGlobalName* pOleId) :
48 bUseCaption(FALSE),
49 eObjType(eType),
50 nNumType(SVX_NUM_ARABIC),
51 sNumberSeparator( ::rtl::OUString::createFromAscii(". ") ),
52 nPos(1),
53 nLevel(0),
54 sSeparator( String::CreateFromAscii( ": " ) ),
55 bIgnoreSeqOpts(FALSE),
56 bCopyAttributes(FALSE)
58 if (pOleId)
59 aOleId = *pOleId;
62 /*--------------------------------------------------------------------
63 Beschreibung:
64 --------------------------------------------------------------------*/
66 InsCaptionOpt::InsCaptionOpt(const InsCaptionOpt& rOpt)
68 *this = rOpt;
71 /*--------------------------------------------------------------------
72 Beschreibung:
73 --------------------------------------------------------------------*/
75 InsCaptionOpt::~InsCaptionOpt()
79 /*--------------------------------------------------------------------
80 Beschreibung:
81 --------------------------------------------------------------------*/
83 InsCaptionOpt& InsCaptionOpt::operator=( const InsCaptionOpt& rOpt )
85 bUseCaption = rOpt.bUseCaption;
86 eObjType = rOpt.eObjType;
87 aOleId = rOpt.aOleId;
88 sCategory = rOpt.sCategory;
89 nNumType = rOpt.nNumType;
90 sNumberSeparator = rOpt.sNumberSeparator;
91 sCaption = rOpt.sCaption;
92 nPos = rOpt.nPos;
93 nLevel = rOpt.nLevel;
94 sSeparator = rOpt.sSeparator;
95 bIgnoreSeqOpts = rOpt.bIgnoreSeqOpts;
96 sCharacterStyle = rOpt.sCharacterStyle;
97 bCopyAttributes = rOpt.bCopyAttributes;
99 return *this;
102 /*--------------------------------------------------------------------
103 Beschreibung:
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
113 /* &&
114 sCategory == rOpt.sCategory &&
115 nNumType == rOpt.nNumType &&
116 sCaption == rOpt.sCaption &&
117 nPos == rOpt.nPos &&
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();
133 UINT16 nVal;
134 BYTE cVal;
135 BYTE nVersion;
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;
148 rIStream >> cVal;
149 rCapOpt.sSeparator = UniString(
150 ByteString(static_cast< char >(cVal)) , eEncoding).GetChar(0);
152 return rIStream;
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
169 << rCapOpt.aOleId;
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
180 << cSep;
182 return rOStream;