1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <tools/debug.hxx>
22 #include "sdiocmpt.hxx"
24 //////////////////////////////////////////////////////////////////////////////
26 old_SdrDownCompat::old_SdrDownCompat(SvStream
& rNewStream
, sal_uInt16 nNewMode
)
27 : rStream(rNewStream
),
36 old_SdrDownCompat::~old_SdrDownCompat()
42 void old_SdrDownCompat::Read()
44 rStream
>> nSubRecSiz
;
47 void old_SdrDownCompat::Write()
49 rStream
<< nSubRecSiz
;
52 void old_SdrDownCompat::OpenSubRecord()
54 if(rStream
.GetError())
57 nSubRecPos
= rStream
.Tell();
59 if(nMode
== STREAM_READ
)
63 else if(nMode
== STREAM_WRITE
)
71 void old_SdrDownCompat::CloseSubRecord()
73 if(rStream
.GetError())
76 sal_uInt32
nAktPos(rStream
.Tell());
78 if(nMode
== STREAM_READ
)
80 sal_uInt32
nReadAnz(nAktPos
- nSubRecPos
);
81 if(nReadAnz
!= nSubRecSiz
)
83 rStream
.Seek(nSubRecPos
+ nSubRecSiz
);
86 else if(nMode
== STREAM_WRITE
)
88 nSubRecSiz
= nAktPos
- nSubRecPos
;
89 rStream
.Seek(nSubRecPos
);
91 rStream
.Seek(nAktPos
);
97 /*************************************************************************
99 |* Constructor, writes and reads version number
101 \************************************************************************/
103 SdIOCompat::SdIOCompat(SvStream
& rNewStream
, sal_uInt16 nNewMode
, sal_uInt16 nVer
)
104 : old_SdrDownCompat(rNewStream
, nNewMode
), nVersion(nVer
)
106 if (nNewMode
== STREAM_WRITE
)
108 DBG_ASSERT(nVer
!= SDIOCOMPAT_VERSIONDONTKNOW
,
109 "kann unbekannte Version nicht schreiben");
110 rNewStream
<< nVersion
;
112 else if (nNewMode
== STREAM_READ
)
114 DBG_ASSERT(nVer
== SDIOCOMPAT_VERSIONDONTKNOW
,
115 "Lesen mit Angabe der Version ist Quatsch!");
116 rNewStream
>> nVersion
;
120 SdIOCompat::~SdIOCompat()
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */