diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2020-02-10 18:27:23 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-02-11 18:54:11 +0100 |
commit | 203abaaaaa33e6631315c735f6d42ad2c088a973 (patch) | |
tree | 95e1914c0e18b7014b9bfb4ab9b863b57db76264 | |
parent | 71395766532cace8cd981a77599b8ac74260ab57 (diff) |
move GraphicReader class out of graph.hxx
Change-Id: Id78995bfb8e8308a388ed542690ad85e4d19ce12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88425
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | include/vcl/graph.hxx | 24 | ||||
-rw-r--r-- | vcl/Library_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/inc/graphic/GraphicReader.hxx | 51 | ||||
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 1 | ||||
-rw-r--r-- | vcl/source/filter/igif/gifread.cxx | 1 | ||||
-rw-r--r-- | vcl/source/filter/ixbm/xbmread.cxx | 1 | ||||
-rw-r--r-- | vcl/source/filter/ixpm/xpmread.cxx | 1 | ||||
-rw-r--r-- | vcl/source/filter/jpeg/JpegReader.hxx | 1 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 35 | ||||
-rw-r--r-- | vcl/source/graphic/GraphicReader.cxx | 56 |
10 files changed, 114 insertions, 58 deletions
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index a30b3909e899..c1fadb49d9cb 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -32,7 +32,6 @@ #include <basegfx/vector/b2dsize.hxx> #include <vcl/GraphicExternalLink.hxx> - enum class GraphicType { NONE, @@ -49,28 +48,7 @@ class GDIMetaFile; class SvStream; class ImpGraphic; class OutputDevice; -class ReaderData; - -class GraphicReader -{ -public: - virtual ~GraphicReader(); - - const OUString& GetUpperFilterName() const { return maUpperName; } - - // TODO: when incompatible changes are possible again - // the preview size hint should be redone - void DisablePreviewMode(); - void SetPreviewSize( const Size& ); - Size GetPreviewSize() const; - -protected: - OUString maUpperName; - - GraphicReader(); -private: - std::unique_ptr<ReaderData> mpReaderData; -}; +class GraphicReader; class VCL_DLLPUBLIC GraphicConversionParameters { diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 6728447a7817..1b5a6db8ec65 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -321,6 +321,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/graphic/GraphicLoader \ vcl/source/graphic/GraphicObject \ vcl/source/graphic/GraphicObject2 \ + vcl/source/graphic/GraphicReader \ vcl/source/graphic/grfattr \ vcl/source/graphic/Manager \ vcl/source/graphic/UnoGraphic \ diff --git a/vcl/inc/graphic/GraphicReader.hxx b/vcl/inc/graphic/GraphicReader.hxx new file mode 100644 index 000000000000..fe60ecf97b29 --- /dev/null +++ b/vcl/inc/graphic/GraphicReader.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <vcl/dllapi.h> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <memory> + +class ReaderData; + +class GraphicReader +{ +public: + virtual ~GraphicReader(); + + const OUString& GetUpperFilterName() const { return maUpperName; } + + // TODO: when incompatible changes are possible again + // the preview size hint should be redone + void DisablePreviewMode(); + void SetPreviewSize(const Size&); + Size GetPreviewSize() const; + +protected: + OUString maUpperName; + + GraphicReader(); + +private: + std::unique_ptr<ReaderData> mpReaderData; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 088c9eeea3ec..c32015e7d222 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -71,6 +71,7 @@ #include "graphicfilter_internal.hxx" #include <graphic/GraphicFormatDetector.hxx> +#include <graphic/GraphicReader.hxx> #define PMGCHUNG_msOG 0x6d734f47 // Microsoft Office Animated GIF diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 1e30f5b637f5..f940bff2416a 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -23,6 +23,7 @@ #include "gifread.hxx" #include <memory> #include <bitmapwriteaccess.hxx> +#include <graphic/GraphicReader.hxx> #define NO_PENDING( rStm ) ( ( rStm ).GetError() != ERRCODE_IO_PENDING ) diff --git a/vcl/source/filter/ixbm/xbmread.cxx b/vcl/source/filter/ixbm/xbmread.cxx index f6a4a8e94528..a2febe81b767 100644 --- a/vcl/source/filter/ixbm/xbmread.cxx +++ b/vcl/source/filter/ixbm/xbmread.cxx @@ -23,6 +23,7 @@ #include <rtl/character.hxx> #include <bitmapwriteaccess.hxx> +#include <graphic/GraphicReader.hxx> #include "xbmread.hxx" diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx index c82896c4c269..fdf64e0fc51d 100644 --- a/vcl/source/filter/ixpm/xpmread.cxx +++ b/vcl/source/filter/ixpm/xpmread.cxx @@ -20,6 +20,7 @@ #include <bitmapwriteaccess.hxx> #include <vcl/graph.hxx> #include <tools/stream.hxx> +#include <graphic/GraphicReader.hxx> #include "rgbtable.hxx" #include "xpmread.hxx" #include <cstring> diff --git a/vcl/source/filter/jpeg/JpegReader.hxx b/vcl/source/filter/jpeg/JpegReader.hxx index 60d0cc85a09b..41fb0fdb5c59 100644 --- a/vcl/source/filter/jpeg/JpegReader.hxx +++ b/vcl/source/filter/jpeg/JpegReader.hxx @@ -23,6 +23,7 @@ #include <vcl/graph.hxx> #include <vcl/bitmap.hxx> #include <bitmapwriteaccess.hxx> +#include <graphic/GraphicReader.hxx> enum class GraphicFilterImportFlags; diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index f8292b30fd05..7e9c96feddf2 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -69,41 +69,6 @@ struct ImpSwapFile ~ImpSwapFile(); }; -class ReaderData -{ -public: - Size maPreviewSize; -}; - -GraphicReader::GraphicReader() -{ -} - -GraphicReader::~GraphicReader() -{ -} - -void GraphicReader::DisablePreviewMode() -{ - if( mpReaderData ) - mpReaderData->maPreviewSize = Size( 0, 0 ); -} - -void GraphicReader::SetPreviewSize( const Size& rSize ) -{ - if( !mpReaderData ) - mpReaderData.reset( new ReaderData ); - mpReaderData->maPreviewSize = rSize; -} - -Size GraphicReader::GetPreviewSize() const -{ - Size aSize( 0, 0 ); - if( mpReaderData ) - aSize = mpReaderData->maPreviewSize; - return aSize; -} - GraphicID::GraphicID(ImpGraphic const & rGraphic) { rGraphic.ensureAvailable(); diff --git a/vcl/source/graphic/GraphicReader.cxx b/vcl/source/graphic/GraphicReader.cxx new file mode 100644 index 000000000000..060b8e32c2ba --- /dev/null +++ b/vcl/source/graphic/GraphicReader.cxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <graphic/GraphicReader.hxx> + +#include <sal/config.h> +#include <sal/log.hxx> + +class ReaderData +{ +public: + Size maPreviewSize; +}; + +GraphicReader::GraphicReader() {} + +GraphicReader::~GraphicReader() {} + +void GraphicReader::DisablePreviewMode() +{ + if (mpReaderData) + mpReaderData->maPreviewSize = Size(0, 0); +} + +void GraphicReader::SetPreviewSize(const Size& rSize) +{ + if (!mpReaderData) + mpReaderData.reset(new ReaderData); + mpReaderData->maPreviewSize = rSize; +} + +Size GraphicReader::GetPreviewSize() const +{ + Size aSize(0, 0); + if (mpReaderData) + aSize = mpReaderData->maPreviewSize; + return aSize; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |