summaryrefslogtreecommitdiff
path: root/ios/experimental/TiledLibreOffice/TiledLibreOffice/DocumentTableViewController.m
diff options
context:
space:
mode:
Diffstat (limited to 'ios/experimental/TiledLibreOffice/TiledLibreOffice/DocumentTableViewController.m')
-rw-r--r--ios/experimental/TiledLibreOffice/TiledLibreOffice/DocumentTableViewController.m59
1 files changed, 59 insertions, 0 deletions
diff --git a/ios/experimental/TiledLibreOffice/TiledLibreOffice/DocumentTableViewController.m b/ios/experimental/TiledLibreOffice/TiledLibreOffice/DocumentTableViewController.m
new file mode 100644
index 000000000000..27de342a0253
--- /dev/null
+++ b/ios/experimental/TiledLibreOffice/TiledLibreOffice/DocumentTableViewController.m
@@ -0,0 +1,59 @@
+// -*- Mode: ObjC; 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/.
+
+#import <UIKit/UIKit.h>
+
+#import "AppDelegate.h"
+#import "DocumentTableViewController.h"
+
+@interface DocumentTableViewController ()
+{
+ NSArray *documents;
+ AppDelegate *appDelegate;
+}
+@end
+
+@implementation DocumentTableViewController
+
++ (id)createForDocuments:(NSArray*)documents forAppDelegate:(AppDelegate*)appDelegate;
+{
+ DocumentTableViewController *result = [[DocumentTableViewController alloc] initWithStyle:UITableViewStylePlain];
+
+ result->documents = documents;
+ result->appDelegate = appDelegate;
+
+ return result;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ return [documents count];
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ static NSString *simpleTableIdentifier = @"SimpleTableCell";
+
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
+
+ if (cell == nil) {
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
+ }
+
+ cell.textLabel.text = [[documents objectAtIndex:indexPath.row] lastPathComponent];
+ return cell;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ [appDelegate startDisplaying:[documents objectAtIndex:indexPath.row]];
+}
+
+@end
+
+// vim:set shiftwidth=4 softtabstop=4 expandtab: