summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-04-27 11:18:42 +0900
committerTomaž Vajngerl <quikee@gmail.com>2019-04-27 06:48:18 +0200
commitcae53cf14d59bc2fa6317c9493197804928d6e5e (patch)
tree4420d17bf2c9f1aa001c98c5c140ebd7ed04c30e /include
parent55e28737e973b40f72d398c9bb7a4a41307eb562 (diff)
Decouple reading/writing of Color into GenericTypeSerializer
This adds GenericTypeSerializer, which is now responsible of serializing the Color into a stream (other types will follow), but only for the older version of the binary format. The new version we just write the sal_UInt32 mValue directly. This is a start of decoupling the serialization of generic types in tools and vcl module from the actual type, so we can in the future replace those with basegfx variant. Change-Id: I92738e7c178cac5cbca882dcbe45c80cc8269466 Reviewed-on: https://gerrit.libreoffice.org/71404 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/tools/GenericTypeSerializer.hxx47
-rw-r--r--include/tools/color.hxx6
2 files changed, 47 insertions, 6 deletions
diff --git a/include/tools/GenericTypeSerializer.hxx b/include/tools/GenericTypeSerializer.hxx
new file mode 100644
index 000000000000..90b5d002c8f1
--- /dev/null
+++ b/include/tools/GenericTypeSerializer.hxx
@@ -0,0 +1,47 @@
+/* -*- 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 .
+ */
+#ifndef INCLUDED_TOOLS_GENERICTYPESERIALIZER_HXX
+#define INCLUDED_TOOLS_GENERICTYPESERIALIZER_HXX
+
+#include <sal/types.h>
+#include <tools/toolsdllapi.h>
+#include <tools/color.hxx>
+#include <tools/stream.hxx>
+
+namespace tools
+{
+class TOOLS_DLLPUBLIC GenericTypeSerializer
+{
+public:
+ SvStream& mrStream;
+
+ GenericTypeSerializer(SvStream& rStream)
+ : mrStream(rStream)
+ {
+ }
+
+ void readColor(Color& rColor);
+ void writeColor(const Color& rColor);
+};
+
+} // end namespace tools
+
+#endif // INCLUDED_TOOLS_GENERICTYPESERIALIZER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/color.hxx b/include/tools/color.hxx
index 956b500ab752..4aea9a2d670e 100644
--- a/include/tools/color.hxx
+++ b/include/tools/color.hxx
@@ -171,12 +171,6 @@ public:
return !(Color::operator==(rColor));
}
- SvStream& Read(SvStream& rIStream);
- SvStream& Write(SvStream& rOStream) const;
-
- TOOLS_DLLPUBLIC friend SvStream& ReadColor(SvStream& rIStream, Color& rColor);
- TOOLS_DLLPUBLIC friend SvStream& WriteColor(SvStream& rOStream, const Color& rColor);
-
// Return color as RGB hex string
// for example "00ff00" for green color
OUString AsRGBHexString() const;