xref: /trunk/main/sw/source/ui/config/caption.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 
32 #include <tools/debug.hxx>
33 
34 #include "numrule.hxx"
35 #include "caption.hxx"
36 
37 #define VERSION_01      1
38 #define CAPTION_VERSION VERSION_01
39 
40 /*--------------------------------------------------------------------
41     Beschreibung:
42  --------------------------------------------------------------------*/
43 
44 InsCaptionOpt::InsCaptionOpt(const SwCapObjType eType, const SvGlobalName* pOleId) :
45     bUseCaption(sal_False),
46     eObjType(eType),
47     nNumType(SVX_NUM_ARABIC),
48     sNumberSeparator( ::rtl::OUString::createFromAscii(". ") ),
49     nPos(1),
50     nLevel(0),
51     sSeparator( String::CreateFromAscii( ": " ) ),
52     bIgnoreSeqOpts(sal_False),
53     bCopyAttributes(sal_False)
54 {
55     if (pOleId)
56         aOleId = *pOleId;
57 }
58 
59 /*--------------------------------------------------------------------
60     Beschreibung:
61  --------------------------------------------------------------------*/
62 
63 InsCaptionOpt::InsCaptionOpt(const InsCaptionOpt& rOpt)
64 {
65     *this = rOpt;
66 }
67 
68 /*--------------------------------------------------------------------
69     Beschreibung:
70  --------------------------------------------------------------------*/
71 
72 InsCaptionOpt::~InsCaptionOpt()
73 {
74 }
75 
76 /*--------------------------------------------------------------------
77     Beschreibung:
78  --------------------------------------------------------------------*/
79 
80 InsCaptionOpt& InsCaptionOpt::operator=( const InsCaptionOpt& rOpt )
81 {
82     bUseCaption = rOpt.bUseCaption;
83     eObjType = rOpt.eObjType;
84     aOleId = rOpt.aOleId;
85     sCategory = rOpt.sCategory;
86     nNumType = rOpt.nNumType;
87     sNumberSeparator = rOpt.sNumberSeparator;
88     sCaption = rOpt.sCaption;
89     nPos = rOpt.nPos;
90     nLevel = rOpt.nLevel;
91     sSeparator = rOpt.sSeparator;
92     bIgnoreSeqOpts = rOpt.bIgnoreSeqOpts;
93     sCharacterStyle = rOpt.sCharacterStyle;
94     bCopyAttributes = rOpt.bCopyAttributes;
95 
96     return *this;
97 }
98 
99 /*--------------------------------------------------------------------
100     Beschreibung:
101  --------------------------------------------------------------------*/
102 
103 sal_Bool InsCaptionOpt::operator==( const InsCaptionOpt& rOpt ) const
104 {
105     return (eObjType == rOpt.eObjType &&
106             aOleId == rOpt.aOleId); // Damit gleiche Ole-IDs nicht mehrfach eingefuegt
107                                     // werden koennen, auf nichts weiteres vergleichen
108 
109 
110 /*           &&
111             sCategory == rOpt.sCategory &&
112             nNumType == rOpt.nNumType &&
113             sCaption == rOpt.sCaption &&
114             nPos == rOpt.nPos &&
115             nLevel == rOpt.nLevel &&
116             cSeparator == rOpt.cSeparator);*/
117 }
118 
119 /*************************************************************************
120 |*
121 |*    InsCaptionOpt::operator>>()
122 |*
123 |*    Beschreibung      Stream-Leseoperator
124 |*
125 *************************************************************************/
126 
127 /*SvStream& operator>>( SvStream& rIStream, InsCaptionOpt& rCapOpt )
128 {
129     rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding();
130     sal_uInt16 nVal;
131     sal_uInt8   cVal;
132     sal_uInt8   nVersion;
133 
134     rIStream >> nVersion;
135     rIStream >> cVal;               rCapOpt.UseCaption() = cVal != 0;
136     rIStream >> nVal;               rCapOpt.eObjType = (SwCapObjType)nVal;
137     rIStream >> rCapOpt.aOleId;
138 
139     rIStream.ReadByteString( rCapOpt.sCategory, eEncoding );
140     rIStream >> nVal;               rCapOpt.nNumType = nVal;
141     rIStream.ReadByteString( rCapOpt.sCaption, eEncoding );
142     rIStream >> nVal;               rCapOpt.nPos = nVal;
143     rIStream >> nVal;               rCapOpt.nLevel = nVal;
144 
145     rIStream >> cVal;
146     rCapOpt.sSeparator = UniString(
147         ByteString(static_cast< char >(cVal)) , eEncoding).GetChar(0);
148 
149     return rIStream;
150 }
151 */
152 /*************************************************************************
153 |*
154 |*    InsCaptionOpt::operator<<()
155 |*
156 |*    Beschreibung      Stream-Schreiboperator
157 |*
158 *************************************************************************/
159 
160 /*SvStream& operator<<( SvStream& rOStream, const InsCaptionOpt& rCapOpt )
161 {
162     rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding();
163     rOStream    << (sal_uInt8)CAPTION_VERSION
164                 << (sal_uInt8)rCapOpt.UseCaption()
165                 << (sal_uInt16)rCapOpt.eObjType
166                 << rCapOpt.aOleId;
167 
168     rOStream.WriteByteString( rCapOpt.sCategory, eEncoding );
169 
170     rOStream    << (sal_uInt16)rCapOpt.nNumType;
171 
172     rOStream.WriteByteString( rCapOpt.sCaption, eEncoding );
173 
174     sal_uInt8 cSep = ByteString(rCapOpt.sSeparator, eEncoding).GetChar(0);
175     rOStream    << (sal_uInt16)rCapOpt.nPos
176                 << (sal_uInt16)rCapOpt.nLevel
177                 << cSep;
178 
179     return rOStream;
180 }
181 */
182 
183