StoryFragment クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
XPS ドキュメント内のストーリーのすべてまたは一部を表します。
public ref class StoryFragment
public ref class StoryFragment : System::Collections::Generic::IEnumerable<System::Windows::Documents::DocumentStructures::BlockElement ^>, System::Windows::Markup::IAddChild
public class StoryFragment
[System.Windows.Markup.ContentProperty("BlockElementList")]
public class StoryFragment : System.Collections.Generic.IEnumerable<System.Windows.Documents.DocumentStructures.BlockElement>, System.Windows.Markup.IAddChild
type StoryFragment = class
interface IAddChild
[<System.Windows.Markup.ContentProperty("BlockElementList")>]
type StoryFragment = class
interface IAddChild
interface seq<BlockElement>
interface IEnumerable
[<System.Windows.Markup.ContentProperty("BlockElementList")>]
type StoryFragment = class
interface seq<BlockElement>
interface IEnumerable
interface IAddChild
Public Class StoryFragment
Public Class StoryFragment
Implements IAddChild, IEnumerable(Of BlockElement)
- 継承
-
StoryFragment
- 属性
- 実装
例
次の例は、XML Paper Specification (XPS) ドキュメントの <StoryFragment> 部分を示しています。
<StoryFragment StoryName="DocumentBody" FragmentType="Content">
<SectionStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1Heading1" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P1" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P2" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P3" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P4" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P5" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1Heading2" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P6" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="Pg1P7" />
</ParagraphStructure>
<TableStructure>
<TableRowGroupStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R1C1P1" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R1C2P1" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R2C1P1" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R2C2P1" />
</ParagraphStructure>
<ParagraphStructure>
<NamedElement NameReference="R2C2P2" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R3C1P1" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R3C2P1" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R4C1P1" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R4C2P1" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R5C1P1" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="R5C2P1" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
</TableRowGroupStructure>
</TableStructure>
</SectionStructure>
</StoryFragment>
注釈
XPS ドキュメントの XPS ストーリーは、新聞や雑誌のストーリーにほぼ似ています。 これは、通常、1 つの XPS ドキュメント内の 1 つのトピックに関するテキストとグラフィック コンテンツの一節です。 通常、それは複数のページにまたがるが、それはサイドバーのようなページよりも短いことができます - ボックス化された物語 - 雑誌で。 また、4 ページ目で続くフロントページの新聞記事のように、不連続なストーリーを作成することもできます。 そのため、特定のページに複数のストーリーと複数のストーリーの一部を含めることができます。 ヘッダーまたはフッターは、1 つのページに完全に含まれている特別な種類のストーリーでもあります。
StoryFragmentは、ストーリーの全体または一部を表します。 複数のページにまたがることは決してできませんが、ページ全体を占有したり、ページを他のフラグメントと共有したりできます。 ストーリーが複数のページにある場合、各ページのストーリーの各部分は個別のフラグメントになります。 ストーリーには不連続なフラグメントのセットを含めることができますが、フラグメント自体を不連続にすることはできません。
StoryFragmentsの親にできるのは、StoryFragment要素だけです。 StoryBreak内のStoryFragment要素の位置は、ストーリーが複数のフラグメントに含まれているかどうか、および追加のフラグメントが現在のフラグメントの前または後にあるかどうかを示します。
StoryFragmentが何らかの構造要素の途中で終了する場合 (たとえば、<TableRowGroupStructure>)、XPS ドキュメント生成アプリケーションは、後のフラグメントで構造が継続されている場合でも、</TableRowGroupStructure> タグの前に要素の適切な終了タグ (この場合は</StoryFragment>) を挿入する必要があります。 (これは、 StoryFragment 内の要素ツリーが有効な XML であることを確認するために必要です)。ストーリーを続けるフラグメントは、中断された構造体の開始タグで始まる必要があります。 中断された構造体のツリー全体を同じ方法で処理する必要があります (1 つの例外を除き、以下で説明します)。中断ポイントを超える一致しない開始タグごとに、終了タグを追加する必要があります。
例外は、 </TableCellStructure> タグの直後にストーリーの中断が発生した場合に適用されます。生成アプリケーションは、ストーリーを続行するフラグメント内の対応するポイントに空のテーブル セル構造 (<TableCellStructure></TableCellStructure>) を挿入する必要があります。 これは、特定のストーリーのすべてのフラグメントをマージする必要があるアプリケーションを使用する場合に、単純なアルゴリズムを使用してこれを行うために必要です。
たとえば、アプリケーションが XPS ドキュメントに次の資料を追加するとします。
<SectionStructure>
<TableStructure>
<TableRowGroupStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="SomeContent" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="MoreContent" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="EvenMoreContent" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="LastContent" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
</TableRowGroupStructure>
</TableStructure>
</SectionStructure>
"SomeContent" の </TableCellStructure> の直後に改ページによってフラグメントが強制的に終了する場合、アプリケーションは次の例に示すように分割を作成する必要があります。
<StoryFragment StoryName="MyStory" FragmentType="Content">
<SectionStructure>
<TableStructure>
<TableRowGroupStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="SomeContent" />
</ParagraphStructure>
</TableCellStructure>
<!-- lines from here to end of fragment added by producer-->
</TableRowStructure>
</TableRowGroupStructure>
</TableStructure>
</SectionStructure>
</StoryFragment>
<StoryFragment StoryName="MyStory" FragmentType="Content">
<SectionStructure>
<TableStructure>
<TableRowGroupStructure>
<TableRowStructure>
<TableCellStructure>
<!-- extra cell added by producer-->
</TableCellStructure>
<!-- lines from here to start of fragment added by producer-->
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="MoreContent" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
<TableRowStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="EvenMoreContent" />
</ParagraphStructure>
</TableCellStructure>
<TableCellStructure>
<ParagraphStructure>
<NamedElement NameReference="LastContent" />
</ParagraphStructure>
</TableCellStructure>
</TableRowStructure>
</TableRowGroupStructure>
</TableStructure>
</SectionStructure>
</StoryFragment>
ドキュメントを読み取るアプリケーションでは、このコンテンツをマージする必要がある場合があります。 たとえば、[ ストーリー全体をクリップボードにコピー ] ボタンがある XPS ビューアーを考えてみましょう。または音声シンセサイザーにストーリーを渡した ブラインド アプリケーションの XPS 。 ドキュメントを読み取る一部のアプリケーションでは、ストーリーのフラグメントのサブセットをマージする必要がある場合があります。 たとえば、3 回クリックして段落全体をクリップボードにコピーする機能では、段落が改ページにまたがったときに必ずマージを実行する必要があります。このような段落は 2 つの StoryFragmentに分割されるためです。
マージするには、次のアルゴリズムを使用します。
マージする最初のフラグメントの末尾から
</StoryFragment>を削除し、2 番目のフラグメントの先頭から<StoryFragment>を削除します。最初のフラグメントの最後の終了タグが、2 番目のフラグメントの最初の開始タグと同じ型の場合 (およびタグが
<NamedElement>されていない場合)、両方を削除します。2 つのフラグメントが 次のいずれかの 状態になるまで、手順 2 を繰り返します。
- 先頭フラグメントの最後の終了タグと末尾のフラグメントの最初の開始タグの間に型の一致がなくなりました。
- 先頭フラグメントの最後の終了タグは、末尾のフラグメントの最初の開始タグの両方が
<NamedElement>タグです。
上の例では、生成元のアプリケーションによって空のセルが追加されていない場合、フラグメントの結合により、2 つのセルを含む元の最初の行ではなく、"SomeContent" と "MoreContent" の両方の参照を含む 1 つのセルしか含まれていないテーブルが生成されます。それぞれに 1 つの参照が含まれています。
ストーリー全体をマージするときは、同じストーリーの一部である後続のフラグメントごとにアルゴリズムを繰り返す必要があります。 ストーリーに属するフラグメントは、 <Story> 要素でインデックスが作成されます。
XPS: 仕様とライセンス ダウンロードで取得できる XML Paper Specification (XPS) 仕様のセクション 9.1.15 を参照してください。 特定のストーリーの最後のフラグメントには、最後の子として StoryBreak 要素が含まれます。
コンストラクター
| 名前 | 説明 |
|---|---|
| StoryFragment() |
StoryFragment クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| FragmentName |
ストーリー フラグメントの名前を取得または設定します。 |
| FragmentType |
フラグメントの種類を取得または設定します。 |
| StoryName |
ストーリーの名前を取得または設定します。 |
メソッド
| 名前 | 説明 |
|---|---|
| Add(BlockElement) |
ストーリー フラグメントにブロックを追加します。 |
| Equals(Object) |
指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
明示的なインターフェイスの実装
| 名前 | 説明 |
|---|---|
| IAddChild.AddChild(Object) |
このメンバーは .NET Framework インフラストラクチャをサポートしており、コードから直接使用するためのものではありません。 |
| IAddChild.AddText(String) |
ノードのテキスト コンテンツをオブジェクトに追加します。 |
| IEnumerable.GetEnumerator() |
このメソッドは実装されていません。 |
| IEnumerable<BlockElement>.GetEnumerator() |
このメソッドは実装されていません。 |