#ifndef PRINTING_PRINTING_UTILS_H_
#define PRINTING_PRINTING_UTILS_H_
#include <stddef.h>
#include <stdint.h>
#include <string>
#include <string_view>
#include "base/component_export.h"
#include "base/containers/span.h"
#include "build/build_config.h"
#include "printing/buildflags/buildflags.h"
#if BUILDFLAG(IS_WIN)
#include "base/win/win_handle_types.h"
#include "ui/gfx/geometry/rect.h"
#endif
namespace gfx {
class Size;
}
namespace printing {
COMPONENT_EXPORT(PRINTING_BASE)
std::u16string SimplifyDocumentTitle(const std::u16string& title);
COMPONENT_EXPORT(PRINTING_BASE)
std::u16string SimplifyDocumentTitleWithLength(const std::u16string& title,
size_t length);
COMPONENT_EXPORT(PRINTING_BASE)
std::u16string FormatDocumentTitleWithOwner(const std::u16string& owner,
const std::u16string& title);
COMPONENT_EXPORT(PRINTING_BASE)
std::u16string FormatDocumentTitleWithOwnerAndLength(
const std::u16string& owner,
const std::u16string& title,
size_t length);
#if BUILDFLAG(USE_CUPS)
COMPONENT_EXPORT(PRINTING_BASE)
gfx::Size GetDefaultPaperSizeFromLocaleMicrons(std::string_view locale);
COMPONENT_EXPORT(PRINTING_BASE)
bool SizesEqualWithinEpsilon(const gfx::Size& lhs,
const gfx::Size& rhs,
int epsilon);
#endif
#if BUILDFLAG(IS_WIN)
COMPONENT_EXPORT(PRINTING_BASE)
gfx::Rect GetCenteredPageContentRect(const gfx::Size& paper_size,
const gfx::Size& page_size,
const gfx::Rect& page_content_rect);
COMPONENT_EXPORT(PRINTING_BASE)
gfx::Rect GetPrintableAreaDeviceUnits(HDC hdc);
enum class DocumentDataType { kUnknown, kPdf, kXps };
COMPONENT_EXPORT(PRINTING_BASE)
DocumentDataType DetermineDocumentDataType(base::span<const uint8_t> data);
COMPONENT_EXPORT(PRINTING_BASE)
bool LooksLikeXps(base::span<const uint8_t> maybe_xps_data);
#endif
COMPONENT_EXPORT(PRINTING_BASE)
bool LooksLikePdf(base::span<const uint8_t> maybe_pdf_data);
}
#endif