Kaydet (Commit) 08fdc4f3 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

simplify options here

Change-Id: I9faa4ea8aec6ecd439751323b76bf2d8b071e4ac
üst 0168313e
...@@ -212,49 +212,33 @@ void SwXStyleFamilies::loadStylesFromURL(const OUString& rURL, ...@@ -212,49 +212,33 @@ void SwXStyleFamilies::loadStylesFromURL(const OUString& rURL,
std::exception) std::exception)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
if(IsValid() && !rURL.isEmpty()) if(!IsValid() || rURL.isEmpty())
throw uno::RuntimeException();
SwgReaderOption aOpt;
aOpt.SetFrameFormats(true);
aOpt.SetTextFormats(true);
aOpt.SetPageDescs(true);
aOpt.SetNumRules(true);
aOpt.SetMerge(false);
for(const auto& rProperty: aOptions)
{ {
bool bLoadStyleText = true; if(rProperty.Value.getValueType() != cppu::UnoType<bool>::get())
bool bLoadStylePage = true; continue;
bool bLoadStyleOverwrite = true; const bool bValue = rProperty.Value.get<bool>();
bool bLoadStyleNumbering = true; if(rProperty.Name == UNO_NAME_OVERWRITE_STYLES)
bool bLoadStyleFrame = true; aOpt.SetMerge(!bValue);
else if(rProperty.Name == UNO_NAME_LOAD_NUMBERING_STYLES)
int nCount = aOptions.getLength(); aOpt.SetNumRules(bValue);
const beans::PropertyValue* pArray = aOptions.getConstArray(); else if(rProperty.Name == UNO_NAME_LOAD_PAGE_STYLES)
for(int i = 0; i < nCount; i++) aOpt.SetPageDescs(bValue);
{ else if(rProperty.Name == UNO_NAME_LOAD_FRAME_STYLES)
const uno::Any* pVal = &pArray[i].Value; aOpt.SetFrameFormats(bValue);
if( pVal->getValueType() == cppu::UnoType<bool>::get() ) else if(rProperty.Name == UNO_NAME_LOAD_TEXT_STYLES)
{ aOpt.SetTextFormats(bValue);
const OUString sName = pArray[i].Name;
bool bVal = *static_cast<sal_Bool const *>(pVal->getValue());
if( sName == UNO_NAME_OVERWRITE_STYLES )
bLoadStyleOverwrite = bVal;
else if( sName == UNO_NAME_LOAD_NUMBERING_STYLES )
bLoadStyleNumbering = bVal;
else if( sName == UNO_NAME_LOAD_PAGE_STYLES )
bLoadStylePage = bVal;
else if( sName == UNO_NAME_LOAD_FRAME_STYLES )
bLoadStyleFrame = bVal;
else if( sName == UNO_NAME_LOAD_TEXT_STYLES )
bLoadStyleText = bVal;
}
}
SwgReaderOption aOpt;
aOpt.SetFrameFormats( bLoadStyleFrame );
aOpt.SetTextFormats( bLoadStyleText );
aOpt.SetPageDescs( bLoadStylePage );
aOpt.SetNumRules( bLoadStyleNumbering );
aOpt.SetMerge( !bLoadStyleOverwrite );
sal_uLong nErr = m_pDocShell->LoadStylesFromFile( rURL, aOpt, true );
if( nErr )
throw io::IOException();
} }
else const sal_uLong nErr = m_pDocShell->LoadStylesFromFile( rURL, aOpt, true );
throw uno::RuntimeException(); if(nErr)
throw io::IOException();
} }
uno::Sequence< beans::PropertyValue > SwXStyleFamilies::getStyleLoaderOptions() uno::Sequence< beans::PropertyValue > SwXStyleFamilies::getStyleLoaderOptions()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment