xref: /aoo41x/main/sw/source/ui/config/caption.cxx (revision efeef26f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 
28 #include <tools/debug.hxx>
29 
30 #include "numrule.hxx"
31 #include "caption.hxx"
32 
33 #define VERSION_01 		1
34 #define CAPTION_VERSION VERSION_01
35 
36 /*--------------------------------------------------------------------
37 	Beschreibung:
38  --------------------------------------------------------------------*/
39 
InsCaptionOpt(const SwCapObjType eType,const SvGlobalName * pOleId)40 InsCaptionOpt::InsCaptionOpt(const SwCapObjType eType, const SvGlobalName* pOleId) :
41 	bUseCaption(sal_False),
42 	eObjType(eType),
43 	nNumType(SVX_NUM_ARABIC),
44     sNumberSeparator( ::rtl::OUString::createFromAscii(". ") ),
45 	nPos(1),
46 	nLevel(0),
47 	sSeparator( String::CreateFromAscii( ": " ) ),
48 	bIgnoreSeqOpts(sal_False),
49 	bCopyAttributes(sal_False)
50 {
51 	if (pOleId)
52 		aOleId = *pOleId;
53 }
54 
55 /*--------------------------------------------------------------------
56 	Beschreibung:
57  --------------------------------------------------------------------*/
58 
InsCaptionOpt(const InsCaptionOpt & rOpt)59 InsCaptionOpt::InsCaptionOpt(const InsCaptionOpt& rOpt)
60 {
61 	*this = rOpt;
62 }
63 
64 /*--------------------------------------------------------------------
65 	Beschreibung:
66  --------------------------------------------------------------------*/
67 
~InsCaptionOpt()68 InsCaptionOpt::~InsCaptionOpt()
69 {
70 }
71 
72 /*--------------------------------------------------------------------
73 	Beschreibung:
74  --------------------------------------------------------------------*/
75 
operator =(const InsCaptionOpt & rOpt)76 InsCaptionOpt& InsCaptionOpt::operator=( const InsCaptionOpt& rOpt )
77 {
78 	bUseCaption = rOpt.bUseCaption;
79 	eObjType = rOpt.eObjType;
80 	aOleId = rOpt.aOleId;
81 	sCategory = rOpt.sCategory;
82 	nNumType = rOpt.nNumType;
83     sNumberSeparator = rOpt.sNumberSeparator;
84 	sCaption = rOpt.sCaption;
85 	nPos = rOpt.nPos;
86 	nLevel = rOpt.nLevel;
87 	sSeparator = rOpt.sSeparator;
88 	bIgnoreSeqOpts = rOpt.bIgnoreSeqOpts;
89     sCharacterStyle = rOpt.sCharacterStyle;
90 	bCopyAttributes = rOpt.bCopyAttributes;
91 
92 	return *this;
93 }
94 
95 /*--------------------------------------------------------------------
96 	Beschreibung:
97  --------------------------------------------------------------------*/
98 
operator ==(const InsCaptionOpt & rOpt) const99 sal_Bool InsCaptionOpt::operator==( const InsCaptionOpt& rOpt ) const
100 {
101 	return (eObjType == rOpt.eObjType &&
102 			aOleId == rOpt.aOleId);	// Damit gleiche Ole-IDs nicht mehrfach eingefuegt
103 									// werden koennen, auf nichts weiteres vergleichen
104 
105 
106 /*			 &&
107 			sCategory == rOpt.sCategory &&
108 			nNumType == rOpt.nNumType &&
109 			sCaption == rOpt.sCaption &&
110 			nPos == rOpt.nPos &&
111 			nLevel == rOpt.nLevel &&
112 			cSeparator == rOpt.cSeparator);*/
113 }
114 
115 /*************************************************************************
116 |*
117 |*    InsCaptionOpt::operator>>()
118 |*
119 |*    Beschreibung      Stream-Leseoperator
120 |*
121 *************************************************************************/
122 
123 /*SvStream& operator>>( SvStream& rIStream, InsCaptionOpt& rCapOpt )
124 {
125 	rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding();
126 	sal_uInt16 nVal;
127 	sal_uInt8   cVal;
128 	sal_uInt8   nVersion;
129 
130 	rIStream >> nVersion;
131 	rIStream >> cVal;				rCapOpt.UseCaption() = cVal != 0;
132 	rIStream >> nVal;				rCapOpt.eObjType = (SwCapObjType)nVal;
133 	rIStream >> rCapOpt.aOleId;
134 
135 	rIStream.ReadByteString( rCapOpt.sCategory, eEncoding );
136 	rIStream >> nVal;				rCapOpt.nNumType = nVal;
137 	rIStream.ReadByteString( rCapOpt.sCaption, eEncoding );
138 	rIStream >> nVal;				rCapOpt.nPos = nVal;
139 	rIStream >> nVal;				rCapOpt.nLevel = nVal;
140 
141 	rIStream >> cVal;
142 	rCapOpt.sSeparator = UniString(
143         ByteString(static_cast< char >(cVal)) , eEncoding).GetChar(0);
144 
145 	return rIStream;
146 }
147 */
148 /*************************************************************************
149 |*
150 |*    InsCaptionOpt::operator<<()
151 |*
152 |*    Beschreibung      Stream-Schreiboperator
153 |*
154 *************************************************************************/
155 
156 /*SvStream& operator<<( SvStream& rOStream, const InsCaptionOpt& rCapOpt )
157 {
158 	rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding();
159 	rOStream	<< (sal_uInt8)CAPTION_VERSION
160 				<< (sal_uInt8)rCapOpt.UseCaption()
161 				<< (sal_uInt16)rCapOpt.eObjType
162 				<< rCapOpt.aOleId;
163 
164 	rOStream.WriteByteString( rCapOpt.sCategory, eEncoding );
165 
166 	rOStream	<< (sal_uInt16)rCapOpt.nNumType;
167 
168 	rOStream.WriteByteString( rCapOpt.sCaption, eEncoding );
169 
170 	sal_uInt8 cSep = ByteString(rCapOpt.sSeparator, eEncoding).GetChar(0);
171 	rOStream 	<< (sal_uInt16)rCapOpt.nPos
172 				<< (sal_uInt16)rCapOpt.nLevel
173 				<< cSep;
174 
175 	return rOStream;
176 }
177 */
178 
179