#include "GuiDocumentEditor.h"
namespace
{
namespace
{
using
namespace
collections
;
using
namespace
document_editor
;
namespace
document_operation_visitors
{
class
:
public
,
public
::
{
public
:
;
()
:start(
0
)
{
}
void
(
*
)
{
for
(
=
->
.
() -
1
;
i
>=
0
;
i
--)
{
=
;
->
i
]
(
this
);
if
(
oldStart
==
)
{
->
.
(
i
);
}
}
}
void
(
*
)
{
+=
->
().
();
}
void
(
*
)
override
{
(
);
}
void
(
DocumentStylePropertiesRun
*
)
override
{
(
);
}
void
(
DocumentStyleApplicationRun
*
)
override
{
(
);
}
void
(
*
)
override
{
(
);
}
void
(
*
)
override
{
(
);
}
void
(
DocumentEmbeddedObjectRun
*
)
override
{
(
);
}
void
(
*
)
override
{
(
);
}
};
}
using
namespace
document_operation_visitors
;
namespace
document_operation_visitors
{
class
:
public
,
public
::
{
public
:
*
;
<
::
>
;
<
<
>>
;
(
*
)
:model(
)
{
::
;
resolvedStyle
->
(
::
,
resolvedStyle
);
.
(
resolvedStyle
);
}
const
::
&
()
{
return
.
() -
1
];
}
void
(
*
)
{
for
(
=
0
;
i
<
->
.
();
i
++)
{
<
>
=
->
i
];
.
();
subRun
(
this
);
if
(
.
() >
0
)
{
->
.
(
i
);
for
(
=
0
;
j
<
.
();
j
++)
{
->
.
(
i
+
j
,
j
]);
}
i
--;
}
}
}
void
(
*
)
override
{
}
bool
(
*
)
{
bool
=
true
;
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
);)
{
if
(!
subRun
.
<
>() && !
subRun
.
<
DocumentEmbeddedObjectRun
>())
{
onlyImageOrObject
=
false
;
break
;
}
}
return
onlyImageOrObject
;
}
void
(
DocumentStylePropertiesRun
*
)
override
{
if
(
(
))
{
(
,
->
);
return
;
}
const
::
&
=
();
::
=
->
(
->
,
currentResolvedStyle
);
if
(
currentResolvedStyle
.
.
resolvedStyle
.
.
)
->
<
>();
if
(
currentResolvedStyle
.
.
==
resolvedStyle
.
.
)
->
<
>();
if
(
currentResolvedStyle
.
resolvedStyle
.
)
->
<
>();
if
(
currentResolvedStyle
.
resolvedStyle
.
)
->
<
>();
if
(
currentResolvedStyle
.
.
==
resolvedStyle
.
.
)
->
<
bool
>();
if
(
currentResolvedStyle
.
.
==
resolvedStyle
.
.
)
->
<
bool
>();
if
(
currentResolvedStyle
.
.
==
resolvedStyle
.
.
)
->
<
bool
>();
if
(
currentResolvedStyle
.
.
==
resolvedStyle
.
.
)
->
<
bool
>();
if
(
currentResolvedStyle
.
.
==
resolvedStyle
.
.
)
->
<
bool
>();
if
(
currentResolvedStyle
.
.
==
resolvedStyle
.
.
)
->
<
bool
>();
if
(
->
)
goto
CONTINUE_PROCESSING;
if
(
->
)
goto
CONTINUE_PROCESSING;
if
(
->
)
goto
CONTINUE_PROCESSING;
if
(
->
)
goto
CONTINUE_PROCESSING;
if
(
->
)
goto
CONTINUE_PROCESSING;
if
(
->
)
goto
CONTINUE_PROCESSING;
if
(
->
)
goto
CONTINUE_PROCESSING;
if
(
->
)
goto
CONTINUE_PROCESSING;
if
(
->
)
goto
CONTINUE_PROCESSING;
if
(
->
)
goto
CONTINUE_PROCESSING;
(
,
->
);
return
;
CONTINUE_PROCESSING:
if
(
(
->
).Cast<
DocumentStylePropertiesRun
>().First(
nullptr
) !=
nullptr
)
{
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
);)
{
if
(
auto
=
subRun
.
<
DocumentStylePropertiesRun
>())
{
::
(
styleRun
,
->
);
.
(
styleRun
);
}
else
{
auto
=
(
).
<
DocumentStylePropertiesRun
>();
parentRun
.
(
subRun
);
.
(
parentRun
);
}
}
return
;
}
.
(
resolvedStyle
);
(
);
.
(
.
() -
1
);
}
void
(
DocumentStyleApplicationRun
*
)
override
{
if
(
(
))
{
(
,
->
);
return
;
}
const
::
&
=
();
::
=
->
(
->
,
currentResolvedStyle
);
.
(
resolvedStyle
);
(
);
.
(
.
() -
1
);
}
void
(
*
)
override
{
const
::
&
=
();
::
=
->
(
->
,
currentResolvedStyle
);
.
(
resolvedStyle
);
(
);
.
(
.
() -
1
);
}
void
(
*
)
override
{
}
void
(
DocumentEmbeddedObjectRun
*
)
override
{
}
void
(
*
)
override
{
(
);
}
};
}
using
namespace
document_operation_visitors
;
namespace
document_operation_visitors
{
class
:
public
,
public
::
{
public
:
<
>
;
<
>
;
void
(
*
)
override
{
if
(
auto
=
.
<
>())
{
->
text
sibilingRun
text
;
;
}
}
void
(
DocumentStylePropertiesRun
*
)
override
{
if
(
auto
=
.
<
DocumentStylePropertiesRun
>())
{
if
(
->
sibilingRun
)
return
;
if
(
->
sibilingRun
)
return
;
if
(
->
sibilingRun
)
return
;
if
(
->
sibilingRun
)
return
;
if
(
->
sibilingRun
)
return
;
if
(
->
sibilingRun
)
return
;
if
(
->
sibilingRun
)
return
;
if
(
->
sibilingRun
)
return
;
if
(
->
sibilingRun
)
return
;
if
(
->
sibilingRun
)
return
;
(
->
,
sibilingRun
,
true
);
;
}
}
void
(
DocumentStyleApplicationRun
*
)
override
{
if
(
auto
=
.
<
DocumentStyleApplicationRun
>())
{
if
(
->
==
sibilingRun
)
{
(
->
,
sibilingRun
,
true
);
;
}
}
}
void
(
*
)
override
{
if
(
auto
=
.
<
>())
{
if
(
->
==
sibilingRun
&&
->
==
sibilingRun
&&
->
==
sibilingRun
&&
->
==
sibilingRun
)
{
(
->
,
sibilingRun
,
true
);
;
}
}
}
void
(
*
)
override
{
}
void
(
DocumentEmbeddedObjectRun
*
)
override
{
}
void
(
*
)
override
{
}
};
class
MergeSiblingRunRecursivelyVisitor
:
public
,
public
::
{
public
:
<
>
;
<
>
;
void
(
*
)
{
for
(
=
0
;
i
<
->
.
() -
1
;
i
++)
{
auto
=
->
i
];
auto
=
->
i
+
1
];
;
visitor
.
nextRun
;
currentRun
(&
visitor
);
if
(
visitor
.
)
{
->
.
(
i
+
1
);
->
i
]
visitor
.
;
i
--;
}
}
for
(
=
0
;
i
<
->
.
() -
1
;
i
++)
{
->
i
]
(
this
);
}
}
void
(
*
)
override
{
}
void
(
DocumentStylePropertiesRun
*
)
override
{
(
);
}
void
(
DocumentStyleApplicationRun
*
)
override
{
(
);
}
void
(
*
)
override
{
(
);
}
void
(
*
)
override
{
}
void
(
DocumentEmbeddedObjectRun
*
)
override
{
}
void
(
*
)
override
{
(
);
}
};
}
using
namespace
document_operation_visitors
;
namespace
{
void
(
*
,
*
)
{
{
;
->
(&
visitor
);
}
{
(
);
->
(&
visitor
);
}
{
MergeSiblingRunRecursivelyVisitor
;
->
(&
visitor
);
}
}
}
}
}