#include "GuiDocumentClipboard.h"
namespace
{
namespace
{
using
namespace
collections
;
using
namespace
stream
;
namespace
document_clipboard_visitors
{
class
:
public
,
public
::
{
typedef
::
;
public
:
<
>
;
*
;
&
;
<
>&
;
<
>&
;
<
,
>
;
<
,
>
;
(
const
&
)
{
=
.
().
(
);
if
(
index
== -
1
)
{
index
=
.
(
);
.
(
,
index
);
return
index
;
}
return
.
()
index
];
}
(
)
{
if
(
.
==
0
)
return
0
;
=
.
().
(
);
if
(
index
== -
1
)
{
index
=
.
(
) +
1
;
.
(
,
index
);
return
index
;
}
return
.
()
index
];
}
(
*
,
<
>&
,
<
>&
,
&
)
:model(
)
, writer(
)
, fontTable(
)
, colorTable(
)
{
;
style
.
(
0
,
0
,
0
,
0
);
style
.
(
0
,
0
,
0
,
0
);
style
->
(
::
,
style
);
.
(
style
);
}
void
(
*
)
{
FOREACH(Ptr<DocumentRun>, subRun, run->runs)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
subRun
);)
{
subRun
(
this
);
}
}
void
(
*
)
override
{
=
->
();
if
(
text
.
() >
0
)
{
=
.
() -
1
];
.
(
L"{\\f"
+
(
(
style
.
.
)));
.
(
L"\\fs"
+
((
)(
style
.
.
*
1.5
)));
.
(
L"\\cf"
+
(
(
style
.
)));
.
(
L"\\cb"
+
(
(
style
.
)));
.
(
L"\\chshdng"
+
(
(
style
.
)));
.
(
L"\\chcbpat"
+
(
(
style
.
)));
if
(
style
.
.
)
.
(
L"\\b"
);
if
(
style
.
.
)
.
(
L"\\i"
);
if
(
style
.
.
)
.
(
L"\\ul"
);
if
(
style
.
.
)
.
(
L"\\strike"
);
for
(
=
0
;
i
<
text
.
();
i
++)
{
.
(
L"\\u"
+
(
text
i
]));
}
.
(
L"}"
);
}
}
void
(
DocumentStylePropertiesRun
*
)
override
{
=
.
() -
1
];
style
->
(
->
,
style
);
.
(
style
);
(
);
.
(
.
() -
1
);
}
void
(
DocumentStyleApplicationRun
*
)
override
{
=
.
() -
1
];
style
->
(
->
,
style
);
.
(
style
);
(
);
.
(
.
() -
1
);
}
void
(
*
)
override
{
=
.
() -
1
];
style
=
->
((
->
==
L""
?
::
:
->
),
style
);
.
(
style
);
(
);
.
(
.
() -
1
);
}
void
(
*
)
override
{
if
(
->
)
{
.
(
L"{\\pict\\pngblip"
);
.
(
L"\\picw"
+
(
->
.
) +
L"\\pich"
+
(
->
.
));
.
(
L"\\picwgoal"
+
(
->
.
*
15
) +
L"\\pichgoal"
+
(
->
.
*
15
) +
L" "
);
;
->
(
memoryStream
,
::
);
= (
)
memoryStream
.
();
*
= (
*)
memoryStream
.
();
for
(
=
0
;
i
<
count
;
i
++)
{
.
(
L"0123456789abcdef"
[
buffer
[
i
] /
16
]);
.
(
L"0123456789abcdef"
[
buffer
[
i
] %
16
]);
}
.
(
L"}"
);
}
}
void
(
DocumentEmbeddedObjectRun
*
)
override
{
}
void
(
*
)
override
{
(
);
}
};
}
using
namespace
document_clipboard_visitors
;
void
(
<
>
,
&
)
{
<
>
;
<
>
;
;
{
(
bodyStream
);
(
.
(),
fontTable
,
colorTable
,
writer
);
FOREACH(Ptr<DocumentParagraphRun>, paragraph, model->paragraphs)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
paragraph
);)
{
if
(
paragraph
)
{
switch
(
paragraph
.
())
{
case
::
:
writer
.
(
L"\\ql{"
);
break
;
case
::
:
writer
.
(
L"\\qc{"
);
break
;
case
::
:
writer
.
(
L"\\qr{"
);
break
;
}
}
else
{
writer
.
(
L"\\ql{"
);
}
paragraph
(&
visitor
);
writer
.
(
L"}\\par"
);
}
}
;
{
;
(
rtfStream
,
encoder
);
(
encoderStream
);
writer
.
(
L"{\\rtf1\\ansi\\deff0{\\fonttbl"
);
FOREACH_INDEXER(WString, fontName, index, fontTable)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
fontTable
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
if
(
bool
=
true
)
for
(
=
0
;
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
fontName
);
index
++)
{
writer
.
(
L"{\\f"
);
writer
.
(
(
index
));
writer
.
(
L" "
);
writer
.
(
fontName
);
writer
.
(
L";}"
);
}
writer
.
(
L"}{\\colortbl"
);
FOREACH_INDEXER(Color, color, index, colorTable)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
colorTable
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
if
(
bool
=
true
)
for
(
=
0
;
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
color
);
index
++)
{
writer
.
(
L";\\red"
);
writer
.
(
(
color
.
));
writer
.
(
L"\\green"
);
writer
.
(
(
color
.
));
writer
.
(
L"\\blue"
);
writer
.
(
(
color
.
));
}
writer
.
(
L";}{\\*\\generator GacUI Document 1.0}\\uc0"
);
{
bodyStream
.
(
0
);
(
bodyStream
);
writer
.
(
reader
.
());
}
writer
.
(
L"}"
);
}
char
=
0
;
rtfStream
.
(&
zero
,
sizeof
(
zero
));
= (
const
char
*)
rtfStream
.
();
}
void
(
<
>
,
stream
::
&
)
{
;
(
,
rtf
);
.
((
void
*)
rtf
.
(),
rtf
.
());
}
}
}