use crate::com::variant::Variant;
use crate::config::Config;
use crate::error::OaResult;
use crate::office::constants::PpUpdateOption;
use crate::shapes::inventory::SlideInventory;
pub fn update_links(
inventory: &SlideInventory,
_excel_path: &str,
config: &Config,
) -> OaResult<usize> {
if inventory.ole_shapes.is_empty() || !config.links.set_manual {
return Ok(0);
}
let mut updated = 0;
for ole_ref in &inventory.ole_shapes {
let mut shape = ole_ref.dispatch.clone();
let result = shape.nav("LinkFormat")
.and_then(|mut lf| lf.put("AutoUpdate", Variant::from(PpUpdateOption::Manual as i32)).map_err(|e| e));
if result.is_ok() {
updated += 1;
super::verbose::detail(ole_ref.slide_index, &ole_ref.name, "AutoUpdate=Manual");
}
}
Ok(updated)
}