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();
bool bLoadStyleText = true;
bool bLoadStylePage = true;
bool bLoadStyleOverwrite = true;
bool bLoadStyleNumbering = true;
bool bLoadStyleFrame = true;
int nCount = aOptions.getLength();
const beans::PropertyValue* pArray = aOptions.getConstArray();
for(int i = 0; i < nCount; i++)
{
const uno::Any* pVal = &pArray[i].Value;
if( pVal->getValueType() == cppu::UnoType<bool>::get() )
{
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; SwgReaderOption aOpt;
aOpt.SetFrameFormats( bLoadStyleFrame ); aOpt.SetFrameFormats(true);
aOpt.SetTextFormats( bLoadStyleText ); aOpt.SetTextFormats(true);
aOpt.SetPageDescs( bLoadStylePage ); aOpt.SetPageDescs(true);
aOpt.SetNumRules( bLoadStyleNumbering ); aOpt.SetNumRules(true);
aOpt.SetMerge( !bLoadStyleOverwrite ); aOpt.SetMerge(false);
for(const auto& rProperty: aOptions)
sal_uLong nErr = m_pDocShell->LoadStylesFromFile( rURL, aOpt, true ); {
if( nErr ) if(rProperty.Value.getValueType() != cppu::UnoType<bool>::get())
continue;
const bool bValue = rProperty.Value.get<bool>();
if(rProperty.Name == UNO_NAME_OVERWRITE_STYLES)
aOpt.SetMerge(!bValue);
else if(rProperty.Name == UNO_NAME_LOAD_NUMBERING_STYLES)
aOpt.SetNumRules(bValue);
else if(rProperty.Name == UNO_NAME_LOAD_PAGE_STYLES)
aOpt.SetPageDescs(bValue);
else if(rProperty.Name == UNO_NAME_LOAD_FRAME_STYLES)
aOpt.SetFrameFormats(bValue);
else if(rProperty.Name == UNO_NAME_LOAD_TEXT_STYLES)
aOpt.SetTextFormats(bValue);
}
const sal_uLong nErr = m_pDocShell->LoadStylesFromFile( rURL, aOpt, true );
if(nErr)
throw io::IOException(); throw io::IOException();
}
else
throw uno::RuntimeException();
} }
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