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