シェイプの効果的プロパティ

このトピックでは、効果的およびローカルプロパティについて説明します。これらのレベルで値を直接設定する場合、

  1. ポーションのスライド上のポーションプロパティ。
  2. レイアウトまたはマスタースライドのプロトタイプシェイプテキストスタイル(ポーションのテキストフレームシェイプがある場合)。
  3. プレゼンテーションのグローバルテキスト設定。

これらの値はローカル値と呼ばれます。いかなるレベルでも、ローカル値を定義したり、省略したりできます。しかし、最終的にアプリケーションがポーションがどのように見えるべきかを知る必要があるとき、効果的値を使用します。ローカルフォーマットから**GetEffective()**メソッドを使用して効果的値を取得できます。

以下の例は、効果的値の取得方法を示しています。

// The path to the documents directory.
const String templatePath = u"../templates/Presentation1.pptx";
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(templatePath);
System::SharedPtr<IAutoShape> shape = System::DynamicCast_noexcept<Aspose::Slides::IAutoShape>(pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0));
System::SharedPtr<ITextFrameFormat> localTextFrameFormat = shape->get_TextFrame()->get_TextFrameFormat();
System::SharedPtr<ITextFrameFormatEffectiveData> effectiveTextFrameFormat = localTextFrameFormat->GetEffective();
System::SharedPtr<IPortionFormat> localPortionFormat = shape->get_TextFrame()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0)->get_PortionFormat();
System::SharedPtr<IPortionFormatEffectiveData> effectivePortionFormat = localPortionFormat->GetEffective();

カメラの効果的プロパティを取得する

Aspose.Slides for C++では、開発者がカメラの効果的プロパティを取得できるようにします。この目的のために、Aspose.SlidesにCameraEffectiveDataクラスが追加されました。CameraEffectiveDataクラスは、効果的なカメラプロパティを含む不変オブジェクトを表します。CameraEffectiveDataクラスのインスタンスは、ThreeDFormatクラスの効果的な値のペアであるThreeDFormatEffectiveDataクラスの一部として使用されます。

以下のコードサンプルは、カメラの効果的プロパティを取得する方法を示しています。

// The path to the documents directory.
const String templatePath = u"../templates/Presentation1.pptx";
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(templatePath);
System::SharedPtr<IThreeDFormatEffectiveData> threeDEffectiveData = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0)->get_ThreeDFormat()->GetEffective();
System::Console::WriteLine(u"= Effective camera properties =");
System::Console::WriteLine(System::String(u"Type: ") + System::ObjectExt::ToString((int)threeDEffectiveData->get_Camera()->get_CameraType()));
System::Console::WriteLine(System::String(u"Field of view: ") + threeDEffectiveData->get_Camera()->get_FieldOfViewAngle());
System::Console::WriteLine(System::String(u"Zoom: ") + threeDEffectiveData->get_Camera()->get_Zoom());

ライトリグの効果的プロパティを取得する

Aspose.Slides for C++では、開発者がライトリグの効果的プロパティを取得できるようにします。この目的のために、Aspose.SlidesにLightRigEffectiveDataクラスが追加されました。LightRigEffectiveDataクラスは、効果的なライトリグプロパティを含む不変オブジェクトを表します。LightRigEffectiveDataクラスのインスタンスは、ThreeDFormatクラスの効果的な値のペアであるThreeDFormatEffectiveDataクラスの一部として使用されます。

以下のコードサンプルは、ライトリグの効果的プロパティを取得する方法を示しています。

// The path to the documents directory.
const String templatePath = u"../templates/Presentation1.pptx";
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(templatePath);
System::SharedPtr<IThreeDFormatEffectiveData> threeDEffectiveData = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0)->get_ThreeDFormat()->GetEffective();
System::Console::WriteLine(u"= Effective light rig properties =");
System::Console::WriteLine(System::String(u"Type: ") + System::ObjectExt::ToString((int)threeDEffectiveData->get_LightRig()->get_LightType()));
System::Console::WriteLine(System::String(u"Direction: ") + System::ObjectExt::ToString((int)threeDEffectiveData->get_LightRig()->get_Direction()));

ベベルシェイプの効果的プロパティを取得する

Aspose.Slides for C++では、開発者がベベルシェイプの効果的プロパティを取得できるようにします。この目的のために、Aspose.SlidesにShapeBevelEffectiveDataクラスが追加されました。ShapeBevelEffectiveDataクラスは、効果的なシェイプのフェイスレリーフプロパティを含む不変オブジェクトを表します。ShapeBevelEffectiveDataクラスのインスタンスは、ThreeDFormatクラスの効果的な値のペアであるThreeDFormatEffectiveDataクラスの一部として使用されます。

以下のコードサンプルは、ベベルシェイプの効果的プロパティを取得する方法を示しています。

// The path to the documents directory.
const String templatePath = u"../templates/Presentation1.pptx";
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(templatePath);
System::SharedPtr<IThreeDFormatEffectiveData> threeDEffectiveData = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0)->get_ThreeDFormat()->GetEffective();
System::Console::WriteLine(u"= Effective shape's top face relief properties =");
System::Console::WriteLine(System::String(u"Type: ") + System::ObjectExt::ToString((int)threeDEffectiveData->get_BevelTop()->get_BevelType()));
System::Console::WriteLine(System::String(u"Width: ") + threeDEffectiveData->get_BevelTop()->get_Width());
System::Console::WriteLine(System::String(u"Height: ") + threeDEffectiveData->get_BevelTop()->get_Height());

テキストフレームの効果的プロパティを取得する

Aspose.Slides for C++を使用すると、テキストフレームの効果的プロパティを取得できます。この目的のために、効果的なテキストフレーム書式プロパティを含むTextFrameFormatEffectiveDataクラスがAspose.Slidesに追加されました。

以下のコードサンプルは、効果的なテキストフレーム書式プロパティを取得する方法を示しています。

// The path to the documents directory.
const String templatePath = u"../templates/Presentation1.pptx";
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(templatePath);
System::SharedPtr<IAutoShape> shape = System::DynamicCast_noexcept<Aspose::Slides::IAutoShape>(pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0));
System::SharedPtr<ITextFrameFormatEffectiveData> effectiveTextFrameFormat = shape->get_TextFrame()->get_TextFrameFormat()->GetEffective();
System::Console::WriteLine(System::String(u"Anchoring type: ") + System::ObjectExt::ToString((int)effectiveTextFrameFormat->get_AnchoringType()));
System::Console::WriteLine(System::String(u"Autofit type: ") + System::ObjectExt::ToString((int)effectiveTextFrameFormat->get_AutofitType()));
System::Console::WriteLine(System::String(u"Text vertical type: ") + System::ObjectExt::ToString((int)effectiveTextFrameFormat->get_TextVerticalType()));
System::Console::WriteLine(u"Margins");
System::Console::WriteLine(System::String(u" Left: ") + effectiveTextFrameFormat->get_MarginLeft());
System::Console::WriteLine(System::String(u" Top: ") + effectiveTextFrameFormat->get_MarginTop());
System::Console::WriteLine(System::String(u" Right: ") + effectiveTextFrameFormat->get_MarginRight());
System::Console::WriteLine(System::String(u" Bottom: ") + effectiveTextFrameFormat->get_MarginBottom());

テキストスタイルの効果的プロパティを取得する

Aspose.Slides for C++を使用すると、テキストスタイルの効果的プロパティを取得できます。この目的のために、効果的なテキストスタイルプロパティを含むTextStyleEffectiveDataクラスがAspose.Slidesに追加されました。

以下のコードサンプルは、効果的なテキストスタイルプロパティを取得する方法を示しています。

// The path to the documents directory.
const String templatePath = u"../templates/Presentation1.pptx";
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(templatePath);
System::SharedPtr<IAutoShape> shape = System::DynamicCast_noexcept<Aspose::Slides::IAutoShape>(pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0));
System::SharedPtr<ITextStyleEffectiveData> effectiveTextStyle = shape->get_TextFrame()->get_TextFrameFormat()->get_TextStyle()->GetEffective();
for (int32_t i = 0; i <= 8; i++)
{
System::SharedPtr<IParagraphFormatEffectiveData> effectiveStyleLevel = effectiveTextStyle->GetLevel(i);
System::Console::WriteLine(System::String(u"= Effective paragraph formatting for style level #") + i + u" =");
System::Console::WriteLine(System::String(u"Depth: ") + effectiveStyleLevel->get_Depth());
System::Console::WriteLine(System::String(u"Indent: ") + effectiveStyleLevel->get_Indent());
System::Console::WriteLine(System::String(u"Alignment: ") + System::ObjectExt::ToString(effectiveStyleLevel->get_Alignment()));
System::Console::WriteLine(System::String(u"Font alignment: ") + System::ObjectExt::ToString(effectiveStyleLevel->get_FontAlignment()));
}

効果的なフォント高さ値を取得する

Aspose.Slides for C++を使用すると、フォントの高さの効果的プロパティを取得できます。ここでは、異なるプレゼンテーション構造レベルでローカルフォント高さ値を設定した後の、ポーションの効果的フォント高さ値の変更を示すコードです。

// The path to the documents directory.
const String outPath = u"../out/SetLocalFontHeightValues.pptx";
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>();
System::SharedPtr<IAutoShape> newShape = pres->get_Slides()->idx_get(0)->get_Shapes()->AddAutoShape(Aspose::Slides::ShapeType::Rectangle, 100.0f, 100.0f, 400.0f, 75.0f, false);
newShape->AddTextFrame(u"");
newShape->get_TextFrame()->get_Paragraphs()->idx_get(0)->get_Portions()->Clear();
System::SharedPtr<IPortion> portion0 = System::MakeObject<Portion>(u"Sample text with first portion");
System::SharedPtr<IPortion> portion1 = System::MakeObject<Portion>(u" and second portion.");
newShape->get_TextFrame()->get_Paragraphs()->idx_get(0)->get_Portions()->Add(portion0);
newShape->get_TextFrame()->get_Paragraphs()->idx_get(0)->get_Portions()->Add(portion1);
System::Console::WriteLine(u"Effective font height just after creation:");
System::Console::WriteLine(System::String(u"Portion #0: ") + portion0->get_PortionFormat()->GetEffective()->get_FontHeight());
System::Console::WriteLine(System::String(u"Portion #1: ") + portion1->get_PortionFormat()->GetEffective()->get_FontHeight());
pres->get_DefaultTextStyle()->GetLevel(0)->get_DefaultPortionFormat()->set_FontHeight(24.0f);
System::Console::WriteLine(u"Effective font height after setting entire presentation default font height:");
System::Console::WriteLine(System::String(u"Portion #0: ") + portion0->get_PortionFormat()->GetEffective()->get_FontHeight());
System::Console::WriteLine(System::String(u"Portion #1: ") + portion1->get_PortionFormat()->GetEffective()->get_FontHeight());
newShape->get_TextFrame()->get_Paragraphs()->idx_get(0)->get_ParagraphFormat()->get_DefaultPortionFormat()->set_FontHeight(40.0f);
System::Console::WriteLine(u"Effective font height after setting paragraph default font height:");
System::Console::WriteLine(System::String(u"Portion #0: ") + portion0->get_PortionFormat()->GetEffective()->get_FontHeight());
System::Console::WriteLine(System::String(u"Portion #1: ") + portion1->get_PortionFormat()->GetEffective()->get_FontHeight());
newShape->get_TextFrame()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0)->get_PortionFormat()->set_FontHeight(55.0f);
System::Console::WriteLine(u"Effective font height after setting portion #0 font height:");
System::Console::WriteLine(System::String(u"Portion #0: ") + portion0->get_PortionFormat()->GetEffective()->get_FontHeight());
System::Console::WriteLine(System::String(u"Portion #1: ") + portion1->get_PortionFormat()->GetEffective()->get_FontHeight());
newShape->get_TextFrame()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(1)->get_PortionFormat()->set_FontHeight(18.0f);
System::Console::WriteLine(u"Effective font height after setting portion #1 font height:");
System::Console::WriteLine(System::String(u"Portion #0: ") + portion0->get_PortionFormat()->GetEffective()->get_FontHeight());
System::Console::WriteLine(System::String(u"Portion #1: ") + portion1->get_PortionFormat()->GetEffective()->get_FontHeight());
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);

テーブルの効果的な塗りつぶしフォーマットを取得する

Aspose.Slides for C++を使用すると、異なるテーブル論理部分のための効果的な塗りつぶしフォーマットを取得できます。この目的のために、効果的な塗りつぶし書式プロパティを含むIFillFormatEffectiveDataインターフェイスがAspose.Slidesに追加されました。セルの書式設定は常に行の書式設定よりも優先され、行は列よりも優先され、列は全体のテーブルよりも優先されます。

したがって、最終的にCellFormatEffectiveDataプロパティが常にテーブル描画に使用されます。以下のコードサンプルは、異なるテーブル論理部分のための効果的な塗りつぶしフォーマットを取得する方法を示しています。

// The path to the documents directory.
const String templatePath = u"../templates/Presentation1.pptx";
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(templatePath);
System::SharedPtr<ITable> tbl = System::DynamicCast_noexcept<Aspose::Slides::ITable>(pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0));
System::SharedPtr<ITableFormatEffectiveData> tableFormatEffective = tbl->get_TableFormat()->GetEffective();
System::SharedPtr<IRowFormatEffectiveData> rowFormatEffective = tbl->get_Rows()->idx_get(0)->get_RowFormat()->GetEffective();
System::SharedPtr<IColumnFormatEffectiveData> columnFormatEffective = tbl->get_Columns()->idx_get(0)->get_ColumnFormat()->GetEffective();
System::SharedPtr<ICellFormatEffectiveData> cellFormatEffective = tbl->idx_get(0, 0)->get_CellFormat()->GetEffective();
System::SharedPtr<IFillFormatEffectiveData> tableFillFormatEffective = tableFormatEffective->get_FillFormat();
System::SharedPtr<IFillFormatEffectiveData> rowFillFormatEffective = rowFormatEffective->get_FillFormat();
System::SharedPtr<IFillFormatEffectiveData> columnFillFormatEffective = columnFormatEffective->get_FillFormat();
System::SharedPtr<IFillFormatEffectiveData> cellFillFormatEffective = cellFormatEffective->get_FillFormat();