Skip to content

Commit 528762d

Browse files
committed
그리기 객체에 textbox가 null일 때, ParagraphCopier에서 에러나는 오류 수정...
1 parent 3316b42 commit 528762d

File tree

294 files changed

+2327
-277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

294 files changed

+2327
-277
lines changed

README.md

+20-12

doc/kr/dogfoot/hwplib/test/TestReWritingHWPFile.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ <h2 title="Class TestReWritingHWPFile" class="title">Class TestReWritingHWPFile<
8888
<li>java.lang.Object</li>
8989
<li>
9090
<ul class="inheritance">
91-
<li>kr.dogfoot.hwplib.sample.ReWriting_HWPFile</li>
91+
<li>kr.dogfoot.hwplib.sample.Rewriting_HWPFile</li>
9292
</ul>
9393
</li>
9494
</ul>

doc/kr/dogfoot/hwplib/test/class-use/TestReWritingHWPFile.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<!-- Generated by javadoc (version 1.7.0_10) on Tue Mar 20 20:18:56 KST 2018 -->
66
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
7-
<title>Uses of Class kr.dogfoot.hwplib.sample.ReWriting_HWPFile</title>
7+
<title>Uses of Class kr.dogfoot.hwplib.sample.Rewriting_HWPFile</title>
88
<meta name="date" content="2018-03-20">
99
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
1010
</head>
@@ -63,9 +63,9 @@
6363
</a></div>
6464
<!-- ========= END OF TOP NAVBAR ========= -->
6565
<div class="header">
66-
<h2 title="Uses of Class kr.dogfoot.hwplib.sample.ReWriting_HWPFile" class="title">Uses of Class<br>kr.dogfoot.hwplib.sample.ReWriting_HWPFile</h2>
66+
<h2 title="Uses of Class kr.dogfoot.hwplib.sample.Rewriting_HWPFile" class="title">Uses of Class<br>kr.dogfoot.hwplib.sample.Rewriting_HWPFile</h2>
6767
</div>
68-
<div class="classUseContainer">No usage of kr.dogfoot.hwplib.sample.ReWriting_HWPFile</div>
68+
<div class="classUseContainer">No usage of kr.dogfoot.hwplib.sample.Rewriting_HWPFile</div>
6969
<!-- ======= START OF BOTTOM NAVBAR ====== -->
7070
<div class="bottomNav"><a name="navbar_bottom">
7171
<!-- -->

pom.xml

+8
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@
120120
<autoReleaseAfterClose>true</autoReleaseAfterClose>
121121
</configuration>
122122
</plugin>
123+
<plugin>
124+
<groupId>org.apache.maven.plugins</groupId>
125+
<artifactId>maven-compiler-plugin</artifactId>
126+
<configuration>
127+
<source>7</source>
128+
<target>7</target>
129+
</configuration>
130+
</plugin>
123131
</plugins>
124132
</build>
125133

Binary file not shown.

sample_hwp/basic/etc.hwp

12.5 KB
Binary file not shown.
Binary file not shown.

sample_hwp/basic/각주미주.hwp

15 KB
Binary file not shown.
Binary file not shown.
File renamed without changes.

sample_hwp/basic/글상자-압축.hwp

12 KB
Binary file not shown.
Binary file not shown.

sample_hwp/basic/글자겹침.hwp

11.5 KB
Binary file not shown.

sample_hwp/basic/다각형.hwp

11.5 KB
Binary file not shown.
Binary file not shown.

sample_hwp/basic/묶음.hwp

8 KB
Binary file not shown.

sample_hwp/basic/바탕쪽.hwp

11.5 KB
Binary file not shown.

sample_hwp/basic/새번호지정.hwp

18 KB
Binary file not shown.
12 KB
Binary file not shown.

sample_hwp/basic/수식.hwp

11.5 KB
Binary file not shown.
Binary file not shown.

sample_hwp/basic/이미지추가.hwp

16.5 KB
Binary file not shown.

sample_hwp/basic/차트.hwp

7 KB
Binary file not shown.

sample_hwp/basic/책갈피.hwp

11.5 KB
Binary file not shown.

sample_hwp/basic/페이지숨김.hwp

18.5 KB
Binary file not shown.

sample_hwp/basic/표.hwp

17 KB
Binary file not shown.

sample_hwp/basic/필드-누름틀.hwp

13 KB
Binary file not shown.

sample_hwp/basic/필드.hwp

15 KB
Binary file not shown.

sample_hwp/basic/호-곡선.hwp

12 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

sample_hwp/getting_clickhere_text.hwp

13 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.

sample_hwp/test-etc.hwp

-20 KB
Binary file not shown.
-4.5 KB
Binary file not shown.

sample_hwp/test-각주미주.hwp

-23 KB
Binary file not shown.
Binary file not shown.

sample_hwp/test-글상자-압축.hwp

-20.5 KB
Binary file not shown.

sample_hwp/test-글상자.hwp

-23 KB
Binary file not shown.

sample_hwp/test-글자겹침.hwp

-21 KB
Binary file not shown.

sample_hwp/test-다각형.hwp

-21 KB
Binary file not shown.

sample_hwp/test-덧말.hwp

-22.5 KB
Binary file not shown.
-27 KB
Binary file not shown.

sample_hwp/test-묶음.hwp

-13.5 KB
Binary file not shown.

sample_hwp/test-바탕쪽.hwp

-21 KB
Binary file not shown.

sample_hwp/test-새번호지정.hwp

-25 KB
Binary file not shown.
-21 KB
Binary file not shown.

sample_hwp/test-수식.hwp

-21 KB
Binary file not shown.

sample_hwp/test-숨은설명.hwp

-22.5 KB
Binary file not shown.

sample_hwp/test-이미지추가.hwp

-25.5 KB
Binary file not shown.

sample_hwp/test-차트.hwp

-14 KB
Binary file not shown.

sample_hwp/test-책갈피.hwp

-20.5 KB
Binary file not shown.

sample_hwp/test-페이지숨김.hwp

-26 KB
Binary file not shown.

sample_hwp/test-표.hwp

-25 KB
Binary file not shown.

sample_hwp/test-필드.hwp

-22.5 KB
Binary file not shown.

sample_hwp/test-필드_누름틀.hwp

-21.5 KB
Binary file not shown.

sample_hwp/test-필드설정.hwp

-9.5 KB
Binary file not shown.

sample_hwp/test-호 곡선.hwp

-20.5 KB
Binary file not shown.

src/main/java/kr/dogfoot/hwplib/object/HWPFile.java

+13
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,17 @@ public BodyText getBodyText() {
7373
public BinData getBinData() {
7474
return binData;
7575
}
76+
77+
public HWPFile clone(boolean deepCopyImage) {
78+
HWPFile cloned = new HWPFile();
79+
cloned.copy(this, deepCopyImage);
80+
return cloned;
81+
}
82+
83+
public void copy(HWPFile from, boolean deepCopyImage) {
84+
fileHeader.copy(from.fileHeader);
85+
docInfo.copy(from.docInfo);
86+
bodyText.copy(from.bodyText);
87+
binData.copy(from.binData, deepCopyImage);
88+
}
7689
}

src/main/java/kr/dogfoot/hwplib/object/RecordHeader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void setSize(long size) {
8484
*
8585
* @return 새로 생성된 레코드 헤더 객체
8686
*/
87-
public RecordHeader copy() {
87+
public RecordHeader clone() {
8888
RecordHeader rh = new RecordHeader();
8989
rh.tagID = this.tagID;
9090
rh.level = this.level;

src/main/java/kr/dogfoot/hwplib/object/bindata/BinData.java

+7
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,11 @@ public void addNewEmbeddedBinaryData(String name, byte[] data, BinDataCompress c
5555
ebd.setData(data);
5656
ebd.setCompressMethod(compressMethod);
5757
}
58+
59+
public void copy(BinData from, boolean deepCopyImage) {
60+
embeddedBinaryDataList.clear();
61+
for (EmbeddedBinaryData embeddedBinaryData : from.embeddedBinaryDataList) {
62+
embeddedBinaryDataList.add(embeddedBinaryData.clone(deepCopyImage));
63+
}
64+
}
5865
}

src/main/java/kr/dogfoot/hwplib/object/bindata/EmbeddedBinaryData.java

+12
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,16 @@ public BinDataCompress getCompressMethod() {
8080
public void setCompressMethod(BinDataCompress compressMethod) {
8181
this.compressMethod = compressMethod;
8282
}
83+
84+
public EmbeddedBinaryData clone(boolean deepCopyImage) {
85+
EmbeddedBinaryData cloned = new EmbeddedBinaryData();
86+
cloned.name = name;
87+
if (deepCopyImage) {
88+
cloned.data = data.clone();
89+
} else {
90+
cloned.data = data;
91+
}
92+
cloned.compressMethod = compressMethod;
93+
return cloned;
94+
}
8395
}

src/main/java/kr/dogfoot/hwplib/object/bodytext/BodyText.java

+7
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,11 @@ public Section addNewSection() {
4040
public ArrayList<Section> getSectionList() {
4141
return sectionList;
4242
}
43+
44+
public void copy(BodyText from) {
45+
sectionList.clear();
46+
for (Section section : from.sectionList) {
47+
sectionList.add(section.clone());
48+
}
49+
}
4350
}

src/main/java/kr/dogfoot/hwplib/object/bodytext/Section.java

+18
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import kr.dogfoot.hwplib.object.bodytext.control.sectiondefine.BatangPageInfo;
44
import kr.dogfoot.hwplib.object.bodytext.paragraph.Paragraph;
5+
import kr.dogfoot.hwplib.object.docinfo.ParaShape;
56

67
import java.util.ArrayList;
78
import java.util.Iterator;
@@ -84,4 +85,21 @@ public void createLastBatangPageInfo() {
8485
public BatangPageInfo getLastBatangPageInfo() {
8586
return lastBatangPageInfo;
8687
}
88+
89+
public Section clone() {
90+
Section cloned = new Section();
91+
92+
cloned.paragraphList.clear();
93+
for (Paragraph paragraph : paragraphList) {
94+
cloned.paragraphList.add(paragraph.clone());
95+
}
96+
97+
if (lastBatangPageInfo != null) {
98+
cloned.lastBatangPageInfo = lastBatangPageInfo.clone();
99+
} else {
100+
cloned.lastBatangPageInfo = null;
101+
}
102+
103+
return cloned;
104+
}
87105
}

src/main/java/kr/dogfoot/hwplib/object/bodytext/control/Control.java

+21-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import kr.dogfoot.hwplib.object.bodytext.control.bookmark.CtrlData;
44
import kr.dogfoot.hwplib.object.bodytext.control.ctrlheader.CtrlHeader;
5+
import kr.dogfoot.hwplib.object.bodytext.control.gso.ControlArc;
56

67
/**
78
* 컨트롤에 대한 추상 객체
@@ -16,7 +17,7 @@ public abstract class Control {
1617
/**
1718
* 컨트롤 데이터
1819
*/
19-
private CtrlData ctrlData;
20+
protected CtrlData ctrlData;
2021

2122
/**
2223
* 생성자
@@ -53,6 +54,9 @@ public void createCtrlData() {
5354
ctrlData = new CtrlData();
5455
}
5556

57+
public void deleteCtrlData() {
58+
ctrlData = null;
59+
}
5660
/**
5761
* 컨트롤 데이터(??)를 반환한다.
5862
*
@@ -71,4 +75,20 @@ public void setCtrlData(CtrlData ctrlData) {
7175
this.ctrlData = new CtrlData();
7276
}
7377

78+
public abstract Control clone();
79+
80+
public void copyControlPart(Control from) {
81+
if (from.header != null) {
82+
header.copy(from.header);
83+
} else {
84+
from.header = null;
85+
}
86+
87+
if (from.ctrlData != null) {
88+
createCtrlData();
89+
ctrlData.copy(from.ctrlData);
90+
} else {
91+
ctrlData = null;
92+
}
93+
}
7494
}

src/main/java/kr/dogfoot/hwplib/object/bodytext/control/ControlAdditionalText.java

+6
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,10 @@ public ControlAdditionalText() {
2323
public CtrlHeaderAdditionalText getHeader() {
2424
return (CtrlHeaderAdditionalText) header;
2525
}
26+
27+
public Control clone() {
28+
ControlAdditionalText cloned = new ControlAdditionalText();
29+
cloned.copyControlPart(this);
30+
return cloned;
31+
}
2632
}

src/main/java/kr/dogfoot/hwplib/object/bodytext/control/ControlAutoNumber.java

+7
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,11 @@ public ControlAutoNumber() {
2323
public CtrlHeaderAutoNumber getHeader() {
2424
return (CtrlHeaderAutoNumber) header;
2525
}
26+
27+
@Override
28+
public Control clone() {
29+
ControlAutoNumber cloned = new ControlAutoNumber();
30+
cloned.copyControlPart(this);
31+
return cloned;
32+
}
2633
}

src/main/java/kr/dogfoot/hwplib/object/bodytext/control/ControlBookmark.java

+5-21
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,11 @@
99
* @author neolord
1010
*/
1111
public class ControlBookmark extends Control {
12-
/**
13-
* 임의 데이터 객체
14-
*/
15-
private CtrlData ctrlData;
16-
1712
/**
1813
* 생성자
1914
*/
2015
public ControlBookmark() {
2116
super(new CtrlHeaderBookmark());
22-
23-
ctrlData = null;
2417
}
2518

2619
/**
@@ -32,19 +25,10 @@ public CtrlHeaderBookmark getHeader() {
3225
return (CtrlHeaderBookmark) header;
3326
}
3427

35-
/**
36-
* 임의 데이터 객체를 생성한다.
37-
*/
38-
public void createCtrlData() {
39-
ctrlData = new CtrlData();
40-
}
41-
42-
/**
43-
* 임의 데이터 객체를 반환한다.
44-
*
45-
* @return 임의 데이터 객체
46-
*/
47-
public CtrlData getCtrlData() {
48-
return ctrlData;
28+
@Override
29+
public Control clone() {
30+
ControlBookmark cloned = new ControlBookmark();
31+
cloned.copyControlPart(this);
32+
return cloned;
4933
}
5034
}

src/main/java/kr/dogfoot/hwplib/object/bodytext/control/ControlColumnDefine.java

+7
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,11 @@ public ControlColumnDefine() {
2323
public CtrlHeaderColumnDefine getHeader() {
2424
return (CtrlHeaderColumnDefine) header;
2525
}
26+
27+
@Override
28+
public Control clone() {
29+
ControlColumnDefine cloned = new ControlColumnDefine();
30+
cloned.copyControlPart(this);
31+
return cloned;
32+
}
2633
}

src/main/java/kr/dogfoot/hwplib/object/bodytext/control/ControlEndnote.java

+9
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,13 @@ public ListHeaderForFootnodeEndnote getListHeader() {
5555
public ParagraphList getParagraphList() {
5656
return paragraphList;
5757
}
58+
59+
@Override
60+
public Control clone() {
61+
ControlEndnote cloned = new ControlEndnote();
62+
cloned.copyControlPart(this);
63+
cloned.listHeader.copy(listHeader);
64+
cloned.paragraphList.copy(paragraphList);
65+
return cloned;
66+
}
5867
}

src/main/java/kr/dogfoot/hwplib/object/bodytext/control/ControlEquation.java

+17
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,21 @@ public Caption getCaption() {
6868
public EQEdit getEQEdit() {
6969
return eqEdit;
7070
}
71+
72+
@Override
73+
public Control clone() {
74+
ControlEquation cloned = new ControlEquation();
75+
cloned.copyControlPart(this);
76+
77+
if (caption != null) {
78+
cloned.createCaption();
79+
cloned.caption.copy(caption);
80+
} else {
81+
cloned = null;
82+
}
83+
84+
cloned.eqEdit.copy(eqEdit);
85+
86+
return cloned;
87+
}
7188
}

0 commit comments

Comments
 (0)