2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com
.intellij
.codeEditor
.printing
;
19 import com
.intellij
.openapi
.application
.PathManager
;
20 import com
.intellij
.openapi
.components
.*;
21 import com
.intellij
.util
.xmlb
.XmlSerializerUtil
;
22 import org
.jetbrains
.annotations
.NonNls
;
23 import org
.jetbrains
.annotations
.NotNull
;
35 file
= "$APP_CONFIG$/print.xml"
38 public class PrintSettings
implements PersistentStateComponent
<PrintSettings
>, ExportableComponent
{
39 @NonNls public String PAPER_SIZE
= "A4";
41 public boolean COLOR_PRINTING
= false;
42 public boolean SYNTAX_PRINTING
= true;
43 public boolean PRINT_AS_GRAPHICS
= true;
45 public boolean PORTRAIT_LAYOUT
= true;
47 @NonNls public String FONT_NAME
= "monospaced";
48 public int FONT_SIZE
= 10;
50 public boolean PRINT_LINE_NUMBERS
= true;
52 public boolean WRAP
= true;
54 public float TOP_MARGIN
= 0.5f
;
55 public float BOTTOM_MARGIN
= 1.0f
;
56 public float LEFT_MARGIN
= 1.0f
;
57 public float RIGHT_MARGIN
= 1.0f
;
59 public boolean DRAW_BORDER
= true;
61 public String FOOTER_HEADER_TEXT1
= CodeEditorBundle
.message("print.header.default.line.1");
62 public String FOOTER_HEADER_PLACEMENT1
= HEADER
;
63 public String FOOTER_HEADER_ALIGNMENT1
= LEFT
;
64 public String FOOTER_HEADER_TEXT2
= CodeEditorBundle
.message("print.header.default.line.2");
65 public String FOOTER_HEADER_PLACEMENT2
= FOOTER
;
66 public String FOOTER_HEADER_ALIGNMENT2
= CENTER
;
67 public int FOOTER_HEADER_FONT_SIZE
= 8;
68 @NonNls public String FOOTER_HEADER_FONT_NAME
= "Arial";
70 public static final int PRINT_FILE
= 1;
71 public static final int PRINT_SELECTED_TEXT
= 2;
72 public static final int PRINT_DIRECTORY
= 4;
73 private int myPrintScope
;
74 private boolean myIncludeSubdirectories
;
76 @NonNls public static final String HEADER
= "Header";
77 @NonNls public static final String FOOTER
= "Footer";
79 @NonNls public static final String LEFT
= "Left";
80 @NonNls public static final String CENTER
= "Center";
81 @NonNls public static final String RIGHT
= "Right";
83 public static PrintSettings
getInstance() {
84 return ServiceManager
.getService(PrintSettings
.class);
88 public File
[] getExportFiles() {
89 return new File
[]{PathManager
.getOptionsFile("print")};
93 public String
getPresentableName() {
94 return CodeEditorBundle
.message("title.print.settings");
97 public int getPrintScope() {
101 public void setPrintScope(int printScope
) {
102 myPrintScope
= printScope
;
105 public boolean isIncludeSubdirectories() {
106 return myIncludeSubdirectories
;
109 public void setIncludeSubdirectories(boolean includeSubdirectories
) {
110 myIncludeSubdirectories
= includeSubdirectories
;
113 public PrintSettings
getState() {
117 public void loadState(final PrintSettings state
) {
118 XmlSerializerUtil
.copyBean(state
, this);