summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/inc/strings.hrc1
-rw-r--r--cui/source/options/optfltr.cxx23
-rw-r--r--cui/source/options/optfltr.hxx3
-rw-r--r--embeddedobj/qa/cppunit/data/insert-file-config.vsdxbin0 -> 12483 bytes
-rw-r--r--embeddedobj/qa/cppunit/general.cxx33
-rw-r--r--embeddedobj/source/general/xcreator.cxx7
-rw-r--r--include/unotools/fltrcfg.hxx3
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs7
-rw-r--r--unotools/source/config/fltrcfg.cxx19
9 files changed, 88 insertions, 8 deletions
diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index 3833d157adff..e6edf6cca478 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -256,6 +256,7 @@
#define RID_SVXSTR_CHG_CALC NC_("RID_SVXSTR_CHG_CALC", "Excel to %PRODUCTNAME Calc or reverse")
#define RID_SVXSTR_CHG_IMPRESS NC_("RID_SVXSTR_CHG_IMPRESS", "PowerPoint to %PRODUCTNAME Impress or reverse")
#define RID_SVXSTR_CHG_SMARTART NC_("RID_SVXSTR_CHG_SMARTART", "SmartArt to %PRODUCTNAME shapes or reverse")
+#define RID_SVXSTR_CHG_VISIO NC_("RID_SVXSTR_CHG_VISIO", "Visio to %PRODUCTNAME Draw or reverse")
#define RID_SVXSTR_OPT_DOUBLE_DICTS NC_("RID_SVXSTR_OPT_DOUBLE_DICTS", "The specified name already exists.\nPlease enter a new name.")
#define RID_SVXSTR_OPT_INVALID_DICT_NAME NC_("RID_SVXSTR_OPT_INVALID_DICT_NAME", "The specified name is invalid.\nPlease enter a new name.")
diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
index 731cab79d50e..925c0c7981d4 100644
--- a/cui/source/options/optfltr.cxx
+++ b/cui/source/options/optfltr.cxx
@@ -34,6 +34,7 @@ enum class MSFltrPg2_CheckBoxEntries {
Calc,
Impress,
SmartArt,
+ Visio,
InvalidCBEntry
};
@@ -132,6 +133,7 @@ OfaMSFilterTabPage2::OfaMSFilterTabPage2(TabPageParent pParent, const SfxItemSet
, sChgToFromCalc(CuiResId(RID_SVXSTR_CHG_CALC))
, sChgToFromImpress(CuiResId(RID_SVXSTR_CHG_IMPRESS))
, sChgToFromSmartArt(CuiResId(RID_SVXSTR_CHG_SMARTART))
+ , sChgToFromVisio(CuiResId(RID_SVXSTR_CHG_VISIO))
, m_xCheckLB(m_xBuilder->weld_tree_view("checklbcontainer"))
, m_xHighlightingRB(m_xBuilder->weld_radio_button("highlighting"))
, m_xShadingRB(m_xBuilder->weld_radio_button("shading"))
@@ -183,14 +185,16 @@ bool OfaMSFilterTabPage2::FillItemSet( SfxItemSet* )
&SvtFilterOptions::SetImpress2PowerPoint },
{ MSFltrPg2_CheckBoxEntries::SmartArt, &SvtFilterOptions::IsSmartArt2Shape,
&SvtFilterOptions::SetSmartArt2Shape },
+ { MSFltrPg2_CheckBoxEntries::Visio, &SvtFilterOptions::IsVisio2Draw,
+ &SvtFilterOptions::SetVisio2Draw },
};
bool bFirstCol = true;
for( const ChkCBoxEntries & rEntry : aChkArr )
{
// we loop through the list, alternating reading the first/second column,
- // each row appears twice in the list (except for smartart, which is import
- // only
+ // each row appears twice in the list (except for smartart and later entries, which are
+ // import only)
sal_uInt16 nCol = bFirstCol ? 0 : 1;
bFirstCol = !bFirstCol;
int nEntry = GetEntry4Type(rEntry.eType);
@@ -200,6 +204,10 @@ bool OfaMSFilterTabPage2::FillItemSet( SfxItemSet* )
if( bCheck != (rOpt.*rEntry.FnIs)() )
(rOpt.*rEntry.FnSet)( bCheck );
}
+ if (rEntry.eType == MSFltrPg2_CheckBoxEntries::SmartArt)
+ {
+ bFirstCol = !bFirstCol;
+ }
}
if( m_xHighlightingRB->get_state_changed_from_saved() )
@@ -237,6 +245,8 @@ void OfaMSFilterTabPage2::Reset( const SfxItemSet* )
if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::EModule::IMPRESS ) )
InsertEntry( sChgToFromImpress, MSFltrPg2_CheckBoxEntries::Impress );
InsertEntry( sChgToFromSmartArt, MSFltrPg2_CheckBoxEntries::SmartArt, false );
+ if (aModuleOpt.IsModuleInstalled(SvtModuleOptions::EModule::DRAW))
+ InsertEntry(sChgToFromVisio, MSFltrPg2_CheckBoxEntries::Visio, false);
static struct ChkCBoxEntries{
MSFltrPg2_CheckBoxEntries eType;
@@ -251,14 +261,15 @@ void OfaMSFilterTabPage2::Reset( const SfxItemSet* )
{ MSFltrPg2_CheckBoxEntries::Impress, &SvtFilterOptions::IsPowerPoint2Impress },
{ MSFltrPg2_CheckBoxEntries::Impress, &SvtFilterOptions::IsImpress2PowerPoint },
{ MSFltrPg2_CheckBoxEntries::SmartArt, &SvtFilterOptions::IsSmartArt2Shape },
+ { MSFltrPg2_CheckBoxEntries::Visio, &SvtFilterOptions::IsVisio2Draw },
};
bool bFirstCol = true;
for( const ChkCBoxEntries & rArr : aChkArr )
{
// we loop through the list, alternating reading the first/second column,
- // each row appears twice in the list (except for smartart, which is import
- // only
+ // each row appears twice in the list (except for smartart and later entries, which are
+ // import only)
sal_uInt16 nCol = bFirstCol ? 0 : 1;
bFirstCol = !bFirstCol;
int nEntry = GetEntry4Type( rArr.eType );
@@ -267,6 +278,10 @@ void OfaMSFilterTabPage2::Reset( const SfxItemSet* )
bool bCheck = (rOpt.*rArr.FnIs)();
m_xCheckLB->set_toggle(nEntry, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE, nCol);
}
+ if (rArr.eType == MSFltrPg2_CheckBoxEntries::SmartArt)
+ {
+ bFirstCol = !bFirstCol;
+ }
}
m_xCheckLB->thaw();
diff --git a/cui/source/options/optfltr.hxx b/cui/source/options/optfltr.hxx
index 2076a7fd13b9..0495b8c49514 100644
--- a/cui/source/options/optfltr.hxx
+++ b/cui/source/options/optfltr.hxx
@@ -55,7 +55,8 @@ class OfaMSFilterTabPage2 : public SfxTabPage
sChgToFromWriter,
sChgToFromCalc,
sChgToFromImpress,
- sChgToFromSmartArt;
+ sChgToFromSmartArt,
+ sChgToFromVisio;
std::unique_ptr<weld::TreeView> m_xCheckLB;
std::unique_ptr<weld::RadioButton> m_xHighlightingRB;
diff --git a/embeddedobj/qa/cppunit/data/insert-file-config.vsdx b/embeddedobj/qa/cppunit/data/insert-file-config.vsdx
new file mode 100644
index 000000000000..bb3a129cfa7b
--- /dev/null
+++ b/embeddedobj/qa/cppunit/data/insert-file-config.vsdx
Binary files differ
diff --git a/embeddedobj/qa/cppunit/general.cxx b/embeddedobj/qa/cppunit/general.cxx
index 43b8dd9f4c1b..bbab17440fe3 100644
--- a/embeddedobj/qa/cppunit/general.cxx
+++ b/embeddedobj/qa/cppunit/general.cxx
@@ -85,6 +85,39 @@ CPPUNIT_TEST_FIXTURE(EmbeddedobjGeneralTest, testInsertFileConfig)
CPPUNIT_ASSERT(!xObject.is());
}
+CPPUNIT_TEST_FIXTURE(EmbeddedobjGeneralTest, testInsertFileConfigVsdx)
+{
+ // Explicitly disable Word->Writer mapping for this test.
+ std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::Filter::Microsoft::Import::VisioToDraw::set(false, pBatch);
+ pBatch->commit();
+ comphelper::ScopeGuard g([]() {
+ std::shared_ptr<comphelper::ConfigurationChanges> pBatchReset(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::Filter::Microsoft::Import::VisioToDraw::set(true, pBatchReset);
+ pBatchReset->commit();
+ });
+ getComponent().set(
+ loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"));
+
+ // Insert a file as an embedded object.
+ uno::Reference<embed::XStorage> xStorage = comphelper::OStorageHelper::GetTemporaryStorage();
+ comphelper::EmbeddedObjectContainer aContainer(xStorage);
+ OUString aFileName
+ = m_directories.getURLFromSrc("embeddedobj/qa/cppunit/data/insert-file-config.vsdx");
+ uno::Sequence<beans::PropertyValue> aMedium{ comphelper::makePropertyValue("URL", aFileName) };
+ OUString aName("Object 1");
+ uno::Reference<embed::XEmbeddedObject> xObject
+ = aContainer.InsertEmbeddedObject(aMedium, aName);
+
+ // Make sure that the insertion fails:
+ // 1) the user explicitly requested that the data is not loaded into Writer
+ // 2) this is non-Windows, so OLE embedding is not an option
+ // so silently still loading the data into Writer would be bad.
+ CPPUNIT_ASSERT(!xObject.is());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/general/xcreator.cxx b/embeddedobj/source/general/xcreator.cxx
index aa19cf429185..640244d1134c 100644
--- a/embeddedobj/source/general/xcreator.cxx
+++ b/embeddedobj/source/general/xcreator.cxx
@@ -242,6 +242,13 @@ static OUString HandleFilter(const uno::Reference<uno::XComponentContext>& xComp
aRet.clear();
}
}
+ if (!officecfg::Office::Common::Filter::Microsoft::Import::VisioToDraw::get(xComponentContext))
+ {
+ if (rFilter == "Visio Document")
+ {
+ aRet.clear();
+ }
+ }
return aRet;
}
diff --git a/include/unotools/fltrcfg.hxx b/include/unotools/fltrcfg.hxx
index 8ea6a7fbfa1a..c015740dcaf2 100644
--- a/include/unotools/fltrcfg.hxx
+++ b/include/unotools/fltrcfg.hxx
@@ -95,6 +95,9 @@ public:
bool IsMSOLockFileCreationIsEnabled() const;
void EnableMSOLockFileCreation(bool bEnable);
+ bool IsVisio2Draw() const;
+ void SetVisio2Draw(bool bFlag);
+
static SvtFilterOptions& Get();
};
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index d216c029f41e..af847483bb7a 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -3848,6 +3848,13 @@
</info>
<value>false</value>
</prop>
+ <prop oor:name="VisioToDraw" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Specifies if convertible Visio OLE objects are converted
+ into Draw objects.</desc>
+ </info>
+ <value>true</value>
+ </prop>
</group>
<group oor:name="Export">
<info>
diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx
index e6a4fa1faf6c..5ebfdbf90668 100644
--- a/unotools/source/config/fltrcfg.cxx
+++ b/unotools/source/config/fltrcfg.cxx
@@ -52,10 +52,11 @@ enum class ConfigFlags {
WordWbctbl = 0x0200000,
SmartArtShapeLoad = 0x0400000,
CharBackgroundToHighlighting = 0x8000000,
- CreateMSOLockFiles = 0x2000000
+ CreateMSOLockFiles = 0x2000000,
+ VisioLoad = 0x4000000,
};
namespace o3tl {
- template<> struct typed_flags<ConfigFlags> : is_typed_flags<ConfigFlags, 0xf7fff3f> {};
+ template<> struct typed_flags<ConfigFlags> : is_typed_flags<ConfigFlags, 0xe7fff3f> {};
}
class SvtAppFilterOptions_Impl : public utl::ConfigItem
@@ -318,7 +319,8 @@ const Sequence<OUString>& GetPropertyNames()
"Import/ImportWWFieldsAsEnhancedFields", // 11
"Import/SmartArtToShapes", // 12
"Export/CharBackgroundToHighlighting", // 13
- "Import/CreateMSOLockFiles" // 14
+ "Import/CreateMSOLockFiles", // 14
+ "Import/VisioToDraw" // 15
};
return aNames;
}
@@ -357,6 +359,9 @@ static ConfigFlags lcl_GetFlag(sal_Int32 nProp)
case 12: nFlag = ConfigFlags::SmartArtShapeLoad; break;
case 13: nFlag = ConfigFlags::CharBackgroundToHighlighting; break;
case 14: nFlag = ConfigFlags::CreateMSOLockFiles; break;
+ case 15:
+ nFlag = ConfigFlags::VisioLoad;
+ break;
default: OSL_FAIL("illegal value");
}
@@ -596,6 +601,14 @@ void SvtFilterOptions::SetSmartArt2Shape( bool bFlag )
SetModified();
}
+bool SvtFilterOptions::IsVisio2Draw() const { return pImpl->IsFlag(ConfigFlags::VisioLoad); }
+
+void SvtFilterOptions::SetVisio2Draw(bool bFlag)
+{
+ pImpl->SetFlag(ConfigFlags::VisioLoad, bFlag);
+ SetModified();
+}
+
namespace
{
class theFilterOptions