[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - 1134 commits - accessibility/bridge accessibility/inc accessibility/Jar_accessibility.mk accessibility/Jar_uno_accessbridge.mk accessibility/Module_accessibility.mk accessibility/source android/experimental android/sdremote avmedia/source basctl/inc basctl/Module_basctl.mk basctl/source basctl/UI_basicide.mk basctl/uiconfig basebmp/test basegfx/inc basegfx/Makefile basegfx/source basegfx/test basic/CppunitTest_basic_coverage.mk basic/inc basic/Module_basic.mk basic/qa basic/source bean/Library_officebean.mk binaryurp/README bin/create_bootstrap_links bin/distro-install-file-lists binfilter bin/mkworkdir bin/repo-list.in boost/boost_1_44_0-clang-warnings.patch boost/boost.4100.warnings.patch boost/boost.4510.warnings.patch boost/boost.6397.warnings.patch boost/boost.6940.glibc.patch boost/boost.7551.unusedvars.patch boost/UnpackedTarball_boost.mk bootstrap bridges/CustomTarget_gcc3_ios_arm.mk bridges/inc bridges/source cairo/cairo -1.10.2.patch cairo/pixman-0.24.4.patch cairo/prj canvas/source canvas/workben chart2/Library_chartcontroller.mk chart2/source chart2/uiconfig cli_ure/CliNativeLibrary_cli_cppuhelper.mk cli_ure/CustomTarget_cli_ure_assemblies.mk cli_ure/Executable_climaker.mk cli_ure/Library_cli_cppuhelper_native.mk cli_ure/Library_cli_uno.mk cli_ure/source codemaker/source codemaker/StaticLibrary_codemaker_cpp.mk codemaker/StaticLibrary_codemaker_java.mk codemaker/StaticLibrary_codemaker.mk comphelper/inc comphelper/source compilerplugins/clang compilerplugins/Makefile-clang.mk compilerplugins/README config_host.mk.in config_host.mk.source configmgr/source configure.ac configure.in connectivity/CppunitTest_connectivity_ado.mk connectivity/inc connectivity/Library_postgresql-sdbc-impl.mk connectivity/Module_connectivity.mk connectivity/prj connectivity/qa connectivity/source connectivity/workben cosv/StaticLibrary_cosv.mk cppcanvas/inc cppcanvas/Library_cppcanvas.mk cppcanvas/Library_mtfrend erer.mk cppcanvas/Makefile cppcanvas/Module_cppcanvas.mk cppcanvas/Package_inc.mk cppcanvas/source cppuhelper/Module_cppuhelper.mk cross_tail_build/prj cross_toolset/Makefile ct2n/ConvertTextToNumber-1.3.2-no-license.patch ct2n/ConvertTextToNumber-1.3.2-no-visible-by-default.patch ct2n/delzip ct2n/description-en-US.txt ct2n/Makefile ct2n/makefile.mk ct2n/Module_ct2n.mk ct2n/prj ct2n/README ct2n/UnpackedTarball_ct2n.mk ct2n/Zip_ct2n.mk cui/AllLangResTarget_cui.mk cui/source cui/uiconfig cui/UI_cui.mk cui/util curl/curl-7.26.0_mingw.patch curl/curl-7.26.0_win.patch curl/ExternalPackage_curl.mk curl/ExternalProject_curl.mk curl/Makefile curl/makefile.mk curl/Module_curl.mk curl/prj curl/UnpackedTarball_curl.mk dbaccess/JunitTest_dbaccess_complex.mk dbaccess/JunitTest_dbaccess_unoapi.mk dbaccess/source dbaccess/uiconfig desktop/scripts desktop/source desktop/test dictionaries distro-configs/LibreOfficeLinux.conf dmake/unix download drawinglayer/drawinglayer.component drawinglaye r/inc drawinglayer/Library_drawinglayer.mk drawinglayer/Makefile drawinglayer/Package_inc.mk drawinglayer/README drawinglayer/source dtrans/prj editeng/AllLangResTarget_editeng.mk editeng/CppunitTest_editeng_borderline.mk editeng/CppunitTest_editeng_lookuptree.mk editeng/inc editeng/Library_editeng.mk editeng/Makefile editeng/Module_editeng.mk editeng/Package_inc.mk editeng/source embeddedobj/Library_embobj.mk embeddedobj/prj embeddedobj/README embeddedobj/source embedserv/source epm/ExternalPackage_epm.mk epm/ExternalProject_epm.mk epm/Makefile epm/makefile.mk epm/Module_epm.mk epm/prj epm/UnpackedTarball_epm.mk eventattacher/source expat/expat-2.1.0.patch expat/ExternalPackage_expat.mk expat/ExternalProject_expat.mk expat/Makefile expat/makefile.mk expat/Module_expat.mk expat/prj expat/StaticLibrary_ascii_expat_xmlparse.mk expat/StaticLibrary_expat_x64.mk expat/StaticLibrary_expat_xmlparse.mk expat/StaticLibrary_expat_xmltok.mk expat/UnpackedTarball_expat.mk extensions/Mak efile extensions/prj extensions/qa extensions/source extensions/StaticLibrary_npsoenv.mk extensions/test extensions/workben external/glibc-2.1.3.patch external/mingw-dlls extras/ExternalPackage_extra_fonts.mk extras/Module_extras.mk extras/Package_extra_fonts.mk extras/source fileaccess/prj filter/inc filter/Jar_XSLTFilter.mk filter/Library_msfilter.mk filter/Module_filter.mk filter/Package_inc.mk filter/prj filter/qa filter/source fontconfig/ExternalPackage_fontconfig.mk fontconfig/ExternalProject_fontconfig.mk fontconfig/Makefile fontconfig/makefile.mk fontconfig/Module_fontconfig.mk fontconfig/prj fontconfig/README fontconfig/UnpackedTarball_fontconfig.mk forms/source formula/inc formula/source fpicker/prj fpicker/source fpicker/test framework/inc framework/source freetype/ExternalPackage_freetype.mk freetype/ExternalProject_freetype.mk freetype/Makefile freetype/makefile.mk freetype/Module_freetype.mk freetype/prj freetype/README freetype/UnpackedTarball_freetype.mk g gd k-pixbuf/gdk-pixbuf-2.23.0.patch gdk-pixbuf/gdk-pixbuf-2.23.0-win32.patch gdk-pixbuf/makefile.mk gdk-pixbuf/prj gdk-pixbuf/README gettext/gettext-0.18.1.1.patch gettext/gettext-0.18.1.1.stpncpy.patch gettext/makefile.mk gettext/prj gettext/README .git-hooks/commit-msg git-hooks/commit-msg .git-hooks/post-merge git-hooks/post-merge .git-hooks/pre-commit git-hooks/pre-commit .git-hooks/README git-hooks/README .gitignore .gitmodules glib/glib-2.28.1.noise.patch glib/glib-2.28.1.patch glib/glib-2.28.1-win32-2.patch glib/glib-2.28.1-win32.patch glib/makefile.mk glib/prj glib/README graphite/graphite-2.3.1_debug.patch graphite/graphite2.issue1030.patch.1 graphite/graphite2.placementnew.patch graphite/graphite_make.patch graphite/Makefile graphite/makefile.mk graphite/Module_graphite.mk graphite/prj graphite/StaticLibrary_graphite.mk graphite/UnpackedTarball_graphite.mk helpcompiler/Library_helplinker.mk helpcontent2 hsqldb/prj hsqldb/UnpackedTarball_hsqldb.mk hsqldb/version.mk hun spell/ExternalPackage_hunspell.mk hunspell/ExternalProject_hunspell.mk hunspell/hunspell-static.patch hunspell/hunspell-wntconfig.patch hunspell/Makefile hunspell/makefile.mk hunspell/Module_hunspell.mk hunspell/prj hunspell/StaticLibrary_hunspell.mk hunspell/UnpackedTarball_hunspell.mk hwpfilter/qa hwpfilter/source hyphen/ExternalPackage_hyphen.mk hyphen/ExternalProject_hyphen.mk hyphen/hyphen-build.patch hyphen/Makefile hyphen/makefile.mk hyphen/Module_hyphen.mk hyphen/prj hyphen/StaticLibrary_hyphen.mk hyphen/UnpackedTarball_hyphen.mk i18npool/CppunitTest_i18npool_test_languagetag.mk i18npool/inc i18npool/Library_i18nisolang1.mk i18npool/Library_i18nsearch.mk i18npool/README i18npool/source icon-themes/classic icon-themes/galaxy icon-themes/hicontrast icon-themes/human icon-themes/industrial icon-themes/oxygen icon-themes/tango icon-themes/tango_testing io/prj ios/experimental jurt/test jvmfwk/plugins l10ntools/README l10ntools/source l10ntools/StaticLibrary_transex.mk la nguagetool/ExternalProject_languagetool.mk lcms2/makefile.mk lcms2/README libcdr/ExternalProject_libcdr.mk libcdr/prj libcmis/libcmis-0.3.0.patch libcmis/prj libcmis/UnpackedTarball_cmis.mk libcroco/libcroco-0.6.2.patch libcroco/makefile.mk libcroco/prj libcroco/README libgsf/libgsf-1.14.19.patch libgsf/libgsf-1.14.19.windows.patch libgsf/makefile.mk libgsf/prj libgsf/README liblangtag/liblangtag-0.2-0001-Fix-a-memory-leak.patch liblangtag/liblangtag-0.2-0002-Fix-invalid-memory-access.patch liblangtag/liblangtag-0.2-configure.patch liblangtag/liblangtag-0.2-datadir.patch liblangtag/liblangtag-0.2-mingw-genfile.patch liblangtag/liblangtag-0.2-mingw.patch liblangtag/liblangtag-0.2-msc-configure.patch liblangtag/liblangtag-0.2-msvc-warning.patch liblangtag/liblangtag-0.2-reg2xml-encoding-problem.patch liblangtag/liblangtag-0.2-xmlCleanupParser.patch liblangtag/liblangtag-0.4.0-cross.patch liblangtag/liblangtag-0.4.0-mac.patch liblangtag/liblangtag-0.4.0-mingw.patch liblangtag/l iblangtag-0.4.0-msc-configure.patch liblangtag/liblangtag-0.4.0-msvcprojects.patch liblangtag/liblangtag-0.4.0-msvc-warning.patch liblangtag/liblangtag-0.4.0-reg2xml-encoding-problem.patch liblangtag/liblangtag-0.4.0-windows2.patch liblangtag/liblangtag-0.4.0-windows.patch liblangtag/makefile.mk liblangtag/prj libmspub/prj liborcus/ExternalProject_liborcus.mk liborcus/prj libpng/prj Library_merged.mk librelogo/Addons.xcu librelogo/ChangeLog librelogo/description-en.txt librelogo/description-hu.txt librelogo/description.xml librelogo/help librelogo/icons librelogo/LibreLogo librelogo/LibreLogoDummy.py librelogo/make.py librelogo/META-INF librelogo/Office librelogo/pythonpath librelogo/README librsvg/librsvg-2.32.1.patch librsvg/librsvg-2.32.1-win32.patch librsvg/makefile.mk librsvg/prj librsvg/README libvisio/ExternalPackage_libvisio.mk libvisio/ExternalProject_libvisio.mk libvisio/libvisio-0.0.19.patch libvisio/Module_libvisio.mk libvisio/prj libvisio/StaticLibrary_visio.mk libvisio/UnpackedTarball_visio.mk libwpd/ExternalProject_libwpd.mk libwpd/prj libwpg/prj libwps/libwps.gcc.warnings.patch libwps/libwps.msvc.warnings.patch libwps/prj libwps/UnpackedTarball_wps.mk libxml2/makefile.mk libxmlsec/makefile.mk libxmlsec/xmlsec1-mingw32.patch libxslt/makefile.mk lingucomponent/Library_hyphen.mk lingucomponent/Library_lnth.mk lingucomponent/source linguistic/inc linguistic/source lotuswordpro/qa lotuswordpro/source lpsolve/lp_solve_5.5.patch lpsolve/lp_solve_5.5-windows.patch lpsolve/lp_solve-fixed-warn.patch lpsolve/makefile.mk m4/README Makefile Makefile.top mdds/prj Module_cross_tail_build.mk Module_tail_build.mk more_fonts/ExternalPackage_dejavu.mk more_fonts/ExternalPackage_gentium.mk more_fonts/ExternalPackage_liberation.mk more_fonts/ExternalPackage_liberation_narrow.mk more_fonts/ExternalPackage_libertineg.mk more_fonts/fonts more_fonts/Module_more_fonts.mk more_fonts/Package_dejavu.mk more_fonts/Package_gentium.mk more_fonts/Package_libera tion.mk more_fonts/Package_liberation_narrow.mk more_fonts/Package_libertineg.mk more_fonts/README mysqlc/source mythes/ExternalPackage_mythes.mk mythes/ExternalProject_mythes.mk mythes/Makefile mythes/makefile.mk mythes/Module_mythes.mk mythes/mythes-1.2.0-makefile-mk.diff mythes/prj mythes/StaticLibrary_mythes.mk mythes/UnpackedTarball_mythes.mk neon/prj nlpsolver/src np_sdk/StaticLibrary_nputils.mk nss/makefile.mk nss/nsinstall.py nss/nspr-4.9-build.patch nss/nss-3.13.3-build.patch nss/nss.patch nss/nss.patch.mingw odk/examples odk/pack offapi/com offapi/Module_offapi.mk offapi/type_reference offapi/UnoApiMerge_types.mk offapi/UnoApi_offapi.mk officecfg/CustomTarget_registry.mk officecfg/registry ooo.lst.in oovbaapi/genconstidl oovbaapi/Makefile oovbaapi/Module_oovbaapi.mk oovbaapi/ooo oovbaapi/UnoApi_oovbaapi.mk oowintool oox/inc oox/source openldap/ExternalPackage_openldap.mk openldap/ExternalProject_openldap.mk openldap/Makefile openldap/makefile.mk openldap/Module_ope nldap.mk openldap/prj openldap/UnpackedTarball_openldap.mk package/inc package/source packimages/prj padmin/source pango/makefile.mk pango/pango-1.28.3-non-ascii.patch pango/pango-1.28.3.patch pango/pango-1.28.3-win32.patch pango/prj post_download.in postgresql/ExternalPackage_postgresql.mk postgresql/ExternalProject_postgresql.mk postgresql/Makefile postgresql/makefile.mk postgresql/Module_postgresql.mk postgresql/prj postgresql/README postgresql/UnpackedTarball_postgresql.mk postprocess/packcomponents postprocess/packconfig postprocess/prj pyuno/Library_pyuno_wrapper.mk pyuno/source qadevOOo/objdsc qadevOOo/tests rdbmaker/Executable_rdbmaker.mk rdbmaker/inc rdbmaker/Makefile rdbmaker/Module_rdbmaker.mk rdbmaker/prj rdbmaker/README rdbmaker/source readlicense_oo/html readlicense_oo/odt readlicense_oo/txt registry/StaticLibrary_registry_helper.mk remotebridges/prj reportbuilder/Extension_reportbuilder.mk reportbuilder/util reportdesign/source RepositoryExternal.mk Repository Fixes.mk Repository.mk RepositoryModule_ooo.mk rsc/source sal/CppunitTest_sal_rtl_bootstrap.mk sal/inc sal/Module_sal.mk sal/osl sal/qa sal/rtl saxon/build.xml saxon/ExternalProject_saxon.mk saxon/Makefile saxon/Module_saxon.mk saxon/Package_saxon.mk saxon/prj saxon/README saxon/UnpackedTarball_saxon.mk sax/source scaddins/Library_analysis.mk scaddins/source sc/AllLangResTarget_sc.mk sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_macros_test.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_subsequent_filters_test.mk sc/inc sc/Library_sc.mk sc/Module_sc.mk scp2/InstallModule_ooo.mk scp2/README scp2/source sc/qa scripting/java scripting/prj scripting/source sc/sdi sc/source sc/uiconfig sd/CppunitTest_sd_filters_test.mk sd/CppunitTest_sd_regression_test.mk sd/CppunitTest_sd_uimpress.mk sdext/Executable_xpdfimport.mk sdext/Extension_minimizer.mk sdext/Extension_presenter.mk sdext/source sd/Library_sd.mk sd/Library_sdui.mk sd/qa sd/source sd/uiconfig sd/workb en setup_native/source sfx2/inc sfx2/Library_sfx.mk sfx2/sdi sfx2/source sfx2/uiconfig sfx2/UI_sfx.mk sfx2/workben shell/Library_ooofilt_x64.mk shell/Library_propertyhdl_x64.mk shell/Library_shlxthdl_x64.mk shell/prj shell/source shell/StaticLibrary_shlxthandler_common_x64.mk shell/StaticLibrary_xmlparser_x64.mk slideshow/source solenv/bin solenv/CustomTarget_concat-deps.mk solenv/gbuild solenv/inc solenv/Module_solenv.mk solenv/Package_concat-deps.mk solver/README sot/CppunitTest_sot_test_sot.mk sot/qa sot/source starmath/CppunitTest_starmath_qa_cppunit.mk starmath/inc starmath/qa starmath/source starmath/uiconfig stax/makefile.mk stax/prj stax/README stlport/README stoc/prj stoc/source svgio/inc svgio/Library_svgio.mk svgio/Makefile svgio/Module_svgio.mk svgio/Package_inc.mk svgio/prj svgio/source svgio/svgio.component svl/CppunitTest_svl_urihelper.mk svl/inc svl/qa svl/source svtools/bmpmaker svtools/inc svtools/langsupport svtools/Library_svt.mk svtools/Package_inc.mk sv tools/qa svtools/source svtools/uiconfig svx/inc svx/Library_svxcore.mk svx/Package_inc.mk svx/source svx/workben sw/AllLangResTarget_sw.mk sw/CppunitTest_sw_filters_test.mk sw/CppunitTest_sw_regression_test.mk sw/CppunitTest_sw_subsequent_odfexport.mk sw/CppunitTest_sw_subsequent_odfimport.mk sw/CppunitTest_sw_subsequent_ooxmlexport.mk sw/CppunitTest_sw_subsequent_ooxmlimport.mk sw/CppunitTest_sw_subsequent_rtfexport.mk sw/CppunitTest_sw_subsequent_rtfimport.mk sw/CppunitTest_sw_subsequent_ww8export.mk sw/CppunitTest_sw_subsequent_ww8import.mk swext/Extension_wiki-publisher.mk swext/mediawiki sw/inc sw/qa sw/README sw/sdi sw/source sw/uiconfig sw/UI_swriter.mk sysui/desktop sysui/prj tail_build/prj test/README test/source tomcat/prj toolkit/inc toolkit/source tools/CustomTarget_reversemap.mk tools/inc tools/qa tools/README tools/source tools/StaticLibrary_ooopathutils.mk touch/source translations tubes/AllLangResTarget_tubes.mk tubes/Library_tubes.mk tubes/Module_tubes.mk t ubes/source tubes/uiconfig tubes/UI_tubes.mk ucbhelper/inc ucbhelper/Library_ucbhelper.mk ucbhelper/Package_inc.mk ucbhelper/source ucb/README ucb/source ucpp/UnpackedTarball_ucpp.mk udm/StaticLibrary_udm.mk UnoControls/inc UnoControls/source unotest/inc unotest/source unotools/inc unotools/source unusedcode.easy ure/Zip_uretest.mk uui/source vbahelper/README vbahelper/source vcl/AllLangResTarget_vcl.mk vcl/aqua vcl/generic vcl/headless vcl/inc vcl/ios vcl/Library_vcl.mk vcl/Library_vclplug_gen.mk vcl/Library_vclplug_kde4.mk vcl/Library_vclplug_kde.mk vcl/Library_vclplug_svp.mk vcl/Makefile vcl/null vcl/Package_inc.mk vcl/qa vcl/source vcl/StaticLibrary_vclmain.mk vcl/test vcl/uiconfig vcl/unx vcl/vcl.android.component vcl/vcl.headless.component vcl/vcl.ios.component vcl/vcl.macosx.component vcl/vcl.unx.component vcl/vcl.windows.component vcl/win vcl/workben vigra/prj wizards/com wizards/Jar_fax.mk wizards/Jar_letter.mk wizards/Module_wizards.mk wizards/Pyuno_fax.mk wizards/ Pyuno_letter.mk writerfilter/inc writerfilter/Library_writerfilter_uno.mk writerfilter/Module_writerfilter.mk writerfilter/qa writerfilter/source writerfilter/unocomponent writerperfect/Library_wpftdraw.mk x11_extensions/prj xmlhelp/source xmloff/inc xmloff/Library_xo.mk xmloff/Package_inc.mk xmloff/source xmlscript/inc xmlscript/source xmlsecurity/inc xmlsecurity/qa xmlsecurity/source xmlsecurity/workben xpdf/makefile.mk xsltml/prj zlib/ExternalPackage_zlib.mk zlib/Makefile zlib/makefile.mk zlib/make_patched_header.pl zlib/Module_zlib.mk zlib/prj zlib/StaticLibrary_zlib.mk zlib/StaticLibrary_zlib_x64.mk zlib/UnpackedTarball_zlib.mk zlib/zlib-dmakebuild.patch
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Nov 7 08:44:57 PST 2012
Rebased ref, commits from common ancestor:
commit 542127042490f99849f51cab2f93c40fa8f4c7f4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 23:53:44 2012 -0400
When setting a link position to a repeat element, set the range parent flag.
Change-Id: I86b999297f96c4a2e55682d1da9a6c2e62f5f472
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 4a0684d..b9d518b 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -99,6 +99,7 @@ void ScXMLSourceDlg::SetReference(const ScRange& rRange, ScDocument* pDoc)
return;
pUserData->maLinkedPos = rRange.aStart;
+ pUserData->mbRangeParent = pUserData->meType == ScOrcusXMLTreeParam::ElementRepeat;
}
void ScXMLSourceDlg::Deactivate()
commit 01151e1b747a4d275dba333983b590a429b40afd
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 23:45:50 2012 -0400
Don't allow reference mode when the control is disabled.
Change-Id: I9ba6121ee67f3f4fc0b4a1fb3b14036fce2e88e9
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index e6f39e3..4a0684d 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -74,7 +74,7 @@ ScXMLSourceDlg::~ScXMLSourceDlg()
sal_Bool ScXMLSourceDlg::IsRefInputMode() const
{
- return mpActiveEdit != NULL;
+ return mpActiveEdit != NULL && mpActiveEdit->IsEnabled();
}
void ScXMLSourceDlg::SetReference(const ScRange& rRange, ScDocument* pDoc)
commit 14238c6e689ddefe43c6060fabfe9ef68431a10b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 23:42:27 2012 -0400
Handle selection of repeat element.
Change-Id: I73eb83fbbd6deb39ba3e736410b8d5b50f3dffaa
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index 6f20942..0f8f0cb 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -83,10 +83,14 @@ private:
void SetRangeLinkable();
/**
- * Check if any of its parents is linked or repeated.
+ * Check if any of its parents is linked or repeated. The passed entry is
+ * not checked; its parent is the first one to be checked, then all its
+ * parents get checked all the way to the root.
*/
bool IsParentDirty(SvLBoxEntry* pEntry) const;
+ bool IsChildrenDirty(SvLBoxEntry* pEntry) const;
+
DECL_LINK(GetFocusHdl, Control*);
DECL_LINK(LoseFocusHdl, Control*);
DECL_LINK(BtnPressedHdl, Button*);
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 75cba63..e6f39e3 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -267,12 +267,26 @@ void ScXMLSourceDlg::DefaultElementSelected(SvLBoxEntry& rEntry)
void ScXMLSourceDlg::RepeatElementSelected(SvLBoxEntry& rEntry)
{
- // TODO: Check all its child elements / attributes and make sure non of
- // them are linked or repeat elements. In the future we will support
- // range linking of repeat element who has another repeat elements. But
- // first I need to support that in orcus.
+ // Check all its parents first.
- SetNonLinkable();
+ if (IsParentDirty(&rEntry))
+ {
+ SetNonLinkable();
+ return;
+ }
+
+ // Check all its child elements / attributes and make sure non of them are
+ // linked or repeat elements. In the future we will support range linking
+ // of repeat element who has another repeat elements. But first I need to
+ // support that scenario in orcus.
+
+ if (IsChildrenDirty(&rEntry))
+ {
+ SetNonLinkable();
+ return;
+ }
+
+ SetRangeLinkable();
}
void ScXMLSourceDlg::AttributeSelected(SvLBoxEntry& rEntry)
@@ -346,6 +360,32 @@ bool ScXMLSourceDlg::IsParentDirty(SvLBoxEntry* pEntry) const
return false;
}
+bool ScXMLSourceDlg::IsChildrenDirty(SvLBoxEntry* pEntry) const
+{
+ ScOrcusXMLTreeParam::EntryData* pUserData = NULL;
+ for (SvLBoxEntry* pChild = maLbTree.FirstChild(pEntry); pChild; pChild = maLbTree.NextSibling(pChild))
+ {
+ pUserData = ScOrcusXMLTreeParam::getUserData(*pChild);
+ OSL_ASSERT(pUserData);
+ if (pUserData->maLinkedPos.IsValid())
+ // Already linked.
+ return true;
+
+ if (pUserData->meType == ScOrcusXMLTreeParam::ElementRepeat)
+ // We don't support linking of nested repeat elements (yet).
+ return true;
+
+ if (pUserData->meType == ScOrcusXMLTreeParam::ElementDefault)
+ {
+ // Check recursively.
+ if (IsChildrenDirty(pChild))
+ return true;
+ }
+ }
+
+ return false;
+}
+
IMPL_LINK(ScXMLSourceDlg, GetFocusHdl, Control*, pCtrl)
{
HandleGetFocus(pCtrl);
commit a3d1947b1e630276d99e5987b0657bfeb16bfe66
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 23:12:52 2012 -0400
I need to check for repeating parent elements too.
Change-Id: I52e87c93e6f3d0108cf517c33f605490dd9a1fc4
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index c3953e4..6f20942 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -82,6 +82,9 @@ private:
void SetSingleLinkable();
void SetRangeLinkable();
+ /**
+ * Check if any of its parents is linked or repeated.
+ */
bool IsParentDirty(SvLBoxEntry* pEntry) const;
DECL_LINK(GetFocusHdl, Control*);
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index e75f1f6..75cba63 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -336,6 +336,11 @@ bool ScXMLSourceDlg::IsParentDirty(SvLBoxEntry* pEntry) const
// This parent is already linked.
return true;
}
+ if (pUserData->meType == ScOrcusXMLTreeParam::ElementRepeat)
+ {
+ // This is a repeat element.
+ return true;
+ }
pParent = maLbTree.GetParent(pParent);
}
return false;
commit 993261149b76b70a50b019b9356b9d2dd9eea0e4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 23:08:53 2012 -0400
Take care of the default element and attribute selection handlers.
Change-Id: I87aec99679f8beca2be82d6d7df275917ba66d62
diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index 4fa223e..2c4b07b 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -30,6 +30,7 @@ struct ScOrcusXMLTreeParam
{
EntryType meType;
ScAddress maLinkedPos; /// linked cell position (invalid if unlinked)
+ bool mbRangeParent;
SC_DLLPUBLIC EntryData(EntryType eType);
};
diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx
index c5e0ac1..068fddf 100644
--- a/sc/source/core/tool/orcusxml.cxx
+++ b/sc/source/core/tool/orcusxml.cxx
@@ -12,7 +12,7 @@
#include "svtools/treelistbox.hxx"
ScOrcusXMLTreeParam::EntryData::EntryData(EntryType eType) :
- meType(eType), maLinkedPos(ScAddress::INITIALIZE_INVALID) {}
+ meType(eType), maLinkedPos(ScAddress::INITIALIZE_INVALID), mbRangeParent(false) {}
ScOrcusXMLTreeParam::EntryData* ScOrcusXMLTreeParam::getUserData(SvLBoxEntry& rEntry)
{
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index c6a5008..c3953e4 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -82,6 +82,8 @@ private:
void SetSingleLinkable();
void SetRangeLinkable();
+ bool IsParentDirty(SvLBoxEntry* pEntry) const;
+
DECL_LINK(GetFocusHdl, Control*);
DECL_LINK(LoseFocusHdl, Control*);
DECL_LINK(BtnPressedHdl, Button*);
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 561f98d..e75f1f6 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -199,8 +199,7 @@ void ScXMLSourceDlg::TreeItemSelected()
return;
ScOrcusXMLTreeParam::EntryData* pUserData = ScOrcusXMLTreeParam::getUserData(*pEntry);
- if (!pUserData)
- return;
+ OSL_ASSERT(pUserData);
const ScAddress& rPos = pUserData->maLinkedPos;
if (rPos.IsValid())
@@ -230,15 +229,39 @@ void ScXMLSourceDlg::TreeItemSelected()
void ScXMLSourceDlg::DefaultElementSelected(SvLBoxEntry& rEntry)
{
+ ScOrcusXMLTreeParam::EntryData* pUserData = NULL;
+
if (maLbTree.GetChildCount(&rEntry) > 0)
{
// Only an element with no child elements (leaf element) can be linked.
+ bool bHasChild = false;
+ for (SvLBoxEntry* pChild = maLbTree.FirstChild(&rEntry); pChild; pChild = maLbTree.NextSibling(pChild))
+ {
+ pUserData = ScOrcusXMLTreeParam::getUserData(*pChild);
+ OSL_ASSERT(pUserData);
+ if (pUserData->meType != ScOrcusXMLTreeParam::Attribute)
+ {
+ // This child is not an attribute. Bail out.
+ bHasChild = true;
+ break;
+ }
+ }
+
+ if (bHasChild)
+ {
+ SetNonLinkable();
+ return;
+ }
+ }
+
+ // Check all its parents and make sure non of them are range-linked nor
+ // repeat elements.
+ if (IsParentDirty(&rEntry))
+ {
SetNonLinkable();
return;
}
- // TODO: Check all its parents and make sure non of them are range-linked
- // nor repeat elements.
SetSingleLinkable();
}
@@ -254,8 +277,28 @@ void ScXMLSourceDlg::RepeatElementSelected(SvLBoxEntry& rEntry)
void ScXMLSourceDlg::AttributeSelected(SvLBoxEntry& rEntry)
{
- // TODO: Check all its parent elements and make sure non of them are
- // range-linked nor repeat elements.
+ // Check all its parent elements and make sure non of them are linked nor
+ // repeat elements. In attribute's case, it's okay to have the immediate
+ // parent element linked (but not range-linked).
+
+ SvLBoxEntry* pParent = maLbTree.GetParent(&rEntry);
+ OSL_ASSERT(pParent); // attribute should have a parent element.
+
+ ScOrcusXMLTreeParam::EntryData* pUserData = ScOrcusXMLTreeParam::getUserData(*pParent);
+ OSL_ASSERT(pUserData);
+ if (pUserData->maLinkedPos.IsValid() && pUserData->mbRangeParent)
+ {
+ // Parent element is range-linked. Bail out.
+ SetNonLinkable();
+ return;
+ }
+
+ if (IsParentDirty(pParent))
+ {
+ SetNonLinkable();
+ return;
+ }
+
SetSingleLinkable();
}
@@ -280,6 +323,24 @@ void ScXMLSourceDlg::SetRangeLinkable()
maRefBtn.Enable();
}
+bool ScXMLSourceDlg::IsParentDirty(SvLBoxEntry* pEntry) const
+{
+ ScOrcusXMLTreeParam::EntryData* pUserData = NULL;
+ SvLBoxEntry* pParent = maLbTree.GetParent(pEntry);
+ while (pParent)
+ {
+ pUserData = ScOrcusXMLTreeParam::getUserData(*pParent);
+ OSL_ASSERT(pUserData);
+ if (pUserData->maLinkedPos.IsValid())
+ {
+ // This parent is already linked.
+ return true;
+ }
+ pParent = maLbTree.GetParent(pParent);
+ }
+ return false;
+}
+
IMPL_LINK(ScXMLSourceDlg, GetFocusHdl, Control*, pCtrl)
{
HandleGetFocus(pCtrl);
commit 79e7c20b771df83f44bc745acbfde6fbb42ffde8
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 21:47:20 2012 -0400
Keep track of linked cell positions.
Change-Id: I33e39e53b618270561ba7bfc236e8d8558bccffa
diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index d615ab6..4fa223e 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -11,6 +11,7 @@
#define __SC_ORCUSXML_HXX__
#include "scdllapi.h"
+#include "address.hxx"
#include "vcl/image.hxx"
#include <boost/ptr_container/ptr_vector.hpp>
@@ -28,6 +29,7 @@ struct ScOrcusXMLTreeParam
struct EntryData
{
EntryType meType;
+ ScAddress maLinkedPos; /// linked cell position (invalid if unlinked)
SC_DLLPUBLIC EntryData(EntryType eType);
};
diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx
index 4e9ef80..c5e0ac1 100644
--- a/sc/source/core/tool/orcusxml.cxx
+++ b/sc/source/core/tool/orcusxml.cxx
@@ -12,7 +12,7 @@
#include "svtools/treelistbox.hxx"
ScOrcusXMLTreeParam::EntryData::EntryData(EntryType eType) :
- meType(eType) {}
+ meType(eType), maLinkedPos(ScAddress::INITIALIZE_INVALID) {}
ScOrcusXMLTreeParam::EntryData* ScOrcusXMLTreeParam::getUserData(SvLBoxEntry& rEntry)
{
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index c4fb781..561f98d 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -88,6 +88,17 @@ void ScXMLSourceDlg::SetReference(const ScRange& rRange, ScDocument* pDoc)
OUString aStr;
rRange.aStart.Format(aStr, SCA_ABS_3D, pDoc, pDoc->GetAddressConvention());
mpActiveEdit->SetRefString(aStr);
+
+ // Set this address to currently selected tree item.
+ SvLBoxEntry* pEntry = maLbTree.GetCurEntry();
+ if (!pEntry)
+ return;
+
+ ScOrcusXMLTreeParam::EntryData* pUserData = ScOrcusXMLTreeParam::getUserData(*pEntry);
+ if (!pUserData)
+ return;
+
+ pUserData->maLinkedPos = rRange.aStart;
}
void ScXMLSourceDlg::Deactivate()
@@ -188,10 +199,19 @@ void ScXMLSourceDlg::TreeItemSelected()
return;
ScOrcusXMLTreeParam::EntryData* pUserData = ScOrcusXMLTreeParam::getUserData(*pEntry);
-
if (!pUserData)
return;
+ const ScAddress& rPos = pUserData->maLinkedPos;
+ if (rPos.IsValid())
+ {
+ OUString aStr;
+ rPos.Format(aStr, SCA_ABS_3D, mpDoc, mpDoc->GetAddressConvention());
+ maRefEdit.SetRefString(aStr);
+ }
+ else
+ maRefEdit.SetRefString(OUString());
+
switch (pUserData->meType)
{
case ScOrcusXMLTreeParam::Attribute:
commit 30cb000de5b1bc8ce3030ee814cc544a7cf1a05f
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 21:32:09 2012 -0400
More progress on the dialog.
Change-Id: Ib07d6d5de7cd0d72356bbb7859342f5038f05f95
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 641dde1..348300f 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -206,6 +206,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/tool/navicfg \
sc/source/core/tool/odffmap \
sc/source/core/tool/optutil \
+ sc/source/core/tool/orcusxml \
sc/source/core/tool/parclass \
sc/source/core/tool/printopt \
sc/source/core/tool/prnsave \
diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index 8809028..7a5256e 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -219,7 +219,6 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\
sc/source/filter/oox/worksheethelper \
sc/source/filter/oox/worksheetsettings \
sc/source/filter/orcus/orcusfiltersimpl \
- sc/source/filter/orcus/orcusxml \
))
# vim: set noet sw=4 ts=4:
diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index cdc4679..d615ab6 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -10,10 +10,13 @@
#ifndef __SC_ORCUSXML_HXX__
#define __SC_ORCUSXML_HXX__
+#include "scdllapi.h"
#include "vcl/image.hxx"
#include <boost/ptr_container/ptr_vector.hpp>
+class SvLBoxEntry;
+
/**
* Parameter used during call to ScOrcusFilters::loadXMLStructure().
*/
@@ -22,14 +25,14 @@ struct ScOrcusXMLTreeParam
enum EntryType { ElementDefault, ElementRepeat, Attribute };
/** Custom data stored with each tree item. */
- struct TreeEntryUserData
+ struct EntryData
{
EntryType meType;
- TreeEntryUserData(EntryType eType);
+ SC_DLLPUBLIC EntryData(EntryType eType);
};
- typedef boost::ptr_vector<TreeEntryUserData> UserDataStoreType;
+ typedef boost::ptr_vector<EntryData> UserDataStoreType;
Image maImgElementDefault;
Image maImgElementRepeat;
@@ -40,6 +43,8 @@ struct ScOrcusXMLTreeParam
* the life cycle of user datas.
*/
UserDataStoreType maUserDataStore;
+
+ static SC_DLLPUBLIC EntryData* getUserData(SvLBoxEntry& rEntry);
};
#endif
diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx
new file mode 100644
index 0000000..4e9ef80
--- /dev/null
+++ b/sc/source/core/tool/orcusxml.cxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "orcusxml.hxx"
+
+#include "svtools/treelistbox.hxx"
+
+ScOrcusXMLTreeParam::EntryData::EntryData(EntryType eType) :
+ meType(eType) {}
+
+ScOrcusXMLTreeParam::EntryData* ScOrcusXMLTreeParam::getUserData(SvLBoxEntry& rEntry)
+{
+ return static_cast<ScOrcusXMLTreeParam::EntryData*>(rEntry.GetUserData());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index c5b8711..b4a1408 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -179,7 +179,7 @@ namespace {
void setUserDataToEntry(
SvLBoxEntry& rEntry, ScOrcusXMLTreeParam::UserDataStoreType& rStore, ScOrcusXMLTreeParam::EntryType eType)
{
- rStore.push_back(new ScOrcusXMLTreeParam::TreeEntryUserData(eType));
+ rStore.push_back(new ScOrcusXMLTreeParam::EntryData(eType));
rEntry.SetUserData(&rStore.back());
}
diff --git a/sc/source/filter/orcus/orcusxml.cxx b/sc/source/filter/orcus/orcusxml.cxx
deleted file mode 100644
index 68746be..0000000
--- a/sc/source/filter/orcus/orcusxml.cxx
+++ /dev/null
@@ -1,15 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include "orcusxml.hxx"
-
-ScOrcusXMLTreeParam::TreeEntryUserData::TreeEntryUserData(EntryType eType) :
- meType(eType) {}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/xmlsourcedlg.hrc b/sc/source/ui/inc/xmlsourcedlg.hrc
index 03cb645..a5df403 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hrc
+++ b/sc/source/ui/inc/xmlsourcedlg.hrc
@@ -17,7 +17,6 @@
#define FT_SOURCE_FILE 12
#define FL_MAP_XML_TO_DOCUMENT 20
-#define FT_TREE_ITEM_NAME 21
#define FT_MAPPED_CELL_TITLE 22
#define ED_MAPPED_CELL 23
#define BTN_MAPPED_CELL 24
@@ -28,7 +27,4 @@
#define IMG_ELEMENT_ATTRIBUTE 52
#define IMG_FILE_OPEN 53
-#define STR_CELL_LINK 70
-#define STR_RANGE_LINK 71
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index f946fb2..c6a5008 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -37,10 +37,9 @@ class ScXMLSourceDlg : public ScAnyRefDlg
FixedLine maFtMapXmlDoc;
- FixedText maFtTreeItemName;
FixedText maFtMappedCellTitle;
- formula::RefEdit maEdit;
- formula::RefButton maBtnRb;
+ formula::RefEdit maRefEdit;
+ formula::RefButton maRefBtn;
ScXMLSourceTree maLbTree;
@@ -48,9 +47,6 @@ class ScXMLSourceDlg : public ScAnyRefDlg
Image maImgFileOpen;
- rtl::OUString maStrCellLink;
- rtl::OUString maStrRangeLink;
-
rtl::OUString maSrcPath;
ScOrcusXMLTreeParam maXMLParam;
@@ -78,6 +74,13 @@ private:
void HandleGetFocus(Control* pCtrl);
void HandleLoseFocus(Control* pCtrl);
void TreeItemSelected();
+ void DefaultElementSelected(SvLBoxEntry& rEntry);
+ void RepeatElementSelected(SvLBoxEntry& rEntry);
+ void AttributeSelected(SvLBoxEntry& rEntry);
+
+ void SetNonLinkable();
+ void SetSingleLinkable();
+ void SetRangeLinkable();
DECL_LINK(GetFocusHdl, Control*);
DECL_LINK(LoseFocusHdl, Control*);
diff --git a/sc/source/ui/src/xmlsourcedlg.src b/sc/source/ui/src/xmlsourcedlg.src
index 342d47a..9d76d97 100644
--- a/sc/source/ui/src/xmlsourcedlg.src
+++ b/sc/source/ui/src/xmlsourcedlg.src
@@ -48,29 +48,25 @@ ModelessDialog RID_SCDLG_XML_SOURCE
Text [ en-US ] = "Map to document";
};
- FixedText FT_TREE_ITEM_NAME
- {
- Pos = MAP_APPFONT( 12, 52 );
- Size = MAP_APPFONT ( 100 , 8 ) ;
- };
-
FixedText FT_MAPPED_CELL_TITLE
{
- Pos = MAP_APPFONT( 12, 67 );
+ Pos = MAP_APPFONT( 12, 55 );
Size = MAP_APPFONT ( 100 , 8 ) ;
+
+ Text [ en-US ] = "Linked cell";
};
Edit ED_MAPPED_CELL
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 12 , 81 ) ;
+ Pos = MAP_APPFONT ( 12 , 67 ) ;
Size = MAP_APPFONT ( 69 , 12 ) ;
TabStop = TRUE ;
};
ImageButton BTN_MAPPED_CELL
{
- Pos = MAP_APPFONT ( 83 , 80 ) ;
+ Pos = MAP_APPFONT ( 83 , 66 ) ;
Size = MAP_APPFONT ( 13 , 15 ) ;
TabStop = FALSE ;
QuickHelpText [ en-US ] = "Shrink" ;
@@ -113,15 +109,5 @@ ModelessDialog RID_SCDLG_XML_SOURCE
Pos = MAP_APPFONT ( 194 , 181 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
-
- String STR_CELL_LINK
- {
- Text [ en-US ] = "Link to cell";
- };
-
- String STR_RANGE_LINK
- {
- Text [ en-US ] = "Link to range";
- };
};
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 6071f82..c4fb781 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -36,17 +36,14 @@ ScXMLSourceDlg::ScXMLSourceDlg(
maBtnSelectSource(this, ScResId(BTN_SELECT_SOURCE_FILE)),
maFtSourceFile(this, ScResId(FT_SOURCE_FILE)),
maFtMapXmlDoc(this, ScResId(FL_MAP_XML_TO_DOCUMENT)),
- maFtTreeItemName(this, ScResId(FT_TREE_ITEM_NAME)),
maFtMappedCellTitle(this, ScResId(FT_MAPPED_CELL_TITLE)),
- maEdit(this, this, ScResId(ED_MAPPED_CELL)),
- maBtnRb(this, ScResId(BTN_MAPPED_CELL), &maEdit, this),
+ maRefEdit(this, this, ScResId(ED_MAPPED_CELL)),
+ maRefBtn(this, ScResId(BTN_MAPPED_CELL), &maRefEdit, this),
maLbTree(this, ScResId(LB_SOURCE_TREE)),
maBtnCancel(this, ScResId(BTN_CANCEL)),
maImgFileOpen(ScResId(IMG_FILE_OPEN)),
- maStrCellLink(ScResId(STR_CELL_LINK).toString()),
- maStrRangeLink(ScResId(STR_RANGE_LINK).toString()),
mpDoc(pDoc),
- mpActiveEdit(&maEdit),
+ mpActiveEdit(&maRefEdit),
mbDlgLostFocus(false)
{
maXMLParam.maImgElementDefault = Image(ScResId(IMG_ELEMENT_DEFAULT));
@@ -59,15 +56,16 @@ ScXMLSourceDlg::ScXMLSourceDlg(
maBtnSelectSource.SetClickHdl(LINK(this, ScXMLSourceDlg, BtnPressedHdl));
Link aLink = LINK(this, ScXMLSourceDlg, GetFocusHdl);
- maEdit.SetGetFocusHdl(aLink);
- maBtnRb.SetGetFocusHdl(aLink);
+ maRefEdit.SetGetFocusHdl(aLink);
+ maRefBtn.SetGetFocusHdl(aLink);
aLink = LINK(this, ScXMLSourceDlg, LoseFocusHdl);
- maEdit.SetLoseFocusHdl(aLink);
- maBtnRb.SetLoseFocusHdl(aLink);
+ maRefEdit.SetLoseFocusHdl(aLink);
+ maRefBtn.SetLoseFocusHdl(aLink);
aLink = LINK(this, ScXMLSourceDlg, TreeItemSelectHdl);
maLbTree.SetSelectHdl(aLink);
- maFtMappedCellTitle.SetText(maStrCellLink);
+
+ SetNonLinkable();
}
ScXMLSourceDlg::~ScXMLSourceDlg()
@@ -172,8 +170,8 @@ void ScXMLSourceDlg::LoadSourceFileStructure(const OUString& rPath)
void ScXMLSourceDlg::HandleGetFocus(Control* pCtrl)
{
mpActiveEdit = NULL;
- if (pCtrl == &maEdit || pCtrl == &maBtnRb)
- mpActiveEdit = &maEdit;
+ if (pCtrl == &maRefEdit || pCtrl == &maRefBtn)
+ mpActiveEdit = &maRefEdit;
if (mpActiveEdit)
mpActiveEdit->SetSelection(Selection(0, SELECTION_MAX));
@@ -186,8 +184,80 @@ void ScXMLSourceDlg::HandleLoseFocus(Control* /*pCtrl*/)
void ScXMLSourceDlg::TreeItemSelected()
{
SvLBoxEntry* pEntry = maLbTree.GetCurEntry();
- OUString aName = maLbTree.GetEntryText(pEntry);
- maFtTreeItemName.SetText(aName);
+ if (!pEntry)
+ return;
+
+ ScOrcusXMLTreeParam::EntryData* pUserData = ScOrcusXMLTreeParam::getUserData(*pEntry);
+
+ if (!pUserData)
+ return;
+
+ switch (pUserData->meType)
+ {
+ case ScOrcusXMLTreeParam::Attribute:
+ AttributeSelected(*pEntry);
+ break;
+ case ScOrcusXMLTreeParam::ElementDefault:
+ DefaultElementSelected(*pEntry);
+ break;
+ case ScOrcusXMLTreeParam::ElementRepeat:
+ RepeatElementSelected(*pEntry);
+ break;
+ default:
+ ;
+ }
+}
+
+void ScXMLSourceDlg::DefaultElementSelected(SvLBoxEntry& rEntry)
+{
+ if (maLbTree.GetChildCount(&rEntry) > 0)
+ {
+ // Only an element with no child elements (leaf element) can be linked.
+ SetNonLinkable();
+ return;
+ }
+
+ // TODO: Check all its parents and make sure non of them are range-linked
+ // nor repeat elements.
+ SetSingleLinkable();
+}
+
+void ScXMLSourceDlg::RepeatElementSelected(SvLBoxEntry& rEntry)
+{
+ // TODO: Check all its child elements / attributes and make sure non of
+ // them are linked or repeat elements. In the future we will support
+ // range linking of repeat element who has another repeat elements. But
+ // first I need to support that in orcus.
+
+ SetNonLinkable();
+}
+
+void ScXMLSourceDlg::AttributeSelected(SvLBoxEntry& rEntry)
+{
+ // TODO: Check all its parent elements and make sure non of them are
+ // range-linked nor repeat elements.
+ SetSingleLinkable();
+}
+
+void ScXMLSourceDlg::SetNonLinkable()
+{
+ maFtMappedCellTitle.Disable();
+ maRefEdit.Disable();
+ maRefBtn.Disable();
+}
+
+void ScXMLSourceDlg::SetSingleLinkable()
+{
+ maFtMappedCellTitle.Enable();
+ maRefEdit.Enable();
+ maRefBtn.Enable();
+}
+
+void ScXMLSourceDlg::SetRangeLinkable()
+{
+ maFtMappedCellTitle.Enable();
+ maRefEdit.Enable();
+ maRefBtn.Enable();
}
IMPL_LINK(ScXMLSourceDlg, GetFocusHdl, Control*, pCtrl)
commit 9e4ed8142a9526b65f5294dea22c7c47274d1e25
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 17:30:20 2012 -0400
Display selected tree item name on the dialog when clicked on.
Change-Id: If7f7d938f4eacfc921a1e591fa4e59c5c9cf127e
diff --git a/sc/source/ui/inc/xmlsourcedlg.hrc b/sc/source/ui/inc/xmlsourcedlg.hrc
index 67cf9b8..03cb645 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hrc
+++ b/sc/source/ui/inc/xmlsourcedlg.hrc
@@ -17,10 +17,11 @@
#define FT_SOURCE_FILE 12
#define FL_MAP_XML_TO_DOCUMENT 20
-#define FT_MAPPED_CELL_TITLE 21
-#define ED_MAPPED_CELL 22
-#define BTN_MAPPED_CELL 23
-#define LB_SOURCE_TREE 24
+#define FT_TREE_ITEM_NAME 21
+#define FT_MAPPED_CELL_TITLE 22
+#define ED_MAPPED_CELL 23
+#define BTN_MAPPED_CELL 24
+#define LB_SOURCE_TREE 25
#define IMG_ELEMENT_DEFAULT 50
#define IMG_ELEMENT_REPEAT 51
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index 75d698f..f946fb2 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -37,6 +37,7 @@ class ScXMLSourceDlg : public ScAnyRefDlg
FixedLine maFtMapXmlDoc;
+ FixedText maFtTreeItemName;
FixedText maFtMappedCellTitle;
formula::RefEdit maEdit;
formula::RefButton maBtnRb;
diff --git a/sc/source/ui/src/xmlsourcedlg.src b/sc/source/ui/src/xmlsourcedlg.src
index 4119601..342d47a 100644
--- a/sc/source/ui/src/xmlsourcedlg.src
+++ b/sc/source/ui/src/xmlsourcedlg.src
@@ -48,25 +48,29 @@ ModelessDialog RID_SCDLG_XML_SOURCE
Text [ en-US ] = "Map to document";
};
- FixedText FT_MAPPED_CELL_TITLE
+ FixedText FT_TREE_ITEM_NAME
{
Pos = MAP_APPFONT( 12, 52 );
Size = MAP_APPFONT ( 100 , 8 ) ;
+ };
- Text [ en-US ] = "";
+ FixedText FT_MAPPED_CELL_TITLE
+ {
+ Pos = MAP_APPFONT( 12, 67 );
+ Size = MAP_APPFONT ( 100 , 8 ) ;
};
Edit ED_MAPPED_CELL
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 12 , 66 ) ;
+ Pos = MAP_APPFONT ( 12 , 81 ) ;
Size = MAP_APPFONT ( 69 , 12 ) ;
TabStop = TRUE ;
};
ImageButton BTN_MAPPED_CELL
{
- Pos = MAP_APPFONT ( 83 , 65 ) ;
+ Pos = MAP_APPFONT ( 83 , 80 ) ;
Size = MAP_APPFONT ( 13 , 15 ) ;
TabStop = FALSE ;
QuickHelpText [ en-US ] = "Shrink" ;
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 1b9f213..6071f82 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -36,6 +36,7 @@ ScXMLSourceDlg::ScXMLSourceDlg(
maBtnSelectSource(this, ScResId(BTN_SELECT_SOURCE_FILE)),
maFtSourceFile(this, ScResId(FT_SOURCE_FILE)),
maFtMapXmlDoc(this, ScResId(FL_MAP_XML_TO_DOCUMENT)),
+ maFtTreeItemName(this, ScResId(FT_TREE_ITEM_NAME)),
maFtMappedCellTitle(this, ScResId(FT_MAPPED_CELL_TITLE)),
maEdit(this, this, ScResId(ED_MAPPED_CELL)),
maBtnRb(this, ScResId(BTN_MAPPED_CELL), &maEdit, this),
@@ -186,8 +187,7 @@ void ScXMLSourceDlg::TreeItemSelected()
{
SvLBoxEntry* pEntry = maLbTree.GetCurEntry();
OUString aName = maLbTree.GetEntryText(pEntry);
- fprintf(stdout, "ScXMLSourceDlg::TreeItemSelected: name = '%s'\n",
- rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
+ maFtTreeItemName.SetText(aName);
}
IMPL_LINK(ScXMLSourceDlg, GetFocusHdl, Control*, pCtrl)
commit deb28a0531ac80e1136c3772ff8e23ed5db67f94
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 17:20:52 2012 -0400
Set user data to each tree entry.
Change-Id: I708bbbae7696a66f7acae8a8d01c98a3c81d32e8
diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index 7a5256e..8809028 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -219,6 +219,7 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\
sc/source/filter/oox/worksheethelper \
sc/source/filter/oox/worksheetsettings \
sc/source/filter/orcus/orcusfiltersimpl \
+ sc/source/filter/orcus/orcusxml \
))
# vim: set noet sw=4 ts=4:
diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index 506e822..019441c 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -28,7 +28,7 @@ public:
virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const = 0;
virtual bool loadXMLStructure(
- SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, ScOrcusXMLTreeParam& rParam) const = 0;
+ const rtl::OUString& rPath, SvTreeListBox& rTreeCtrl, ScOrcusXMLTreeParam& rParam) const = 0;
};
#endif
diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index dfb2867..cdc4679 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -25,6 +25,8 @@ struct ScOrcusXMLTreeParam
struct TreeEntryUserData
{
EntryType meType;
+
+ TreeEntryUserData(EntryType eType);
};
typedef boost::ptr_vector<TreeEntryUserData> UserDataStoreType;
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
index 29562c2..956e940 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -18,7 +18,7 @@ public:
virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const;
virtual bool loadXMLStructure(
- SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, ScOrcusXMLTreeParam& rParam) const;
+ const rtl::OUString& rPath, SvTreeListBox& rTreeCtrl, ScOrcusXMLTreeParam& rParam) const;
};
#endif
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 3e9bca0..c5b8711 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -176,6 +176,13 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
namespace {
+void setUserDataToEntry(
+ SvLBoxEntry& rEntry, ScOrcusXMLTreeParam::UserDataStoreType& rStore, ScOrcusXMLTreeParam::EntryType eType)
+{
+ rStore.push_back(new ScOrcusXMLTreeParam::TreeEntryUserData(eType));
+ rEntry.SetUserData(&rStore.back());
+}
+
void populateTree(
SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker,
const orcus::xml_structure_tree::entity_name& rElemName, bool bRepeat,
@@ -183,8 +190,17 @@ void populateTree(
{
OUString aName(rElemName.name.get(), rElemName.name.size(), RTL_TEXTENCODING_UTF8);
SvLBoxEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent);
+ if (!pEntry)
+ // Can this ever happen!?
+ return;
+
+ setUserDataToEntry(
+ *pEntry, rParam.maUserDataStore,
+ bRepeat ? ScOrcusXMLTreeParam::ElementRepeat : ScOrcusXMLTreeParam::ElementDefault);
+
if (bRepeat)
{
+ // Recurring elements use different icon.
rTreeCtrl.SetExpandedEntryBmp(pEntry, rParam.maImgElementRepeat);
rTreeCtrl.SetCollapsedEntryBmp(pEntry, rParam.maImgElementRepeat);
}
@@ -194,13 +210,20 @@ void populateTree(
orcus::xml_structure_tree::entity_names_type aNames;
+ // Insert attributes.
rWalker.get_attributes(aNames);
orcus::xml_structure_tree::entity_names_type::const_iterator it = aNames.begin();
orcus::xml_structure_tree::entity_names_type::const_iterator itEnd = aNames.end();
for (; it != itEnd; ++it)
{
orcus::xml_structure_tree::entity_name aAttrName = *it;
- SvLBoxEntry* pAttr = rTreeCtrl.InsertEntry(OUString(aAttrName.name.get(), aAttrName.name.size(), RTL_TEXTENCODING_UTF8), pEntry);
+ SvLBoxEntry* pAttr = rTreeCtrl.InsertEntry(
+ OUString(aAttrName.name.get(), aAttrName.name.size(), RTL_TEXTENCODING_UTF8), pEntry);
+
+ if (!pAttr)
+ continue;
+
+ setUserDataToEntry(*pAttr, rParam.maUserDataStore, ScOrcusXMLTreeParam::Attribute);
rTreeCtrl.SetExpandedEntryBmp(pAttr, rParam.maImgAttribute);
rTreeCtrl.SetCollapsedEntryBmp(pAttr, rParam.maImgAttribute);
}
@@ -208,6 +231,7 @@ void populateTree(
rWalker.get_children(aNames);
+ // Insert child elements recursively.
for (it = aNames.begin(), itEnd = aNames.end(); it != itEnd; ++it)
{
orcus::xml_structure_tree::element aElem = rWalker.descend(*it);
@@ -234,8 +258,10 @@ public:
}
bool ScOrcusFiltersImpl::loadXMLStructure(
- SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, ScOrcusXMLTreeParam& rParam) const
+ const rtl::OUString& rPath, SvTreeListBox& rTreeCtrl, ScOrcusXMLTreeParam& rParam) const
{
+ rParam.maUserDataStore.clear();
+
INetURLObject aURL(rPath);
OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8);
const char* path = aSysPath.getStr();
diff --git a/sc/source/filter/orcus/orcusxml.cxx b/sc/source/filter/orcus/orcusxml.cxx
new file mode 100644
index 0000000..68746be
--- /dev/null
+++ b/sc/source/filter/orcus/orcusxml.cxx
@@ -0,0 +1,15 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "orcusxml.hxx"
+
+ScOrcusXMLTreeParam::TreeEntryUserData::TreeEntryUserData(EntryType eType) :
+ meType(eType) {}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 6c3369a..1b9f213 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -165,7 +165,7 @@ void ScXMLSourceDlg::LoadSourceFileStructure(const OUString& rPath)
if (!pOrcus)
return;
- pOrcus->loadXMLStructure(maLbTree, rPath, maXMLParam);
+ pOrcus->loadXMLStructure(rPath, maLbTree, maXMLParam);
}
void ScXMLSourceDlg::HandleGetFocus(Control* pCtrl)
commit 65e30edec743a825daadaeb8fec7a8e43a9a4e58
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 16:35:27 2012 -0400
Use param structure to consolidate parameters for loadXMLStructure() call.
Change-Id: I3e5895cd6b2bae4fd18aa13ebf88321f32a95f8d
diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index 7db7034..506e822 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -15,6 +15,7 @@
class ScDocument;
class SvTreeListBox;
class Image;
+struct ScOrcusXMLTreeParam;
/**
* Collection of orcus filter wrappers.
@@ -27,8 +28,7 @@ public:
virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const = 0;
virtual bool loadXMLStructure(
- SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath,
- const Image& rImgDefaultElem, const Image& rImgRepeatElem, const Image& rImgElemAttr) const = 0;
+ SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, ScOrcusXMLTreeParam& rParam) const = 0;
};
#endif
diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
new file mode 100644
index 0000000..dfb2867
--- /dev/null
+++ b/sc/inc/orcusxml.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __SC_ORCUSXML_HXX__
+#define __SC_ORCUSXML_HXX__
+
+#include "vcl/image.hxx"
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+/**
+ * Parameter used during call to ScOrcusFilters::loadXMLStructure().
+ */
+struct ScOrcusXMLTreeParam
+{
+ enum EntryType { ElementDefault, ElementRepeat, Attribute };
+
+ /** Custom data stored with each tree item. */
+ struct TreeEntryUserData
+ {
+ EntryType meType;
+ };
+
+ typedef boost::ptr_vector<TreeEntryUserData> UserDataStoreType;
+
+ Image maImgElementDefault;
+ Image maImgElementRepeat;
+ Image maImgAttribute;
+
+ /**
+ * Store all custom data instances since the tree control doesn't manage
+ * the life cycle of user datas.
+ */
+ UserDataStoreType maUserDataStore;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
index 2f42d0b..29562c2 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -18,8 +18,7 @@ public:
virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const;
virtual bool loadXMLStructure(
- SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath,
- const Image& rImgDefaultElem, const Image& rImgRepeatElem, const Image& rImgElemAttr) const;
+ SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, ScOrcusXMLTreeParam& rParam) const;
};
#endif
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 8d8705c..3e9bca0 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -10,6 +10,7 @@
#include "orcusfiltersimpl.hxx"
#include "document.hxx"
+#include "orcusxml.hxx"
#include "tools/urlobj.hxx"
#include "svtools/treelistbox.hxx"
@@ -178,15 +179,14 @@ namespace {
void populateTree(
SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker,
const orcus::xml_structure_tree::entity_name& rElemName, bool bRepeat,
- const Image& rImgRepeatElem, const Image& rImgElemAttr,
- SvLBoxEntry* pParent)
+ SvLBoxEntry* pParent, ScOrcusXMLTreeParam& rParam)
{
OUString aName(rElemName.name.get(), rElemName.name.size(), RTL_TEXTENCODING_UTF8);
SvLBoxEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent);
if (bRepeat)
{
- rTreeCtrl.SetExpandedEntryBmp(pEntry, rImgRepeatElem);
- rTreeCtrl.SetCollapsedEntryBmp(pEntry, rImgRepeatElem);
+ rTreeCtrl.SetExpandedEntryBmp(pEntry, rParam.maImgElementRepeat);
+ rTreeCtrl.SetCollapsedEntryBmp(pEntry, rParam.maImgElementRepeat);
}
if (pParent)
@@ -201,8 +201,8 @@ void populateTree(
{
orcus::xml_structure_tree::entity_name aAttrName = *it;
SvLBoxEntry* pAttr = rTreeCtrl.InsertEntry(OUString(aAttrName.name.get(), aAttrName.name.size(), RTL_TEXTENCODING_UTF8), pEntry);
- rTreeCtrl.SetExpandedEntryBmp(pAttr, rImgElemAttr);
- rTreeCtrl.SetCollapsedEntryBmp(pAttr, rImgElemAttr);
+ rTreeCtrl.SetExpandedEntryBmp(pAttr, rParam.maImgAttribute);
+ rTreeCtrl.SetCollapsedEntryBmp(pAttr, rParam.maImgAttribute);
}
rTreeCtrl.Expand(pEntry);
@@ -211,7 +211,7 @@ void populateTree(
for (it = aNames.begin(), itEnd = aNames.end(); it != itEnd; ++it)
{
orcus::xml_structure_tree::element aElem = rWalker.descend(*it);
- populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, rImgRepeatElem, rImgElemAttr, pEntry);
+ populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, pEntry, rParam);
rWalker.ascend();
}
}
@@ -234,8 +234,7 @@ public:
}
bool ScOrcusFiltersImpl::loadXMLStructure(
- SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath,
- const Image& rImgDefaultElem, const Image& rImgRepeatElem, const Image& rImgElemAttr) const
+ SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, ScOrcusXMLTreeParam& rParam) const
{
INetURLObject aURL(rPath);
OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8);
@@ -256,14 +255,14 @@ bool ScOrcusFiltersImpl::loadXMLStructure(
TreeUpdateSwitch aSwitch(rTreeCtrl);
rTreeCtrl.Clear();
- rTreeCtrl.SetDefaultCollapsedEntryBmp(rImgDefaultElem);
- rTreeCtrl.SetDefaultExpandedEntryBmp(rImgDefaultElem);
+ rTreeCtrl.SetDefaultCollapsedEntryBmp(rParam.maImgElementDefault);
+ rTreeCtrl.SetDefaultExpandedEntryBmp(rParam.maImgElementDefault);
orcus::xml_structure_tree::walker aWalker = aXmlTree.get_walker();
// Root element.
orcus::xml_structure_tree::element aElem = aWalker.root();
- populateTree(rTreeCtrl, aWalker, aElem.name, aElem.repeat, rImgRepeatElem, rImgElemAttr, NULL);
+ populateTree(rTreeCtrl, aWalker, aElem.name, aElem.repeat, NULL, rParam);
}
catch (const std::exception&)
{
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index 28e39c3..75d698f 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -16,6 +16,7 @@
#include "expftext.hxx"
#include "anyrefdg.hxx"
+#include "orcusxml.hxx"
#include <boost/scoped_ptr.hpp>
@@ -45,15 +46,14 @@ class ScXMLSourceDlg : public ScAnyRefDlg
CancelButton maBtnCancel;
Image maImgFileOpen;
- Image maImgElemDefault;
- Image maImgElemRepeat;
- Image maImgElemAttribute;
rtl::OUString maStrCellLink;
rtl::OUString maStrRangeLink;
rtl::OUString maSrcPath;
+ ScOrcusXMLTreeParam maXMLParam;
+
ScDocument* mpDoc;
formula::RefEdit* mpActiveEdit;
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 5f244f2..6c3369a 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -42,15 +42,16 @@ ScXMLSourceDlg::ScXMLSourceDlg(
maLbTree(this, ScResId(LB_SOURCE_TREE)),
maBtnCancel(this, ScResId(BTN_CANCEL)),
maImgFileOpen(ScResId(IMG_FILE_OPEN)),
- maImgElemDefault(ScResId(IMG_ELEMENT_DEFAULT)),
- maImgElemRepeat(ScResId(IMG_ELEMENT_REPEAT)),
- maImgElemAttribute(ScResId(IMG_ELEMENT_ATTRIBUTE)),
maStrCellLink(ScResId(STR_CELL_LINK).toString()),
maStrRangeLink(ScResId(STR_RANGE_LINK).toString()),
mpDoc(pDoc),
mpActiveEdit(&maEdit),
mbDlgLostFocus(false)
{
+ maXMLParam.maImgElementDefault = Image(ScResId(IMG_ELEMENT_DEFAULT));
+ maXMLParam.maImgElementRepeat = Image(ScResId(IMG_ELEMENT_REPEAT));
+ maXMLParam.maImgAttribute = Image(ScResId(IMG_ELEMENT_ATTRIBUTE));
+
maBtnSelectSource.SetModeImage(maImgFileOpen);
FreeResource();
@@ -164,8 +165,7 @@ void ScXMLSourceDlg::LoadSourceFileStructure(const OUString& rPath)
if (!pOrcus)
return;
- pOrcus->loadXMLStructure(
- maLbTree, rPath, maImgElemDefault, maImgElemRepeat, maImgElemAttribute);
+ pOrcus->loadXMLStructure(maLbTree, rPath, maXMLParam);
}
void ScXMLSourceDlg::HandleGetFocus(Control* pCtrl)
commit 4f7af1be9f6b7f3c9079a32cd1a3e422e2ca1880
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 13:34:51 2012 -0400
Get it to build.
Change-Id: If281653d848f9940befcb59210bcacf918c422ee
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 31cd8ba..8d8705c 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -12,7 +12,7 @@
#include "document.hxx"
#include "tools/urlobj.hxx"
-#include "svtools/svtreebx.hxx"
+#include "svtools/treelistbox.hxx"
#define __ORCUS_STATIC_LIB
#include <orcus/spreadsheet/import_interface.hpp>
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index b25bd77..6eb8600 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -122,7 +122,7 @@ IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScTabBgColorDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScTextImportOptionsDlg_Impl);
-IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl);
+IMPL_ABSTDLG_BASE(ScAbstractTabDialog_Impl);
// ScAbstractTabDialog_Impl begin
void ScAbstractTabDialog_Impl::SetCurPageId( sal_uInt16 nId )
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index 965dae7..28e39c3 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -12,7 +12,7 @@
#include "vcl/button.hxx"
#include "vcl/fixed.hxx"
-#include "svtools/svtreebx.hxx"
+#include "svtools/treelistbox.hxx"
#include "expftext.hxx"
#include "anyrefdg.hxx"
commit d2f3d3d7bba948647aba4a22dd2af561a162acb7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 12 11:45:59 2012 -0400
I forgot to remove these.
Change-Id: Id84d391b346c7044e3c3b5fd58b42365a8ebc79d
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index d5c650e..b25bd77 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -123,7 +123,6 @@ IMPL_ABSTDLG_BASE(AbstractScTabBgColorDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScTextImportOptionsDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl);
-IMPL_ABSTDLG_BASE(AbstractScXMLSourceDlg_Impl);
// ScAbstractTabDialog_Impl begin
void ScAbstractTabDialog_Impl::SetCurPageId( sal_uInt16 nId )
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 0bde100..391896c 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -64,7 +64,6 @@ class ScImportOptionsDlg;
class SfxTabDialog;
class ScTextImportOptionsDlg;
class ScCondFormatManagerDlg;
-class ScXMLSourceDlg;
#define DECL_ABSTDLG_BASE(Class,DialogClass) \
DialogClass* pDlg; \
commit 2cbaec879fcb5b0363a5a381a70024b8014bc956
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Oct 11 12:23:28 2012 -0400
Disable update while populating the tree control.
Change-Id: Ic0f5822072a817addc7d296eceadf59467e5ba0f
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 824eea9..31cd8ba 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -173,6 +173,8 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
return true;
}
+namespace {
+
void populateTree(
SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker,
const orcus::xml_structure_tree::entity_name& rElemName, bool bRepeat,
@@ -214,6 +216,23 @@ void populateTree(
}
}
+class TreeUpdateSwitch
+{
+ SvTreeListBox& mrTreeCtrl;
+public:
+ TreeUpdateSwitch(SvTreeListBox& rTreeCtrl) : mrTreeCtrl(rTreeCtrl)
+ {
+ mrTreeCtrl.SetUpdateMode(false);
+ }
+
+ ~TreeUpdateSwitch()
+ {
+ mrTreeCtrl.SetUpdateMode(true);
+ }
+};
+
+}
+
bool ScOrcusFiltersImpl::loadXMLStructure(
SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath,
const Image& rImgDefaultElem, const Image& rImgRepeatElem, const Image& rImgElemAttr) const
@@ -235,6 +254,7 @@ bool ScOrcusFiltersImpl::loadXMLStructure(
{
aXmlTree.parse(&aStrm[0], aStrm.size());
+ TreeUpdateSwitch aSwitch(rTreeCtrl);
rTreeCtrl.Clear();
rTreeCtrl.SetDefaultCollapsedEntryBmp(rImgDefaultElem);
rTreeCtrl.SetDefaultExpandedEntryBmp(rImgDefaultElem);
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index cc255b8..5f244f2 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -151,8 +151,8 @@ void ScXMLSourceDlg::SelectSourceFile()
if (!aFiles.getLength())
return;
- maSrcPath = aFiles[0];
// There should only be one file returned from the file picker.
+ maSrcPath = aFiles[0];
maFtSourceFile.SetText(maSrcPath);
LoadSourceFileStructure(maSrcPath);
commit 6082356a3aee42da25be290ca41940b04bee135a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Oct 11 01:22:21 2012 -0400
Use sensible directory path for file picker, handle tree item select.
Change-Id: I2638b1d870ee6b7e6c8697a38df07872184df8c6
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index c145f8b..965dae7 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -52,6 +52,8 @@ class ScXMLSourceDlg : public ScAnyRefDlg
rtl::OUString maStrCellLink;
rtl::OUString maStrRangeLink;
+ rtl::OUString maSrcPath;
+
ScDocument* mpDoc;
formula::RefEdit* mpActiveEdit;
@@ -74,10 +76,12 @@ private:
void LoadSourceFileStructure(const OUString& rPath);
void HandleGetFocus(Control* pCtrl);
void HandleLoseFocus(Control* pCtrl);
+ void TreeItemSelected();
DECL_LINK(GetFocusHdl, Control*);
DECL_LINK(LoseFocusHdl, Control*);
DECL_LINK(BtnPressedHdl, Button*);
+ DECL_LINK(TreeItemSelectHdl, void*);
};
#endif
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 3a07997..cc255b8 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -16,6 +16,9 @@
#include "filter.hxx"
#include "reffact.hxx"
+#include "unotools/pathoptions.hxx"
+#include "tools/urlobj.hxx"
+
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
@@ -60,6 +63,8 @@ ScXMLSourceDlg::ScXMLSourceDlg(
maEdit.SetLoseFocusHdl(aLink);
maBtnRb.SetLoseFocusHdl(aLink);
+ aLink = LINK(this, ScXMLSourceDlg, TreeItemSelectHdl);
+ maLbTree.SetSelectHdl(aLink);
maFtMappedCellTitle.SetText(maStrCellLink);
}
@@ -125,6 +130,19 @@ void ScXMLSourceDlg::SelectSourceFile()
if (!xFilePicker.is())
return;
+ if (maSrcPath.isEmpty())
+ // Use default path.
+ xFilePicker->setDisplayDirectory(SvtPathOptions().GetWorkPath());
+ else
+ {
+ // Use the directory of current source file.
+ INetURLObject aURL(maSrcPath);
+ aURL.removeSegment();
+ aURL.removeFinalSlash();
+ OUString aPath = aURL.GetMainURL(INetURLObject::NO_DECODE);
+ xFilePicker->setDisplayDirectory(aPath);
+ }
+
if (xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK)
// File picker dialog cancelled.
return;
@@ -133,10 +151,11 @@ void ScXMLSourceDlg::SelectSourceFile()
if (!aFiles.getLength())
return;
+ maSrcPath = aFiles[0];
// There should only be one file returned from the file picker.
- maFtSourceFile.SetText(aFiles[0]);
+ maFtSourceFile.SetText(maSrcPath);
- LoadSourceFileStructure(aFiles[0]);
+ LoadSourceFileStructure(maSrcPath);
}
void ScXMLSourceDlg::LoadSourceFileStructure(const OUString& rPath)
@@ -163,6 +182,14 @@ void ScXMLSourceDlg::HandleLoseFocus(Control* /*pCtrl*/)
{
}
+void ScXMLSourceDlg::TreeItemSelected()
+{
+ SvLBoxEntry* pEntry = maLbTree.GetCurEntry();
+ OUString aName = maLbTree.GetEntryText(pEntry);
+ fprintf(stdout, "ScXMLSourceDlg::TreeItemSelected: name = '%s'\n",
+ rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
+}
+
IMPL_LINK(ScXMLSourceDlg, GetFocusHdl, Control*, pCtrl)
{
HandleGetFocus(pCtrl);
@@ -182,4 +209,10 @@ IMPL_LINK(ScXMLSourceDlg, BtnPressedHdl, Button*, pBtn)
return 0;
}
+IMPL_LINK_NOARG(ScXMLSourceDlg, TreeItemSelectHdl)
+{
+ TreeItemSelected();
+ return 0;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 378be7e9646cc3e5eda5b40d3df40bc6775cb43a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Oct 11 00:20:46 2012 -0400
Get the reference edit box to work properly.
Change-Id: Ifd01fe05312c0ece867100019a9f84162e5778c4
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index ee8225c..c145f8b 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -54,7 +54,8 @@ class ScXMLSourceDlg : public ScAnyRefDlg
ScDocument* mpDoc;
- bool mbRefMode;
+ formula::RefEdit* mpActiveEdit;
+ bool mbDlgLostFocus;
public:
ScXMLSourceDlg(
@@ -63,6 +64,7 @@ public:
virtual sal_Bool IsRefInputMode() const;
virtual void SetReference(const ScRange& rRange, ScDocument* pDoc);
+ virtual void Deactivate();
virtual void SetActive();
virtual sal_Bool Close();
@@ -70,7 +72,11 @@ private:
void SelectSourceFile();
void LoadSourceFileStructure(const OUString& rPath);
+ void HandleGetFocus(Control* pCtrl);
+ void HandleLoseFocus(Control* pCtrl);
+ DECL_LINK(GetFocusHdl, Control*);
+ DECL_LINK(LoseFocusHdl, Control*);
DECL_LINK(BtnPressedHdl, Button*);
};
diff --git a/sc/source/ui/src/xmlsourcedlg.src b/sc/source/ui/src/xmlsourcedlg.src
index d4ef5ce..4119601 100644
--- a/sc/source/ui/src/xmlsourcedlg.src
+++ b/sc/source/ui/src/xmlsourcedlg.src
@@ -50,7 +50,7 @@ ModelessDialog RID_SCDLG_XML_SOURCE
FixedText FT_MAPPED_CELL_TITLE
{
- Pos = MAP_APPFONT( 12, 50 );
+ Pos = MAP_APPFONT( 12, 52 );
Size = MAP_APPFONT ( 100 , 8 ) ;
Text [ en-US ] = "";
@@ -59,15 +59,14 @@ ModelessDialog RID_SCDLG_XML_SOURCE
Edit ED_MAPPED_CELL
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 12 , 63 ) ;
+ Pos = MAP_APPFONT ( 12 , 66 ) ;
Size = MAP_APPFONT ( 69 , 12 ) ;
TabStop = TRUE ;
};
-
ImageButton BTN_MAPPED_CELL
{
- Pos = MAP_APPFONT ( 83 , 62 ) ;
+ Pos = MAP_APPFONT ( 83 , 65 ) ;
Size = MAP_APPFONT ( 13 , 15 ) ;
TabStop = FALSE ;
QuickHelpText [ en-US ] = "Shrink" ;
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 37e6c72..3a07997 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -34,8 +34,8 @@ ScXMLSourceDlg::ScXMLSourceDlg(
maFtSourceFile(this, ScResId(FT_SOURCE_FILE)),
maFtMapXmlDoc(this, ScResId(FL_MAP_XML_TO_DOCUMENT)),
maFtMappedCellTitle(this, ScResId(FT_MAPPED_CELL_TITLE)),
- maEdit(this, ScResId(ED_MAPPED_CELL)),
- maBtnRb(this, ScResId(BTN_MAPPED_CELL)),
+ maEdit(this, this, ScResId(ED_MAPPED_CELL)),
+ maBtnRb(this, ScResId(BTN_MAPPED_CELL), &maEdit, this),
maLbTree(this, ScResId(LB_SOURCE_TREE)),
maBtnCancel(this, ScResId(BTN_CANCEL)),
maImgFileOpen(ScResId(IMG_FILE_OPEN)),
@@ -45,13 +45,21 @@ ScXMLSourceDlg::ScXMLSourceDlg(
maStrCellLink(ScResId(STR_CELL_LINK).toString()),
maStrRangeLink(ScResId(STR_RANGE_LINK).toString()),
mpDoc(pDoc),
- mbRefMode(false)
+ mpActiveEdit(&maEdit),
+ mbDlgLostFocus(false)
{
maBtnSelectSource.SetModeImage(maImgFileOpen);
FreeResource();
maBtnSelectSource.SetClickHdl(LINK(this, ScXMLSourceDlg, BtnPressedHdl));
+ Link aLink = LINK(this, ScXMLSourceDlg, GetFocusHdl);
+ maEdit.SetGetFocusHdl(aLink);
+ maBtnRb.SetGetFocusHdl(aLink);
+ aLink = LINK(this, ScXMLSourceDlg, LoseFocusHdl);
+ maEdit.SetLoseFocusHdl(aLink);
+ maBtnRb.SetLoseFocusHdl(aLink);
+
maFtMappedCellTitle.SetText(maStrCellLink);
}
@@ -61,16 +69,43 @@ ScXMLSourceDlg::~ScXMLSourceDlg()
sal_Bool ScXMLSourceDlg::IsRefInputMode() const
{
- return mbRefMode;
+ return mpActiveEdit != NULL;
}
void ScXMLSourceDlg::SetReference(const ScRange& rRange, ScDocument* pDoc)
{
+ if (!mpActiveEdit)
+ return;
+
+ if (rRange.aStart != rRange.aEnd)
+ RefInputStart(mpActiveEdit);
+
+ OUString aStr;
+ rRange.aStart.Format(aStr, SCA_ABS_3D, pDoc, pDoc->GetAddressConvention());
+ mpActiveEdit->SetRefString(aStr);
+}
+
+void ScXMLSourceDlg::Deactivate()
+{
+ mbDlgLostFocus = true;
}
void ScXMLSourceDlg::SetActive()
{
- GrabFocus();
+ if (mbDlgLostFocus)
+ {
+ mbDlgLostFocus = false;
+ if (mpActiveEdit)
+ {
+ mpActiveEdit->GrabFocus();
+ }
+ }
+ else
+ {
+ GrabFocus();
+ }
+
+ RefInputDone();
}
sal_Bool ScXMLSourceDlg::Close()
@@ -114,6 +149,32 @@ void ScXMLSourceDlg::LoadSourceFileStructure(const OUString& rPath)
maLbTree, rPath, maImgElemDefault, maImgElemRepeat, maImgElemAttribute);
}
+void ScXMLSourceDlg::HandleGetFocus(Control* pCtrl)
+{
+ mpActiveEdit = NULL;
+ if (pCtrl == &maEdit || pCtrl == &maBtnRb)
+ mpActiveEdit = &maEdit;
+
+ if (mpActiveEdit)
+ mpActiveEdit->SetSelection(Selection(0, SELECTION_MAX));
+}
+
+void ScXMLSourceDlg::HandleLoseFocus(Control* /*pCtrl*/)
+{
+}
+
+IMPL_LINK(ScXMLSourceDlg, GetFocusHdl, Control*, pCtrl)
+{
+ HandleGetFocus(pCtrl);
+ return 0;
+}
+
+IMPL_LINK(ScXMLSourceDlg, LoseFocusHdl, Control*, pCtrl)
+{
+ HandleLoseFocus(pCtrl);
+ return 0;
+}
+
IMPL_LINK(ScXMLSourceDlg, BtnPressedHdl, Button*, pBtn)
{
if (pBtn == &maBtnSelectSource)
commit 7989f32ce4e133ec13c1cbdd21b618f5a12ef8f5
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Oct 10 20:45:55 2012 -0400
Turned the xml source dialog into a reference dialog.
Change-Id: Ifb3ebd3c0166343f42dd53bcee83c6b31c84f081
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 4ac291e..641dde1 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -571,6 +571,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/view/viewfunc \
sc/source/ui/view/viewutil \
sc/source/ui/view/waitoff \
+ sc/source/ui/xmlsource/xmlsourcedlg \
))
$(eval $(call gb_SdiTarget_SdiTarget,sc/sdi/scslots,sc/sdi/scalc))
diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk
index 819b907..b1eb772 100644
--- a/sc/Library_scui.mk
+++ b/sc/Library_scui.mk
@@ -114,7 +114,6 @@ $(eval $(call gb_Library_add_exception_objects,scui,\
sc/source/ui/pagedlg/tphf \
sc/source/ui/pagedlg/tptable \
sc/source/ui/styleui/styledlg \
- sc/source/ui/xmlsource/xmlsourcedlg \
))
ifeq ($(OS),WNT)
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index bd4f09f..ea5e692 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -326,11 +326,6 @@ public:
virtual bool IsDateConversionSet() const = 0;
};
-class AbstractScXMLSourceDlg : public VclAbstractDialog
-{
-public:
-};
-
//-------Scabstract fractory ---------------------------
class ScAbstractDialogFactory
{
@@ -524,8 +519,6 @@ public:
virtual SfxAbstractTabDialog * CreateScSortDlg( Window* pParent, //add for ScSortDlg
const SfxItemSet* pArgSet,int nId ) = 0;
- virtual AbstractScXMLSourceDlg* CreateScXMLSourceDlg(Window* pParent, ScDocument* pDoc, int nId) = 0;
-
// for tabpage
virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) = 0;
virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId ) = 0;
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 6d56712..9c06371 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -257,6 +257,7 @@ void ScDLL::Init()
sal::static_int_cast<sal_uInt16>(ScTabViewShell::GetInterfaceId()), pMod);
ScSolverDlgWrapper ::RegisterChildWindow(false, pMod);
ScOptSolverDlgWrapper ::RegisterChildWindow(false, pMod);
+ ScXMLSourceDlgWrapper ::RegisterChildWindow(false, pMod);
ScNameDlgWrapper ::RegisterChildWindow(false, pMod);
ScNameDefDlgWrapper ::RegisterChildWindow(false, pMod);
ScCondFormatConditionDlgWrapper ::RegisterChildWindow(false, pMod);
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 2e8a536..d5c650e 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -122,9 +122,8 @@ IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScTabBgColorDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScTextImportOptionsDlg_Impl);
-IMPL_ABSTDLG_BASE(ScAbstractTabDialog_Impl);
-IMPL_ABSTDLG_BASE(AbstractScXMLSourceDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractScXMLSourceDlg_Impl);
// ScAbstractTabDialog_Impl begin
void ScAbstractTabDialog_Impl::SetCurPageId( sal_uInt16 nId )
@@ -1559,13 +1558,6 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScSortDlg( Window*
return 0;
}
-AbstractScXMLSourceDlg* ScAbstractDialogFactory_Impl::CreateScXMLSourceDlg(Window* pParent, ScDocument* pDoc, int nId)
-{
- ScXMLSourceDlg* pDlg = (nId == RID_SCDLG_XML_SOURCE) ? new ScXMLSourceDlg(pParent, pDoc) : NULL;
-
- return pDlg ? new AbstractScXMLSourceDlg_Impl(pDlg) : NULL;
-}
-
#undef SfxTabDialog
#undef ScAbstractTabDialog_Impl
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index b0763ac..0bde100 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -378,11 +378,6 @@ class AbstractScTextImportOptionsDlg_Impl : public AbstractScTextImportOptionsDl
virtual bool IsDateConversionSet() const;
};
-class AbstractScXMLSourceDlg_Impl : public AbstractScXMLSourceDlg
-{
- DECL_ABSTDLG_BASE(AbstractScXMLSourceDlg_Impl, ScXMLSourceDlg)
-};
-
//add for ScAttrDlg , ScHFEditDlg, ScStyleDlg, ScSubTotalDlg, ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
class ScAbstractTabDialog_Impl : public SfxAbstractTabDialog
{
@@ -593,8 +588,6 @@ public:
virtual SfxAbstractTabDialog * CreateScSortDlg( Window* pParent, //add for ScSortDlg
const SfxItemSet* pArgSet,int nId );
- virtual AbstractScXMLSourceDlg* CreateScXMLSourceDlg(Window* pParent, ScDocument* pDoc, int nId);
-
// For TabPage
virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId );
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index e906e8c..447383b 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -50,6 +50,7 @@ DECL_WRAPPER_WITHID(ScCondFormatColorScaleDlgWrapper)
DECL_WRAPPER_WITHID(ScCondFormatDataBarDlgWrapper)
DECL_WRAPPER_WITHID(ScSolverDlgWrapper)
DECL_WRAPPER_WITHID(ScOptSolverDlgWrapper)
+DECL_WRAPPER_WITHID(ScXMLSourceDlgWrapper)
DECL_WRAPPER_WITHID(ScPivotLayoutWrapper)
DECL_WRAPPER_WITHID(ScTabOpDlgWrapper)
DECL_WRAPPER_WITHID(ScFilterDlgWrapper)
diff --git a/sc/source/ui/inc/xmlsourcedlg.hrc b/sc/source/ui/inc/xmlsourcedlg.hrc
index ec10aff..67cf9b8 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hrc
+++ b/sc/source/ui/inc/xmlsourcedlg.hrc
@@ -17,11 +17,17 @@
#define FT_SOURCE_FILE 12
#define FL_MAP_XML_TO_DOCUMENT 20
-#define LB_SOURCE_TREE 21
+#define FT_MAPPED_CELL_TITLE 21
+#define ED_MAPPED_CELL 22
+#define BTN_MAPPED_CELL 23
+#define LB_SOURCE_TREE 24
#define IMG_ELEMENT_DEFAULT 50
#define IMG_ELEMENT_REPEAT 51
#define IMG_ELEMENT_ATTRIBUTE 52
#define IMG_FILE_OPEN 53
+#define STR_CELL_LINK 70
+#define STR_RANGE_LINK 71
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index 39bfa6b..ee8225c 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -11,15 +11,16 @@
#define __SC_XMLSOURCEDLG_HXX__
#include "vcl/button.hxx"
-#include "vcl/dialog.hxx"
#include "vcl/fixed.hxx"
#include "svtools/svtreebx.hxx"
#include "expftext.hxx"
+#include "anyrefdg.hxx"
#include <boost/scoped_ptr.hpp>
class ScDocument;
+class ScRange;
class ScXMLSourceTree : public SvTreeListBox
{
@@ -27,7 +28,7 @@ public:
ScXMLSourceTree(Window* pParent, const ResId& rResId);
};
-class ScXMLSourceDlg : public ModalDialog
+class ScXMLSourceDlg : public ScAnyRefDlg
{
FixedLine maFlSourceFile;
ImageButton maBtnSelectSource;
@@ -35,6 +36,10 @@ class ScXMLSourceDlg : public ModalDialog
FixedLine maFtMapXmlDoc;
+ FixedText maFtMappedCellTitle;
+ formula::RefEdit maEdit;
+ formula::RefButton maBtnRb;
+
ScXMLSourceTree maLbTree;
CancelButton maBtnCancel;
@@ -44,12 +49,23 @@ class ScXMLSourceDlg : public ModalDialog
Image maImgElemRepeat;
Image maImgElemAttribute;
+ rtl::OUString maStrCellLink;
+ rtl::OUString maStrRangeLink;
+
ScDocument* mpDoc;
+ bool mbRefMode;
+
public:
- ScXMLSourceDlg(Window* pParent, ScDocument* pDoc);
+ ScXMLSourceDlg(
+ SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, ScDocument* pDoc);
virtual ~ScXMLSourceDlg();
+ virtual sal_Bool IsRefInputMode() const;
+ virtual void SetReference(const ScRange& rRange, ScDocument* pDoc);
+ virtual void SetActive();
+ virtual sal_Bool Close();
+
private:
void SelectSourceFile();
diff --git a/sc/source/ui/src/xmlsourcedlg.src b/sc/source/ui/src/xmlsourcedlg.src
index 8a7b13a..d4ef5ce 100644
--- a/sc/source/ui/src/xmlsourcedlg.src
+++ b/sc/source/ui/src/xmlsourcedlg.src
@@ -8,7 +8,7 @@
#include "xmlsourcedlg.hrc"
-ModalDialog RID_SCDLG_XML_SOURCE
+ModelessDialog RID_SCDLG_XML_SOURCE
{
HelpID = "sc:ModalDialog:RID_SCDLG_XML_SOURCE";
Text [ en-US ] = "XML Source" ;
@@ -48,6 +48,31 @@ ModalDialog RID_SCDLG_XML_SOURCE
Text [ en-US ] = "Map to document";
};
+ FixedText FT_MAPPED_CELL_TITLE
+ {
+ Pos = MAP_APPFONT( 12, 50 );
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+
+ Text [ en-US ] = "";
+ };
+
+ Edit ED_MAPPED_CELL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 63 ) ;
+ Size = MAP_APPFONT ( 69 , 12 ) ;
+ TabStop = TRUE ;
+ };
+
+
+ ImageButton BTN_MAPPED_CELL
+ {
+ Pos = MAP_APPFONT ( 83 , 62 ) ;
+ Size = MAP_APPFONT ( 13 , 15 ) ;
+ TabStop = FALSE ;
+ QuickHelpText [ en-US ] = "Shrink" ;
+ };
+
Control LB_SOURCE_TREE
{
Border = TRUE ;
@@ -85,5 +110,15 @@ ModalDialog RID_SCDLG_XML_SOURCE
Pos = MAP_APPFONT ( 194 , 181 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
+
+ String STR_CELL_LINK
+ {
+ Text [ en-US ] = "Link to cell";
+ };
+
+ String STR_RANGE_LINK
+ {
+ Text [ en-US ] = "Link to range";
+ };
};
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index addfd75..426e803 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2403,14 +2403,12 @@ void ScCellShell::ExecuteXMLSourceDialog()
if (!pTabViewShell)
return;
- boost::scoped_ptr<AbstractScXMLSourceDlg> pDlg(
- pFact->CreateScXMLSourceDlg(
- pTabViewShell->GetDialogParent(), GetViewData()->GetDocument(), RID_SCDLG_XML_SOURCE));
-
- if (!pDlg)
- return;
+ ScModule* pScMod = SC_MOD();
- pDlg->Execute();
+ sal_uInt16 nId = ScXMLSourceDlgWrapper::GetChildWindowId();
+ SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
+ SfxChildWindow* pWnd = pViewFrame->GetChildWindow(nId);
+ pScMod->SetRefDialog(nId, pWnd ? false : true);
}
void ScCellShell::ExecuteSubtotals(SfxRequest& rReq)
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index dfc2b1d..052fcaf 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -49,6 +49,7 @@ SFX_IMPL_MODELESSDIALOG_WITHID(ScCondFormatColorScaleDlgWrapper, SID_OPENDLG_COL
SFX_IMPL_MODELESSDIALOG_WITHID(ScCondFormatDataBarDlgWrapper, SID_OPENDLG_DATABAR )
SFX_IMPL_MODELESSDIALOG_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
SFX_IMPL_MODELESSDIALOG_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
+SFX_IMPL_MODELESSDIALOG_WITHID(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
SFX_IMPL_MODELESSDIALOG_WITHID(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
SFX_IMPL_MODELESSDIALOG_WITHID(ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
SFX_IMPL_MODELESSDIALOG_WITHID(ScFilterDlgWrapper, SID_FILTER )
@@ -62,6 +63,7 @@ SFX_IMPL_MODELESSDIALOG_WITHID(ScAcceptChgDlgWrapper, FID_CHG_ACCEPT )
SFX_IMPL_MODELESSDIALOG_WITHID(ScHighlightChgDlgWrapper, FID_CHG_SHOW )
SFX_IMPL_MODELESSDIALOG_WITHID(ScSimpleRefDlgWrapper, WID_SIMPLE_REF )
SFX_IMPL_CHILDWINDOW_WITHID(ScValidityRefChildWin, SID_VALIDITY_REFERENCE)
+
SfxChildWinInfo ScValidityRefChildWin::GetInfo() const
{
SfxChildWinInfo anInfo = SfxChildWindow::GetInfo();
@@ -148,6 +150,8 @@ IMPL_CHILD_CTOR( ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
IMPL_CHILD_CTOR( ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
+IMPL_CHILD_CTOR(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
+
//-------------------------------------------------------------------------
// ScPivotLayoutWrapper
//-------------------------------------------------------------------------
diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx
index 06f6dd4..75f3836 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -70,6 +70,7 @@ SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL))
SFX_CHILDWINDOW_REGISTRATION(ScCondFormatDataBarDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScSolverDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScOptSolverDlgWrapper::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(ScXMLSourceDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScPivotLayoutWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScTabOpDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScFilterDlgWrapper::GetChildWindowId());
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index bb9aa7b..152a940 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -64,6 +64,7 @@
#include "markdata.hxx"
#include "reffact.hxx"
#include "condformatdlg.hxx"
+#include "xmlsourcedlg.hxx"
//------------------------------------------------------------------
@@ -406,6 +407,12 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
}
break;
+ case SID_MANAGE_XML_SOURCE:
+ {
+ pResult = new ScXMLSourceDlg(pB, pCW, pParent, pDoc);
+ }
+ break;
+
case FID_CHG_SHOW:
{
// Dialog schaut selber, was in der Zelle steht
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 2a94a9b..37e6c72 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -14,6 +14,7 @@
#include "document.hxx"
#include "orcusfilters.hxx"
#include "filter.hxx"
+#include "reffact.hxx"
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
@@ -25,30 +26,58 @@ using namespace com::sun::star;
ScXMLSourceTree::ScXMLSourceTree(Window* pParent, const ResId& rResId) :
SvTreeListBox(pParent, rResId) {}
-ScXMLSourceDlg::ScXMLSourceDlg(Window* pParent, ScDocument* pDoc) :
- ModalDialog(pParent, ScResId(RID_SCDLG_XML_SOURCE)),
+ScXMLSourceDlg::ScXMLSourceDlg(
+ SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, ScDocument* pDoc) :
+ ScAnyRefDlg(pB, pCW, pParent, RID_SCDLG_XML_SOURCE),
maFlSourceFile(this, ScResId(FL_SOURCE_FILE)),
maBtnSelectSource(this, ScResId(BTN_SELECT_SOURCE_FILE)),
maFtSourceFile(this, ScResId(FT_SOURCE_FILE)),
maFtMapXmlDoc(this, ScResId(FL_MAP_XML_TO_DOCUMENT)),
+ maFtMappedCellTitle(this, ScResId(FT_MAPPED_CELL_TITLE)),
+ maEdit(this, ScResId(ED_MAPPED_CELL)),
+ maBtnRb(this, ScResId(BTN_MAPPED_CELL)),
maLbTree(this, ScResId(LB_SOURCE_TREE)),
maBtnCancel(this, ScResId(BTN_CANCEL)),
maImgFileOpen(ScResId(IMG_FILE_OPEN)),
maImgElemDefault(ScResId(IMG_ELEMENT_DEFAULT)),
maImgElemRepeat(ScResId(IMG_ELEMENT_REPEAT)),
maImgElemAttribute(ScResId(IMG_ELEMENT_ATTRIBUTE)),
- mpDoc(pDoc)
+ maStrCellLink(ScResId(STR_CELL_LINK).toString()),
+ maStrRangeLink(ScResId(STR_RANGE_LINK).toString()),
+ mpDoc(pDoc),
+ mbRefMode(false)
{
maBtnSelectSource.SetModeImage(maImgFileOpen);
FreeResource();
maBtnSelectSource.SetClickHdl(LINK(this, ScXMLSourceDlg, BtnPressedHdl));
+
+ maFtMappedCellTitle.SetText(maStrCellLink);
}
ScXMLSourceDlg::~ScXMLSourceDlg()
{
}
+sal_Bool ScXMLSourceDlg::IsRefInputMode() const
+{
+ return mbRefMode;
+}
+
+void ScXMLSourceDlg::SetReference(const ScRange& rRange, ScDocument* pDoc)
+{
+}
+
+void ScXMLSourceDlg::SetActive()
+{
+ GrabFocus();
+}
+
+sal_Bool ScXMLSourceDlg::Close()
+{
+ return DoClose(ScXMLSourceDlgWrapper::GetChildWindowId());
+}
+
void ScXMLSourceDlg::SelectSourceFile()
{
uno::Reference<lang::XMultiServiceFactory> xServiceMgr = mpDoc->GetServiceManager();
commit 6c9c7f5bf1096a5a154125ee913abc3a2f90ed62
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 5 17:48:48 2012 -0400
Use different icon image for the attribute entries.
Change-Id: Icd053ba7906191f3bc937cdb3c76d037fd67dab5
diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index 2ec5a49..7db7034 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -28,7 +28,7 @@ public:
virtual bool loadXMLStructure(
SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath,
- const Image& rImgDefaultElem, const Image& rImgRepeatElem) const = 0;
+ const Image& rImgDefaultElem, const Image& rImgRepeatElem, const Image& rImgElemAttr) const = 0;
};
#endif
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
index 311b6e0..2f42d0b 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -19,7 +19,7 @@ public:
virtual bool loadXMLStructure(
SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath,
- const Image& rImgDefaultElem, const Image& rImgRepeatElem) const;
+ const Image& rImgDefaultElem, const Image& rImgRepeatElem, const Image& rImgElemAttr) const;
};
#endif
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 4635175..824eea9 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -175,7 +175,9 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
void populateTree(
SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker,
- const orcus::xml_structure_tree::entity_name& rElemName, bool bRepeat, const Image& rImgRepeatElem, SvLBoxEntry* pParent)
+ const orcus::xml_structure_tree::entity_name& rElemName, bool bRepeat,
+ const Image& rImgRepeatElem, const Image& rImgElemAttr,
+ SvLBoxEntry* pParent)
{
OUString aName(rElemName.name.get(), rElemName.name.size(), RTL_TEXTENCODING_UTF8);
SvLBoxEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent);
@@ -196,7 +198,9 @@ void populateTree(
for (; it != itEnd; ++it)
{
orcus::xml_structure_tree::entity_name aAttrName = *it;
- rTreeCtrl.InsertEntry(OUString(aAttrName.name.get(), aAttrName.name.size(), RTL_TEXTENCODING_UTF8), pEntry);
+ SvLBoxEntry* pAttr = rTreeCtrl.InsertEntry(OUString(aAttrName.name.get(), aAttrName.name.size(), RTL_TEXTENCODING_UTF8), pEntry);
+ rTreeCtrl.SetExpandedEntryBmp(pAttr, rImgElemAttr);
+ rTreeCtrl.SetCollapsedEntryBmp(pAttr, rImgElemAttr);
}
rTreeCtrl.Expand(pEntry);
@@ -205,13 +209,14 @@ void populateTree(
for (it = aNames.begin(), itEnd = aNames.end(); it != itEnd; ++it)
{
orcus::xml_structure_tree::element aElem = rWalker.descend(*it);
- populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, rImgRepeatElem, pEntry);
+ populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, rImgRepeatElem, rImgElemAttr, pEntry);
rWalker.ascend();
}
}
bool ScOrcusFiltersImpl::loadXMLStructure(
- SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, const Image& rImgDefaultElem, const Image& rImgRepeatElem) const
+ SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath,
+ const Image& rImgDefaultElem, const Image& rImgRepeatElem, const Image& rImgElemAttr) const
{
INetURLObject aURL(rPath);
OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8);
@@ -238,7 +243,7 @@ bool ScOrcusFiltersImpl::loadXMLStructure(
// Root element.
orcus::xml_structure_tree::element aElem = aWalker.root();
- populateTree(rTreeCtrl, aWalker, aElem.name, aElem.repeat, rImgRepeatElem, NULL);
+ populateTree(rTreeCtrl, aWalker, aElem.name, aElem.repeat, rImgRepeatElem, rImgElemAttr, NULL);
}
catch (const std::exception&)
{
diff --git a/sc/source/ui/inc/xmlsourcedlg.hrc b/sc/source/ui/inc/xmlsourcedlg.hrc
index 24c40b1..ec10aff 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hrc
+++ b/sc/source/ui/inc/xmlsourcedlg.hrc
@@ -21,6 +21,7 @@
#define IMG_ELEMENT_DEFAULT 50
#define IMG_ELEMENT_REPEAT 51
-#define IMG_FILE_OPEN 52
+#define IMG_ELEMENT_ATTRIBUTE 52
+#define IMG_FILE_OPEN 53
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index b6fb2ba..39bfa6b 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -42,6 +42,7 @@ class ScXMLSourceDlg : public ModalDialog
Image maImgFileOpen;
Image maImgElemDefault;
Image maImgElemRepeat;
+ Image maImgElemAttribute;
ScDocument* mpDoc;
diff --git a/sc/source/ui/src/xmlsourcedlg.src b/sc/source/ui/src/xmlsourcedlg.src
index 564b9d1..8a7b13a 100644
--- a/sc/source/ui/src/xmlsourcedlg.src
+++ b/sc/source/ui/src/xmlsourcedlg.src
@@ -68,6 +68,12 @@ ModalDialog RID_SCDLG_XML_SOURCE
MaskColor = STD_MASKCOLOR ;
};
+ Image IMG_ELEMENT_ATTRIBUTE
+ {
+ ImageBitmap = Bitmap { File = "time.png" ; };
+ MaskColor = STD_MASKCOLOR ;
+ };
+
Image IMG_FILE_OPEN
{
ImageBitmap = Bitmap { File = "file.png" ; };
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 7f0a48b..2a94a9b 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -36,6 +36,7 @@ ScXMLSourceDlg::ScXMLSourceDlg(Window* pParent, ScDocument* pDoc) :
maImgFileOpen(ScResId(IMG_FILE_OPEN)),
maImgElemDefault(ScResId(IMG_ELEMENT_DEFAULT)),
maImgElemRepeat(ScResId(IMG_ELEMENT_REPEAT)),
+ maImgElemAttribute(ScResId(IMG_ELEMENT_ATTRIBUTE)),
mpDoc(pDoc)
{
maBtnSelectSource.SetModeImage(maImgFileOpen);
@@ -80,7 +81,8 @@ void ScXMLSourceDlg::LoadSourceFileStructure(const OUString& rPath)
if (!pOrcus)
return;
- pOrcus->loadXMLStructure(maLbTree, rPath, maImgElemDefault, maImgElemRepeat);
+ pOrcus->loadXMLStructure(
+ maLbTree, rPath, maImgElemDefault, maImgElemRepeat, maImgElemAttribute);
}
IMPL_LINK(ScXMLSourceDlg, BtnPressedHdl, Button*, pBtn)
commit f1c158edcf3b9df2587185ac55812b99e0587d43
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Oct 5 17:41:33 2012 -0400
Add detected attributes to the tree too.
Change-Id: I6d4b757f599ac8d33be3775ee55eaef61d89871a
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 8453043..4635175 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -175,10 +175,8 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
void populateTree(
SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker,
- const orcus::xml_structure_tree::element_name& rElemName, bool bRepeat, const Image& rImgRepeatElem, SvLBoxEntry* pParent)
+ const orcus::xml_structure_tree::entity_name& rElemName, bool bRepeat, const Image& rImgRepeatElem, SvLBoxEntry* pParent)
{
- // TODO: Make use of bRepeat flag.
-
OUString aName(rElemName.name.get(), rElemName.name.size(), RTL_TEXTENCODING_UTF8);
SvLBoxEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent);
if (bRepeat)
@@ -190,13 +188,22 @@ void populateTree(
if (pParent)
rTreeCtrl.Expand(pParent);
- orcus::xml_structure_tree::element_names_type aChildElements;
- rWalker.get_children(aChildElements);
+ orcus::xml_structure_tree::entity_names_type aNames;
- orcus::xml_structure_tree::element_names_type::const_iterator it = aChildElements.begin();
- orcus::xml_structure_tree::element_names_type::const_iterator itEnd = aChildElements.end();
+ rWalker.get_attributes(aNames);
+ orcus::xml_structure_tree::entity_names_type::const_iterator it = aNames.begin();
+ orcus::xml_structure_tree::entity_names_type::const_iterator itEnd = aNames.end();
for (; it != itEnd; ++it)
{
+ orcus::xml_structure_tree::entity_name aAttrName = *it;
+ rTreeCtrl.InsertEntry(OUString(aAttrName.name.get(), aAttrName.name.size(), RTL_TEXTENCODING_UTF8), pEntry);
+ }
+ rTreeCtrl.Expand(pEntry);
+
+ rWalker.get_children(aNames);
+
+ for (it = aNames.begin(), itEnd = aNames.end(); it != itEnd; ++it)
+ {
orcus::xml_structure_tree::element aElem = rWalker.descend(*it);
populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, rImgRepeatElem, pEntry);
rWalker.ascend();
commit 9da5553602c97bb3c371d6000abb46e59a1769c7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Oct 3 10:33:09 2012 -0400
Use different icon for recurring elements.
Change-Id: I3869e4a1f2f4b68d57641395daaf79d911a1a891
diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index 2379c67..2ec5a49 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -14,6 +14,7 @@
class ScDocument;
class SvTreeListBox;
+class Image;
/**
* Collection of orcus filter wrappers.
@@ -25,7 +26,9 @@ public:
virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const = 0;
- virtual bool loadXMLStructure(const rtl::OUString& rPath, SvTreeListBox& rTree) const = 0;
+ virtual bool loadXMLStructure(
+ SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath,
+ const Image& rImgDefaultElem, const Image& rImgRepeatElem) const = 0;
};
#endif
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
index f51f00f..311b6e0 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -17,7 +17,9 @@ class ScOrcusFiltersImpl : public ScOrcusFilters
public:
virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const;
- virtual bool loadXMLStructure(const rtl::OUString& rPath, SvTreeListBox& rTree) const;
+ virtual bool loadXMLStructure(
+ SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath,
+ const Image& rImgDefaultElem, const Image& rImgRepeatElem) const;
};
#endif
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 721e5ee..8453043 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -175,12 +175,18 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
void populateTree(
SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker,
- const orcus::xml_structure_tree::element_name& rElemName, bool bRepeat, SvLBoxEntry* pParent)
+ const orcus::xml_structure_tree::element_name& rElemName, bool bRepeat, const Image& rImgRepeatElem, SvLBoxEntry* pParent)
{
// TODO: Make use of bRepeat flag.
OUString aName(rElemName.name.get(), rElemName.name.size(), RTL_TEXTENCODING_UTF8);
SvLBoxEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent);
+ if (bRepeat)
+ {
+ rTreeCtrl.SetExpandedEntryBmp(pEntry, rImgRepeatElem);
+ rTreeCtrl.SetCollapsedEntryBmp(pEntry, rImgRepeatElem);
+ }
+
if (pParent)
rTreeCtrl.Expand(pParent);
@@ -192,12 +198,13 @@ void populateTree(
for (; it != itEnd; ++it)
{
orcus::xml_structure_tree::element aElem = rWalker.descend(*it);
- populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, pEntry);
+ populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, rImgRepeatElem, pEntry);
rWalker.ascend();
}
}
-bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox& rTreeCtrl) const
+bool ScOrcusFiltersImpl::loadXMLStructure(
+ SvTreeListBox& rTreeCtrl, const rtl::OUString& rPath, const Image& rImgDefaultElem, const Image& rImgRepeatElem) const
{
INetURLObject aURL(rPath);
OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8);
@@ -217,12 +224,14 @@ bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox&
aXmlTree.parse(&aStrm[0], aStrm.size());
rTreeCtrl.Clear();
+ rTreeCtrl.SetDefaultCollapsedEntryBmp(rImgDefaultElem);
+ rTreeCtrl.SetDefaultExpandedEntryBmp(rImgDefaultElem);
orcus::xml_structure_tree::walker aWalker = aXmlTree.get_walker();
// Root element.
orcus::xml_structure_tree::element aElem = aWalker.root();
- populateTree(rTreeCtrl, aWalker, aElem.name, aElem.repeat, NULL);
+ populateTree(rTreeCtrl, aWalker, aElem.name, aElem.repeat, rImgRepeatElem, NULL);
}
catch (const std::exception&)
{
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index 6e32d12..b6fb2ba 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -23,8 +23,6 @@ class ScDocument;
class ScXMLSourceTree : public SvTreeListBox
{
- Image maImgElemDefault;
- Image maImgElemRepeat;
public:
ScXMLSourceTree(Window* pParent, const ResId& rResId);
};
@@ -42,6 +40,8 @@ class ScXMLSourceDlg : public ModalDialog
CancelButton maBtnCancel;
Image maImgFileOpen;
+ Image maImgElemDefault;
+ Image maImgElemRepeat;
ScDocument* mpDoc;
diff --git a/sc/source/ui/src/xmlsourcedlg.src b/sc/source/ui/src/xmlsourcedlg.src
index f55110b..564b9d1 100644
--- a/sc/source/ui/src/xmlsourcedlg.src
+++ b/sc/source/ui/src/xmlsourcedlg.src
@@ -62,6 +62,12 @@ ModalDialog RID_SCDLG_XML_SOURCE
MaskColor = STD_MASKCOLOR ;
};
+ Image IMG_ELEMENT_REPEAT
+ {
+ ImageBitmap = Bitmap { File = "pages.png" ; };
+ MaskColor = STD_MASKCOLOR ;
+ };
+
Image IMG_FILE_OPEN
{
ImageBitmap = Bitmap { File = "file.png" ; };
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 39ccbe5..7f0a48b 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -23,13 +23,7 @@ using namespace com::sun::star;
ScXMLSourceTree::ScXMLSourceTree(Window* pParent, const ResId& rResId) :
- SvTreeListBox(pParent, rResId),
- maImgElemDefault(ScResId(IMG_ELEMENT_DEFAULT)),
- maImgElemRepeat(ScResId(IMG_ELEMENT_REPEAT))
-{
- SetDefaultExpandedEntryBmp(maImgElemDefault);
- SetDefaultCollapsedEntryBmp(maImgElemDefault);
-}
+ SvTreeListBox(pParent, rResId) {}
ScXMLSourceDlg::ScXMLSourceDlg(Window* pParent, ScDocument* pDoc) :
ModalDialog(pParent, ScResId(RID_SCDLG_XML_SOURCE)),
@@ -40,6 +34,8 @@ ScXMLSourceDlg::ScXMLSourceDlg(Window* pParent, ScDocument* pDoc) :
maLbTree(this, ScResId(LB_SOURCE_TREE)),
maBtnCancel(this, ScResId(BTN_CANCEL)),
maImgFileOpen(ScResId(IMG_FILE_OPEN)),
+ maImgElemDefault(ScResId(IMG_ELEMENT_DEFAULT)),
+ maImgElemRepeat(ScResId(IMG_ELEMENT_REPEAT)),
mpDoc(pDoc)
{
maBtnSelectSource.SetModeImage(maImgFileOpen);
@@ -84,7 +80,7 @@ void ScXMLSourceDlg::LoadSourceFileStructure(const OUString& rPath)
if (!pOrcus)
return;
- pOrcus->loadXMLStructure(rPath, maLbTree);
+ pOrcus->loadXMLStructure(maLbTree, rPath, maImgElemDefault, maImgElemRepeat);
}
IMPL_LINK(ScXMLSourceDlg, BtnPressedHdl, Button*, pBtn)
commit 8e091f18136f1a995c6b69569e7506d6a7c16b9d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Oct 3 10:00:36 2012 -0400
Pass the 'repeat' flag of each element too, for recurring elements.
Change-Id: I2d5ad0724b45d448b18a04ec58f5f06c7aa86e2b
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index b07647b..721e5ee 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -175,8 +175,10 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
void populateTree(
SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker,
- const orcus::xml_structure_tree::element_name& rElemName, SvLBoxEntry* pParent)
+ const orcus::xml_structure_tree::element_name& rElemName, bool bRepeat, SvLBoxEntry* pParent)
{
+ // TODO: Make use of bRepeat flag.
+
OUString aName(rElemName.name.get(), rElemName.name.size(), RTL_TEXTENCODING_UTF8);
SvLBoxEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent);
if (pParent)
@@ -189,8 +191,8 @@ void populateTree(
orcus::xml_structure_tree::element_names_type::const_iterator itEnd = aChildElements.end();
for (; it != itEnd; ++it)
{
- rWalker.descend(*it);
- populateTree(rTreeCtrl, rWalker, *it, pEntry);
+ orcus::xml_structure_tree::element aElem = rWalker.descend(*it);
+ populateTree(rTreeCtrl, rWalker, *it, aElem.repeat, pEntry);
rWalker.ascend();
}
}
@@ -220,7 +222,7 @@ bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox&
// Root element.
orcus::xml_structure_tree::element aElem = aWalker.root();
- populateTree(rTreeCtrl, aWalker, aElem.name, NULL);
+ populateTree(rTreeCtrl, aWalker, aElem.name, aElem.repeat, NULL);
}
catch (const std::exception&)
{
commit 4f3ea4869dc2f7605a46d2bd879ec750debab78d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Oct 3 09:51:52 2012 -0400
A little cleanup.
Change-Id: I04ac6b95fec116f13507f8f012320d522120fef3
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 0afaee4..b07647b 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -173,12 +173,14 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
return true;
}
-void populateTree(SvTreeListBox& rTree, orcus::xml_structure_tree::walker& rWalker, const orcus::xml_structure_tree::element_name& rElemName, SvLBoxEntry* pParent)
+void populateTree(
+ SvTreeListBox& rTreeCtrl, orcus::xml_structure_tree::walker& rWalker,
+ const orcus::xml_structure_tree::element_name& rElemName, SvLBoxEntry* pParent)
{
OUString aName(rElemName.name.get(), rElemName.name.size(), RTL_TEXTENCODING_UTF8);
- SvLBoxEntry* pEntry = rTree.InsertEntry(aName, pParent);
+ SvLBoxEntry* pEntry = rTreeCtrl.InsertEntry(aName, pParent);
if (pParent)
- rTree.Expand(pParent);
+ rTreeCtrl.Expand(pParent);
orcus::xml_structure_tree::element_names_type aChildElements;
rWalker.get_children(aChildElements);
@@ -188,12 +190,12 @@ void populateTree(SvTreeListBox& rTree, orcus::xml_structure_tree::walker& rWalk
for (; it != itEnd; ++it)
{
rWalker.descend(*it);
- populateTree(rTree, rWalker, *it, pEntry);
+ populateTree(rTreeCtrl, rWalker, *it, pEntry);
rWalker.ascend();
}
}
-bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox& rTree) const
+bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox& rTreeCtrl) const
{
INetURLObject aURL(rPath);
OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8);
@@ -207,10 +209,18 @@ bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox&
return false;
orcus::xmlns_repository aNsRepo; // xml namespace repository.
- orcus::xml_structure_tree aTree(aNsRepo);
+ orcus::xml_structure_tree aXmlTree(aNsRepo);
try
{
- aTree.parse(&aStrm[0], aStrm.size());
+ aXmlTree.parse(&aStrm[0], aStrm.size());
+
+ rTreeCtrl.Clear();
+
+ orcus::xml_structure_tree::walker aWalker = aXmlTree.get_walker();
+
+ // Root element.
+ orcus::xml_structure_tree::element aElem = aWalker.root();
+ populateTree(rTreeCtrl, aWalker, aElem.name, NULL);
}
catch (const std::exception&)
{
@@ -218,14 +228,6 @@ bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox&
return false;
}
- rTree.Clear();
-
- orcus::xml_structure_tree::walker aWalker = aTree.get_walker();
-
- // Root element.
- orcus::xml_structure_tree::element aElem = aWalker.root();
- populateTree(rTree, aWalker, aElem.name, NULL);
-
return true;
}
commit b34d3cdb93a99949358841cab35972d948b91b09
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Oct 3 09:47:07 2012 -0400
Populate the tree box with real xml structure tree.
Change-Id: Ia91340cee5e25b118ae72a62e0d94cdc976bc14e
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index e5c5507..0afaee4 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -17,6 +17,9 @@
#define __ORCUS_STATIC_LIB
#include <orcus/spreadsheet/import_interface.hpp>
#include <orcus/orcus_csv.hpp>
+#include <orcus/xml_structure_tree.hpp>
+#include <orcus/xml_namespace.hpp>
+#include <orcus/global.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
@@ -170,14 +173,59 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
return true;
}
-bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox& /*rTree*/) const
+void populateTree(SvTreeListBox& rTree, orcus::xml_structure_tree::walker& rWalker, const orcus::xml_structure_tree::element_name& rElemName, SvLBoxEntry* pParent)
+{
+ OUString aName(rElemName.name.get(), rElemName.name.size(), RTL_TEXTENCODING_UTF8);
+ SvLBoxEntry* pEntry = rTree.InsertEntry(aName, pParent);
+ if (pParent)
+ rTree.Expand(pParent);
+
+ orcus::xml_structure_tree::element_names_type aChildElements;
+ rWalker.get_children(aChildElements);
+
+ orcus::xml_structure_tree::element_names_type::const_iterator it = aChildElements.begin();
+ orcus::xml_structure_tree::element_names_type::const_iterator itEnd = aChildElements.end();
+ for (; it != itEnd; ++it)
+ {
+ rWalker.descend(*it);
+ populateTree(rTree, rWalker, *it, pEntry);
+ rWalker.ascend();
+ }
+}
+
+bool ScOrcusFiltersImpl::loadXMLStructure(const OUString& rPath, SvTreeListBox& rTree) const
{
INetURLObject aURL(rPath);
OString aSysPath = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8);
const char* path = aSysPath.getStr();
- fprintf(stdout, "ScOrcusFiltersImpl::loadXMLStructure: path = '%s'\n", path);
- // TODO: Load the tree box.
+ // TODO: Use our own stream loading call instead of one from orcus.
+ std::string aStrm;
+ orcus::load_file_content(path, aStrm);
+
+ if (aStrm.empty())
+ return false;
+
+ orcus::xmlns_repository aNsRepo; // xml namespace repository.
+ orcus::xml_structure_tree aTree(aNsRepo);
+ try
+ {
+ aTree.parse(&aStrm[0], aStrm.size());
+ }
+ catch (const std::exception&)
+ {
+ // Parsing of this XML file failed.
+ return false;
+ }
+
+ rTree.Clear();
+
+ orcus::xml_structure_tree::walker aWalker = aTree.get_walker();
+
+ // Root element.
+ orcus::xml_structure_tree::element aElem = aWalker.root();
+ populateTree(rTree, aWalker, aElem.name, NULL);
+
return true;
}
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index e94d132..39ccbe5 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -29,15 +29,6 @@ ScXMLSourceTree::ScXMLSourceTree(Window* pParent, const ResId& rResId) :
{
SetDefaultExpandedEntryBmp(maImgElemDefault);
SetDefaultCollapsedEntryBmp(maImgElemDefault);
-
- SvLBoxEntry* p = InsertEntry(OUString("Test1"));
- p = InsertEntry(OUString("Test2"));
- SvLBoxEntry* pPar = p;
- p = InsertEntry(OUString("Test3"), p);
- Expand(pPar);
- pPar = p;
- p = InsertEntry(OUString("Test4"), p);
- Expand(pPar);
}
ScXMLSourceDlg::ScXMLSourceDlg(Window* pParent, ScDocument* pDoc) :
commit 8df81faa31dcfabe33909e7f0e534a65c72d995c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Oct 2 19:46:47 2012 -0400
orcus from master now has a new interface.
Change-Id: I1d03d5dd2b12cdc1eab2d599199c333d49d306b8
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list