summaryrefslogtreecommitdiff
path: root/winrt/mupdfwinrt/mudocument.h
blob: d9bd7c1f8da04de63fc2adc8dfde17f50c0a220d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once

/* This file contains the interface between the muctx class, which 
   implements the mupdf calls and the WinRT objects enabling calling from 
   C#, C++, and JavaScript applications */

#include "muctx.h"
#include "Links.h"
#include "ppltasks.h"
#include "ContentItem.h"
#include <winnt.h>
#include <collection.h>

using namespace Windows::Storage;
using namespace Platform;
using namespace Concurrency;
using namespace Platform::Collections;

#define SEARCH_FORWARD 1
#define SEARCH_BACKWARD -1
#define TEXT_NOT_FOUND -1

namespace mupdfwinrt
{
	public ref class mudocument sealed
	{
		private:
			muctx mu_object;
			std::mutex mutex_lock; 
			Platform::Collections::Vector<Links^>^ links;
			Platform::Collections::Vector<Links^>^ textsearch;
			Platform::Collections::Vector<ContentItem^>^ contents;
		public:
			mudocument();
			void CleanUp();
			Windows::Foundation::IAsyncAction^ OpenFileAsync(StorageFile^ file);
			int GetNumPages(void);
			Point GetPageSize(int page_num);
			Windows::Foundation::IAsyncOperation<InMemoryRandomAccessStream^>^  
				RenderPageAsync(int page_num, int width, int height);
			Windows::Foundation::IAsyncOperationWithProgress<int, double>^ 
				SearchDocumentWithProgressAsync(String^ textToFind, int dir, int start_page);
			String^ ComputeHTML(int page_num);			
			int ComputeTextSearch(String^ text, int page_num);
			Links^ GetTextSearch(int k);
			int TextSearchCount(void);
			int ComputeContents(void);
			ContentItem^ GetContent(int k);
			int ComputeLinks(int page_num);
			Links^ GetLink(int k);
			bool RequiresPassword();
			bool ApplyPassword(String^ password);
	};
}