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