[Libreoffice-commits] online.git: ios/Mobile ios/Mobile.xcodeproj

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 4 20:14:29 UTC 2018


 ios/Mobile.xcodeproj/project.pbxproj           |   16 +++++
 ios/Mobile/Base.lproj/Main.storyboard          |   70 +++++++++++++++++++++
 ios/Mobile/DocumentBrowserViewController.mm    |    7 ++
 ios/Mobile/Resources/Templates/Blank 16:9.otp  |binary
 ios/Mobile/Resources/Templates/Blank 4:3.otp   |binary
 ios/Mobile/Resources/Templates/Blank A4.ott    |binary
 ios/Mobile/Resources/Templates/Blank.ots       |binary
 ios/Mobile/TemplateCollectionViewController.h  |   19 +++++
 ios/Mobile/TemplateCollectionViewController.mm |   80 +++++++++++++++++++++++++
 ios/Mobile/TemplateSectionHeaderView.h         |   17 +++++
 ios/Mobile/TemplateSectionHeaderView.m         |   15 ++++
 11 files changed, 222 insertions(+), 2 deletions(-)

New commits:
commit a3b44f2b8b375b1d9d8980ae70ee388e6de57d90
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Dec 4 22:01:45 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Dec 4 22:12:39 2018 +0200

    Work in progress on document creation using templates in the iOS app
    
    When the "Create Document" button in the document browser is pressed,
    we scan a set of ODF templates in the Templates subfolder of the app
    bundle, and we display that list as a collection view. (So far that
    view is not interactive, i.e. once it is displayed, you are stuck
    there.)
    
    Eventually, when the user chooses one of the templates, we will open
    that and immediately, before the user has done any edits, do a Save As
    of it as a real (not template) document in the app's document folder.
    What name to use for it is unclear yet. Further saves will thus don't
    need any dialog to choose the document name.
    
    More work will be needed on i18n of the template support. Should we
    have localised templates? At least localised template names. Etc.
    
    Change-Id: I5675779a5b16bc4c70a943109aa0dd53cf4bd903

diff --git a/ios/Mobile.xcodeproj/project.pbxproj b/ios/Mobile.xcodeproj/project.pbxproj
index a5c577d82..5f5252c6e 100644
--- a/ios/Mobile.xcodeproj/project.pbxproj
+++ b/ios/Mobile.xcodeproj/project.pbxproj
@@ -32,6 +32,9 @@
 		BE5EB5DC2140480B00E0826C /* ICU.dat in Resources */ = {isa = PBXBuildFile; fileRef = BE5EB5DB2140480B00E0826C /* ICU.dat */; };
 		BE6362C22153B5B500F4237E /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE6362C12153B5B500F4237E /* MobileCoreServices.framework */; };
 		BE80E43221AD92F700859C97 /* Fonts in Resources */ = {isa = PBXBuildFile; fileRef = BE80E43121AD92F600859C97 /* Fonts */; };
+		BE80E45821B68F5700859C97 /* TemplateCollectionViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BE80E45721B68F5700859C97 /* TemplateCollectionViewController.mm */; };
+		BE80E45E21B6CEF200859C97 /* TemplateSectionHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = BE80E45D21B6CEF200859C97 /* TemplateSectionHeaderView.m */; };
+		BE80E46821B7066D00859C97 /* Templates in Resources */ = {isa = PBXBuildFile; fileRef = BE80E46721B7066C00859C97 /* Templates */; };
 		BE8D772C2136762500AC58EA /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = BE8D772B2136762500AC58EA /* AppDelegate.mm */; };
 		BE8D772F2136762500AC58EA /* DocumentBrowserViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BE8D772E2136762500AC58EA /* DocumentBrowserViewController.mm */; };
 		BE8D77322136762500AC58EA /* DocumentViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BE8D77312136762500AC58EA /* DocumentViewController.mm */; };
@@ -370,6 +373,11 @@
 		BE80E45321B56E5000859C97 /* init.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = init.cxx; path = "../../ios-device/desktop/source/lib/init.cxx"; sourceTree = "<group>"; };
 		BE80E45421B56E5000859C97 /* lokclipboard.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = lokclipboard.cxx; path = "../../ios-device/desktop/source/lib/lokclipboard.cxx"; sourceTree = "<group>"; };
 		BE80E45521B56E5000859C97 /* lokinteractionhandler.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = lokinteractionhandler.cxx; path = "../../ios-device/desktop/source/lib/lokinteractionhandler.cxx"; sourceTree = "<group>"; };
+		BE80E45621B68F5000859C97 /* TemplateCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateCollectionViewController.h; sourceTree = "<group>"; };
+		BE80E45721B68F5700859C97 /* TemplateCollectionViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TemplateCollectionViewController.mm; sourceTree = "<group>"; };
+		BE80E45C21B6CEF100859C97 /* TemplateSectionHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateSectionHeaderView.h; sourceTree = "<group>"; };
+		BE80E45D21B6CEF200859C97 /* TemplateSectionHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TemplateSectionHeaderView.m; sourceTree = "<group>"; };
+		BE80E46721B7066C00859C97 /* Templates */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Templates; sourceTree = "<group>"; };
 		BE8D77272136762500AC58EA /* Mobile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Mobile.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		BE8D772A2136762500AC58EA /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
 		BE8D772B2136762500AC58EA /* AppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = "<group>"; };
@@ -564,6 +572,7 @@
 		BE00F8922139494E001CE2D4 /* Resources */ = {
 			isa = PBXGroup;
 			children = (
+				BE80E46721B7066C00859C97 /* Templates */,
 				BE80E43121AD92F600859C97 /* Fonts */,
 				BE8D85BE214055F2009F1860 /* config */,
 				BE8D85BB214055F2009F1860 /* filter */,
@@ -1072,6 +1081,10 @@
 				BE8D77312136762500AC58EA /* DocumentViewController.mm */,
 				BE8D77332136762500AC58EA /* Document.h */,
 				BE8D77342136762500AC58EA /* Document.mm */,
+				BE80E45C21B6CEF100859C97 /* TemplateSectionHeaderView.h */,
+				BE80E45D21B6CEF200859C97 /* TemplateSectionHeaderView.m */,
+				BE80E45621B68F5000859C97 /* TemplateCollectionViewController.h */,
+				BE80E45721B68F5700859C97 /* TemplateCollectionViewController.mm */,
 				BE8D77362136762500AC58EA /* Main.storyboard */,
 				BE8D77392136762600AC58EA /* Assets.xcassets */,
 				BE8D773B2136762600AC58EA /* LaunchScreen.storyboard */,
@@ -1426,6 +1439,7 @@
 				BE8D77382136762500AC58EA /* Main.storyboard in Resources */,
 				BE8D85D2214055F3009F1860 /* program in Resources */,
 				BE8D85CB214055F3009F1860 /* share in Resources */,
+				BE80E46821B7066D00859C97 /* Templates in Resources */,
 				BE00F8A621396585001CE2D4 /* loading.html in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -1440,6 +1454,7 @@
 				BEA2835D21498AD400848631 /* Socket.cpp in Sources */,
 				BE5EB5C4213FE29900E0826C /* Util.cpp in Sources */,
 				BEA283582146945500848631 /* ChildSession.cpp in Sources */,
+				BE80E45E21B6CEF200859C97 /* TemplateSectionHeaderView.m in Sources */,
 				BE5EB5C3213FE29900E0826C /* Session.cpp in Sources */,
 				BE5EB5D22140039100E0826C /* LOOLWSD.cpp in Sources */,
 				BE5EB5C6213FE29900E0826C /* SigUtil.cpp in Sources */,
@@ -1452,6 +1467,7 @@
 				BE8D77402136762600AC58EA /* main.m in Sources */,
 				BE5EB5C8213FE29900E0826C /* FileUtil.cpp in Sources */,
 				BEA28360214ACA8500848631 /* FakeSocket.cpp in Sources */,
+				BE80E45821B68F5700859C97 /* TemplateCollectionViewController.mm in Sources */,
 				BE8D77352136762500AC58EA /* Document.mm in Sources */,
 				BE5EB5C7213FE29900E0826C /* Protocol.cpp in Sources */,
 				BE8D772F2136762500AC58EA /* DocumentBrowserViewController.mm in Sources */,
diff --git a/ios/Mobile/Base.lproj/Main.storyboard b/ios/Mobile/Base.lproj/Main.storyboard
index 5f41f1abf..ed8b0784b 100644
--- a/ios/Mobile/Base.lproj/Main.storyboard
+++ b/ios/Mobile/Base.lproj/Main.storyboard
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -40,5 +40,71 @@
             </objects>
             <point key="canvasLocation" x="1031" y="654"/>
         </scene>
+        <!--Template Collection View Controller-->
+        <scene sceneID="juG-xb-Xrw">
+            <objects>
+                <collectionViewController storyboardIdentifier="TemplateCollectionViewController" id="Cwb-6T-NJd" customClass="TemplateCollectionViewController" sceneMemberID="viewController">
+                    <collectionView key="view" clipsSubviews="YES" contentMode="scaleToFill" dataMode="prototypes" id="cHi-RU-96O">
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                        <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="w0h-io-kZq">
+                            <size key="itemSize" width="50" height="50"/>
+                            <size key="headerReferenceSize" width="50" height="50"/>
+                            <size key="footerReferenceSize" width="0.0" height="0.0"/>
+                            <inset key="sectionInset" minX="50" minY="0.0" maxX="0.0" maxY="0.0"/>
+                        </collectionViewFlowLayout>
+                        <cells>
+                            <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="Cell" id="ppW-Sx-T3H">
+                                <rect key="frame" x="50" y="50" width="100" height="100"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
+                                    <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
+                                    <autoresizingMask key="autoresizingMask"/>
+                                    <subviews>
+                                        <label opaque="NO" userInteractionEnabled="NO" tag="2" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fjg-QH-lLg">
+                                            <rect key="frame" x="7" y="75" width="93" height="25"/>
+                                            <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                            <nil key="textColor"/>
+                                            <nil key="highlightedColor"/>
+                                        </label>
+                                        <imageView userInteractionEnabled="NO" tag="1" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="79y-w8-uiT">
+                                            <rect key="frame" x="7" y="0.0" width="93" height="75"/>
+                                        </imageView>
+                                    </subviews>
+                                </view>
+                                <constraints>
+                                    <constraint firstItem="fjg-QH-lLg" firstAttribute="top" secondItem="79y-w8-uiT" secondAttribute="bottom" constant="8" symbolic="YES" id="FMl-Ul-D9h"/>
+                                    <constraint firstItem="fjg-QH-lLg" firstAttribute="width" secondItem="79y-w8-uiT" secondAttribute="width" id="kOC-Jx-Eho"/>
+                                </constraints>
+                                <size key="customSize" width="100" height="100"/>
+                            </collectionViewCell>
+                        </cells>
+                        <collectionReusableView key="sectionHeaderView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" reuseIdentifier="SectionHeaderView" id="Vbs-oR-qri" customClass="TemplateSectionHeaderView">
+                            <rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
+                            <autoresizingMask key="autoresizingMask"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DE4-jV-CVW">
+                                    <rect key="frame" x="8" y="0.0" width="359" height="50"/>
+                                    <autoresizingMask key="autoresizingMask" flexibleMinY="YES" flexibleMaxY="YES"/>
+                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                    <nil key="textColor"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <connections>
+                                <outlet property="title" destination="DE4-jV-CVW" id="iy6-0m-CYp"/>
+                            </connections>
+                        </collectionReusableView>
+                        <connections>
+                            <outlet property="dataSource" destination="Cwb-6T-NJd" id="rwX-kb-u54"/>
+                            <outlet property="delegate" destination="Cwb-6T-NJd" id="NdE-oH-qfI"/>
+                        </connections>
+                    </collectionView>
+                </collectionViewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="RAw-E0-0p8" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="1717.5999999999999" y="653.52323838080963"/>
+        </scene>
     </scenes>
 </document>
diff --git a/ios/Mobile/DocumentBrowserViewController.mm b/ios/Mobile/DocumentBrowserViewController.mm
index d7edf887a..95b5bcd88 100644
--- a/ios/Mobile/DocumentBrowserViewController.mm
+++ b/ios/Mobile/DocumentBrowserViewController.mm
@@ -11,6 +11,7 @@
 #import "DocumentBrowserViewController.h"
 #import "Document.h"
 #import "DocumentViewController.h"
+#import "TemplateCollectionViewController.h"
 
 @interface DocumentBrowserViewController () <UIDocumentBrowserViewControllerDelegate>
 
@@ -34,6 +35,11 @@
 }
 
 - (void)documentBrowser:(UIDocumentBrowserViewController *)controller didRequestDocumentCreationWithHandler:(void (^)(NSURL * _Nullable, UIDocumentBrowserImportMode))importHandler {
+    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
+    TemplateCollectionViewController *templateCollectionViewController = [storyBoard instantiateViewControllerWithIdentifier:@"TemplateCollectionViewController"];
+    [self presentViewController:templateCollectionViewController animated:YES completion:nil];
+
+#if 0
     NSURL *newDocumentURL = nil;
 
     // Set the URL for the new document here. Optionally, you can present a template chooser before calling the importHandler.
@@ -43,6 +49,7 @@
     } else {
         importHandler(newDocumentURL, UIDocumentBrowserImportModeNone);
     }
+#endif
 }
 
 -(void)documentBrowser:(UIDocumentBrowserViewController *)controller didPickDocumentURLs:(NSArray<NSURL *> *)documentURLs {
diff --git a/ios/Mobile/Resources/Templates/Blank 16:9.otp b/ios/Mobile/Resources/Templates/Blank 16:9.otp
new file mode 100644
index 000000000..bbb9e0bd7
Binary files /dev/null and b/ios/Mobile/Resources/Templates/Blank 16:9.otp differ
diff --git a/ios/Mobile/Resources/Templates/Blank 4:3.otp b/ios/Mobile/Resources/Templates/Blank 4:3.otp
new file mode 100644
index 000000000..c24166360
Binary files /dev/null and b/ios/Mobile/Resources/Templates/Blank 4:3.otp differ
diff --git a/ios/Mobile/Resources/Templates/Blank A4.ott b/ios/Mobile/Resources/Templates/Blank A4.ott
new file mode 100644
index 000000000..98a75d538
Binary files /dev/null and b/ios/Mobile/Resources/Templates/Blank A4.ott differ
diff --git a/ios/Mobile/Resources/Templates/Blank.ots b/ios/Mobile/Resources/Templates/Blank.ots
new file mode 100644
index 000000000..a7b96671f
Binary files /dev/null and b/ios/Mobile/Resources/Templates/Blank.ots differ
diff --git a/ios/Mobile/TemplateCollectionViewController.h b/ios/Mobile/TemplateCollectionViewController.h
new file mode 100644
index 000000000..1e5ef3675
--- /dev/null
+++ b/ios/Mobile/TemplateCollectionViewController.h
@@ -0,0 +1,19 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*-
+//
+// 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/.
+
+#import <UIKit/UIKit.h>
+
+// #import "TemplateCollectionView.h"
+
+ at interface TemplateCollectionViewController : UICollectionViewController<UICollectionViewDataSource,UICollectionViewDelegateFlowLayout> {
+    NSArray<NSURL*> *templates[3];
+}
+
+ at end
+
+// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ios/Mobile/TemplateCollectionViewController.mm b/ios/Mobile/TemplateCollectionViewController.mm
new file mode 100644
index 000000000..fcf6c1d8a
--- /dev/null
+++ b/ios/Mobile/TemplateCollectionViewController.mm
@@ -0,0 +1,80 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*-
+//
+// 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/.
+
+#import "TemplateCollectionViewController.h"
+#import "TemplateSectionHeaderView.h"
+
+ at implementation TemplateCollectionViewController
+
+-(void)viewDidLoad {
+
+    // Here we should scan for available templates.
+
+    templates[0] = [[NSBundle mainBundle] URLsForResourcesWithExtension:@".ott" subdirectory:@"Templates"];
+    templates[1] = [[NSBundle mainBundle] URLsForResourcesWithExtension:@".ots" subdirectory:@"Templates"];
+    templates[2] = [[NSBundle mainBundle] URLsForResourcesWithExtension:@".otp" subdirectory:@"Templates"];
+}
+
+- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
+    // Three sections: Document, Spreadsheet, and Presentation
+    return 3;
+}
+
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
+    assert(section >= 0 && section <= 2);
+    return templates[section].count;
+}
+
+- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
+    assert(indexPath.length == 2);
+    assert([indexPath indexAtPosition:0] <= 2);
+    assert([indexPath indexAtPosition:1] < templates[[indexPath indexAtPosition:0]].count);
+
+    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
+
+    UIImageView *image = (UIImageView *)[cell viewWithTag:1];
+    UILabel *title = (UILabel *)[cell viewWithTag:2];
+
+    // FIXME: Just use a dummy image for now
+    image.image = [UIImage imageNamed:@"AppIcon"];
+
+    NSString *fileName = [templates[[indexPath indexAtPosition:0]][[indexPath indexAtPosition:1]] lastPathComponent];
+
+    title.text = [fileName stringByDeletingPathExtension];
+
+    return cell;
+}
+
+- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
+    return CGSizeMake(150, 150);
+}
+
+- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
+    assert(kind == UICollectionElementKindSectionHeader);
+
+    assert(indexPath.length == 2);
+    assert([indexPath indexAtPosition:1] == 0);
+
+    NSUInteger index = [indexPath indexAtPosition:0];
+    assert(index <= 2);
+
+    TemplateSectionHeaderView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"SectionHeaderView" forIndexPath:indexPath];
+
+    if (index == 0)
+        header.title.text = @"Document";
+    else if (index == 1)
+        header.title.text = @"Spreadsheet";
+    else if (index == 2)
+        header.title.text = @"Presentation";
+
+    return header;
+}
+
+ at end
+
+// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ios/Mobile/TemplateSectionHeaderView.h b/ios/Mobile/TemplateSectionHeaderView.h
new file mode 100644
index 000000000..bc38526bd
--- /dev/null
+++ b/ios/Mobile/TemplateSectionHeaderView.h
@@ -0,0 +1,17 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*-
+//
+// 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/.
+
+#import <UIKit/UIKit.h>
+
+ at interface TemplateSectionHeaderView : UICollectionReusableView
+
+ at property (strong, nonatomic) IBOutlet UILabel *title;
+
+ at end
+
+// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ios/Mobile/TemplateSectionHeaderView.m b/ios/Mobile/TemplateSectionHeaderView.m
new file mode 100644
index 000000000..5ae002642
--- /dev/null
+++ b/ios/Mobile/TemplateSectionHeaderView.m
@@ -0,0 +1,15 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*-
+//
+// 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/.
+
+#import "TemplateSectionHeaderView.h"
+
+ at implementation TemplateSectionHeaderView
+
+ at end
+
+// vim:set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list