summaryrefslogtreecommitdiff
path: root/poppler/LocalPDFDocBuilder.cc
blob: bdecc65744725d09b3be03d2bd7d253302a8a56b (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
//========================================================================
//
// LocalPDFDocBuilder.cc
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2010 Hib Eris <hib@hiberis.nl>
// Copyright 2010 Albert Astals Cid <aacid@kde.org>
//
//========================================================================

#include <config.h>

#include "LocalPDFDocBuilder.h"

//------------------------------------------------------------------------
// LocalPDFDocBuilder
//------------------------------------------------------------------------

PDFDoc *
LocalPDFDocBuilder::buildPDFDoc(
    const GooString &uri, GooString *ownerPassword, GooString
    *userPassword, void *guiDataA)
{
  if (uri.cmpN("file://", 7) == 0) {
     GooString *fileName = uri.copy();
     fileName->del(0, 7);
     return new PDFDoc(fileName, ownerPassword, userPassword, guiDataA);
  } else {
     GooString *fileName = uri.copy();
     return new PDFDoc(fileName, ownerPassword, userPassword, guiDataA);
  }
}

bool LocalPDFDocBuilder::supports(const GooString &uri)
{
  if (uri.cmpN("file://", 7) == 0) {
    return true;
  } else if (!strstr(uri.getCString(), "://")) {
    return true;
  } else {
    return false;
  }
}