summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorAditya <adityasahu1511@gmail.com>2020-06-10 14:52:20 +0530
committerTomaž Vajngerl <quikee@gmail.com>2020-06-13 10:50:28 +0200
commite0c9ed26b982813a3f26e350b25caec395d44653 (patch)
tree6298ad53247c04eada14d98a528f866669079152 /svx
parentc98affa44e3f61279ae9fe052dbcfbda0c58838e (diff)
svx: Gallery code refactoring
Older classes like Gallery, GalleryTheme, GalleryThemeEntry have reading and writing data members and member functions included in the classes which makes the code unclear and less organized. Introduce new class Gallery Binary Engine that would deal with these member functions in such a way that older classes will have no knowledge about reading and writing. Only change the internal structure of the project and no change in behaviour of output must be there. Change-Id: Ia05eb3c692976b775a3d00e7d09fecc861bced2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95922 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/Library_svxcore.mk1
-rw-r--r--svx/source/gallery2/gallery1.cxx16
-rwxr-xr-xsvx/source/gallery2/gallerybinaryengine.cxx47
3 files changed, 53 insertions, 11 deletions
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index cf23b824ca3e..430b35e9299c 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -152,6 +152,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/gallery2/galobj \
svx/source/gallery2/galtheme \
svx/source/gallery2/GalleryControl \
+ svx/source/gallery2/gallerybinaryengine \
svx/source/items/chrtitem \
svx/source/items/clipfmtitem \
svx/source/items/customshapeitem \
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index 685f3d99df5e..7a5fd36761be 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -41,6 +41,7 @@
#include <svx/galmisc.hxx>
#include <svx/galtheme.hxx>
#include <svx/gallery1.hxx>
+#include <svx/gallerybinaryengine.hxx>
#include <vcl/weld.hxx>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
@@ -136,17 +137,10 @@ GalleryThemeEntry::GalleryThemeEntry( bool bCreateUniqueURL,
}
}
- aURL.setExtension( "thm" );
- aThmURL = ImplGetURLIgnoreCase( aURL );
-
- aURL.setExtension( "sdg" );
- aSdgURL = ImplGetURLIgnoreCase( aURL );
-
- aURL.setExtension( "sdv" );
- aSdvURL = ImplGetURLIgnoreCase( aURL );
-
- aURL.setExtension( "str" );
- aStrURL = ImplGetURLIgnoreCase( aURL );
+ maGalleryBinaryEngine.SetThmExtension(aURL);
+ maGalleryBinaryEngine.SetSdgExtension(aURL);
+ maGalleryBinaryEngine.SetSdvExtension(aURL);
+ maGalleryBinaryEngine.SetStrExtension(aURL);
SetModified( _bNewFile );
diff --git a/svx/source/gallery2/gallerybinaryengine.cxx b/svx/source/gallery2/gallerybinaryengine.cxx
new file mode 100755
index 000000000000..201ed1209530
--- /dev/null
+++ b/svx/source/gallery2/gallerybinaryengine.cxx
@@ -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 .
+ */
+
+#include <svx/gallerybinaryengine.hxx>
+#include <svx/gallery1.hxx>
+
+#include <tools/urlobj.hxx>
+
+void GalleryBinaryEngine::SetThmExtension(INetURLObject aURL)
+{
+ aURL.setExtension("thm");
+ aThmURL = GalleryThemeEntry::ImplGetURLIgnoreCase(aURL);
+}
+
+void GalleryBinaryEngine::SetSdgExtension(INetURLObject aURL)
+{
+ aURL.setExtension("sdg");
+ aSdgURL = GalleryThemeEntry::ImplGetURLIgnoreCase(aURL);
+}
+
+void GalleryBinaryEngine::SetSdvExtension(INetURLObject aURL)
+{
+ aURL.setExtension("sdv");
+ aSdvURL = GalleryThemeEntry::ImplGetURLIgnoreCase(aURL);
+}
+
+void GalleryBinaryEngine::SetStrExtension(INetURLObject aURL)
+{
+ aURL.setExtension("str");
+ aStrURL = GalleryThemeEntry::ImplGetURLIgnoreCase(aURL);
+}