LibreOffice Module vcl (master)  1
Exif.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #pragma once
21 
22 #include <tools/stream.hxx>
23 #include <tools/degree.hxx>
24 
25 namespace exif {
26 
28  TOP_LEFT = 1,
29  TOP_RIGHT = 2,
32  LEFT_TOP = 5,
33  RIGHT_TOP = 6,
36 };
37 };
38 
39 enum Tag {
40  ORIENTATION = 0x0112
41 };
42 
43 class Exif final
44 {
45 private:
48 
49  bool processJpeg(SvStream& rStream, bool bSetValue);
50  bool processExif(SvStream& rStream, sal_uInt16 aLength, bool bSetValue);
51  void processIFD(sal_uInt8* pExifData, sal_uInt16 aLength, sal_uInt16 aOffset, sal_uInt16 aNumberOfTags, bool bSetValue, bool bLittleEndian);
52 
53  struct ExifIFD {
58  };
59 
60  struct TiffHeader {
61  sal_uInt16 byteOrder;
62  sal_uInt16 tagAlign;
63  sal_uInt32 offset;
64  };
65 
66  static exif::Orientation convertToOrientation(sal_Int32 value);
67 
68 public:
69  Exif();
70  ~Exif();
71 
72  bool hasExif() const { return mbExifPresent;}
73 
75  Degree10 getRotation() const;
76 
78 
79  bool read(SvStream& rStream);
80  void write(SvStream& rStream);
81 
82 };
83 
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool processJpeg(SvStream &rStream, bool bSetValue)
Definition: Exif.cxx:85
Definition: Exif.hxx:25
sal_uInt8 type[2]
Definition: Exif.hxx:55
sal_uInt8 offset[4]
Definition: Exif.hxx:57
void write(SvStream &rStream)
Definition: Exif.cxx:78
sal_uInt16 tagAlign
Definition: Exif.hxx:62
bool read(SvStream &rStream)
Definition: Exif.cxx:69
~Exif()
Definition: Exif.cxx:30
static exif::Orientation convertToOrientation(sal_Int32 value)
Definition: Exif.cxx:37
sal_uInt16 byteOrder
Definition: Exif.hxx:61
Tag
Definition: Exif.hxx:39
void setOrientation(exif::Orientation orientation)
Definition: Exif.cxx:33
sal_uInt8 tag[2]
Definition: Exif.hxx:54
bool mbExifPresent
Definition: Exif.hxx:47
Orientation
Definition: Exif.hxx:27
sal_uInt32 offset
Definition: Exif.hxx:63
exif::Orientation maOrientation
Definition: Exif.hxx:46
exif::Orientation getOrientation() const
Definition: Exif.hxx:74
unsigned char sal_uInt8
orientation
Definition: jobdata.hxx:27
void processIFD(sal_uInt8 *pExifData, sal_uInt16 aLength, sal_uInt16 aOffset, sal_uInt16 aNumberOfTags, bool bSetValue, bool bLittleEndian)
Definition: Exif.cxx:186
Definition: Exif.hxx:43
Exif()
Definition: Exif.cxx:25
Degree10 getRotation() const
Definition: Exif.cxx:52
bool processExif(SvStream &rStream, sal_uInt16 aLength, bool bSetValue)
Definition: Exif.cxx:217
sal_uInt8 count[4]
Definition: Exif.hxx:56
bool hasExif() const
Definition: Exif.hxx:72